1 7 8 package org.jboss.portal.core.theme.impl; 9 10 import org.apache.log4j.Logger; 11 import org.jboss.portal.server.theme.PortalTheme; 12 import org.jboss.portal.server.theme.ThemeScript; 13 14 21 public class ThemeScriptImpl 22 implements ThemeScript 23 { 24 private static final Logger log = Logger.getLogger(ThemeScriptImpl.class); 25 private String m_src; 26 private String m_type; 27 private PortalTheme m_theme; 28 29 36 public ThemeScriptImpl(PortalTheme theme, String src, String type) 37 { 38 log.debug("creating theme script with SRC=" + src + " type=" + type); 39 m_theme = theme; 40 m_src = src; 41 m_type = type; 42 } 43 44 47 public StringBuffer getScript() 48 { 49 log.debug("get script ..."); 50 StringBuffer script = new StringBuffer (); 51 script.append("<script "); 52 if (m_src != null && !"".equals(m_src)) 55 { 56 StringBuffer correctSRC = new StringBuffer (); 57 if (m_src.startsWith("/")) 58 { 59 correctSRC.append(m_theme.getContextPath()); 60 } 61 correctSRC.append(m_src); 62 script.append(" SRC='").append(correctSRC).append("'"); 63 } 64 65 if (m_type != null && !"".equals(m_type)) 66 { 67 script.append(" type='").append(m_type).append("'"); 68 } 69 script.append(" />"); 70 71 log.debug("returning script : " + script); 72 73 return script; 74 } 75 76 79 public String toString() 80 { 81 return getScript().toString(); 82 } 83 } 84 | Popular Tags |