[jbosstools-commits] JBoss Tools SVN: r7034 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Mar 20 07:46:46 EDT 2008


Author: dmaliarevich
Date: 2008-03-20 07:46:45 -0400 (Thu, 20 Mar 2008)
New Revision: 7034

Modified:
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabPanelTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1697, css style classes added and updated, code adjustment

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabPanelTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabPanelTemplate.java	2008-03-20 09:40:52 UTC (rev 7033)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabPanelTemplate.java	2008-03-20 11:46:45 UTC (rev 7034)
@@ -28,9 +28,18 @@
 
 public class RichFacesTabPanelTemplate extends VpeAbstractTemplate implements VpeToggableTemplate {
 
-	final static String RICH_FACES_TAB_PANEL = "richFacesTabPanel"; //$NON-NLS-1$
-	final static String CSS_FILE_PATH = "tabPanel/tabPanel.css"; //$NON-NLS-1$
-	final static String SPACER_FILE_PATH = "common/spacer.gif"; //$NON-NLS-1$
+	public static final String CSS_PANEL = "rich-tabpanel"; //$NON-NLS-1$
+	public static final String CSS_CONTENT = "rich-tabpanel-content"; //$NON-NLS-1$
+	public static final String CSS_CONTENT_POSITION = "rich-tabpanel-content-position"; //$NON-NLS-1$
+	public static final String CSS_SIDE_BORDER = "rich-tabhdr-side-border"; //$NON-NLS-1$
+	public static final String CSS_SIDE_CELL = "rich-tabhdr-side-cell"; //$NON-NLS-1$
+	public static final String CSS_CELL_ACTIVE = "rich-tabhdr-cell-active"; //$NON-NLS-1$
+	public static final String CSS_CELL_INACTIVE = "rich-tabhdr-cell-inactive"; //$NON-NLS-1$
+	public static final String CSS_CELL_DISABLED = "rich-tabhdr-cell-disabled"; //$NON-NLS-1$
+	
+	private static final String RICH_FACES_TAB_PANEL = "richFacesTabPanel"; //$NON-NLS-1$
+	private static final String CSS_FILE_PATH = "tabPanel/tabPanel.css"; //$NON-NLS-1$
+	private static final String SPACER_FILE_PATH = "common/spacer.gif"; //$NON-NLS-1$
 
 	private final String HEADER_ALINGMENT = "headerAlignment"; //$NON-NLS-1$
 	private final String HEADER_SPACING = "headerSpacing"; //$NON-NLS-1$
@@ -43,11 +52,6 @@
 	private final String INACTIVE_TAB_CLASS = "inactiveTabClass"; //$NON-NLS-1$
 	private final String DISABLED_TAB_CLASS = "disabledTabClass"; //$NON-NLS-1$
 	
-	private final String CSS_PANEL = "rich-tabpanel"; //$NON-NLS-1$
-	private final String CSS_CONTENT = "rich-tabpanel-content"; //$NON-NLS-1$
-	private final String CSS_CONTENT_POSITION = "rich-tabpanel-content-position"; //$NON-NLS-1$
-	private final String CSS_SIDE_BORDER = "rich-tabhdr-side-border"; //$NON-NLS-1$
-	private final String CSS_SIDE_CELL = "rich-tabhdr-side-cell"; //$NON-NLS-1$
 	
 	private final String ZERO = "0"; //$NON-NLS-1$
 	private final String ONE = "1"; //$NON-NLS-1$
@@ -68,7 +72,11 @@
 		
 		VpeCreationData creationData = new VpeCreationData(table);
 		ComponentUtil.setCSSLink(pageContext, CSS_FILE_PATH, RICH_FACES_TAB_PANEL);
-		table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_PANEL + SPACE + ComponentUtil.getAttribute(sourceElement, HtmlComponentUtil.HTML_STYLECLASS_ATTR));
+		table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, 
+				ComponentUtil.getAttribute(sourceElement,	HtmlComponentUtil.HTML_STYLECLASS_ATTR)
+				+ SPACE + CSS_PANEL
+				+ SPACE + CSS_CONTENT
+				+ SPACE + CSS_CONTENT_POSITION);
 		table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
 		table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, ZERO);
 		table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, ZERO);
@@ -108,12 +116,14 @@
 			
 			if(child.getNodeName().endsWith(TAB)) {
 				RichFacesTabTemplate.encodeHeader((Element) child,
-						visualDocument, inerTr, active, ComponentUtil
-								.getAttribute(sourceElement, ACTIVE_TAB_CLASS),
+						visualDocument, inerTr, active, 
+						ComponentUtil.getAttribute(sourceElement, 
+								ACTIVE_TAB_CLASS),
 						ComponentUtil.getAttribute(sourceElement,
 								INACTIVE_TAB_CLASS),
 						ComponentUtil.getAttribute(sourceElement,
-								DISABLED_TAB_CLASS), String.valueOf(i));
+								DISABLED_TAB_CLASS), 
+								String.valueOf(i));
 				i++;
 				// Add <td><img src="#{spacer}" height="1" alt="" border="0" style="#{this:encodeHeaderSpacing(context, component)}"/></td>
 				nsIDOMElement spaceTd = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
@@ -152,15 +162,24 @@
 				if (active) {
 					RichFacesTabTemplate.encodeBody(creationData,
 							(Element) child, visualDocument, inerTr, true,
+							ComponentUtil.getAttribute(sourceElement,	
+									TAB_CLASS)
+									+ SPACE + CSS_SIDE_CELL
+									+ SPACE + CSS_SIDE_BORDER, 
+							ComponentUtil.getAttribute(sourceElement, 
+									ACTIVE_TAB_CLASS)
+									+ SPACE + CSS_CELL_ACTIVE,
 							ComponentUtil.getAttribute(sourceElement,
-									TAB_CLASS), ComponentUtil.getAttribute(
-									sourceElement, ACTIVE_TAB_CLASS),
+									INACTIVE_TAB_CLASS)
+									+ SPACE + CSS_CELL_INACTIVE, 
 							ComponentUtil.getAttribute(sourceElement,
-									INACTIVE_TAB_CLASS), ComponentUtil
-									.getAttribute(sourceElement,
-											DISABLED_TAB_CLASS),
+									DISABLED_TAB_CLASS)
+									+ SPACE + CSS_CELL_DISABLED,
 							ComponentUtil.getAttribute(sourceElement,
-									CONTENT_CLASS),
+									CONTENT_CLASS)
+									+ SPACE + CSS_PANEL
+									+ SPACE + CSS_CONTENT
+									+ SPACE + CSS_CONTENT_POSITION,
 							ComponentUtil.getAttribute(sourceElement,
 									CONTENT_STYLE));
 					break;
@@ -259,4 +278,15 @@
 	public void stopToggling(Node sourceNode) {
 		toggleMap.remove(sourceNode);
 	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument, org.mozilla.interfaces.nsIDOMElement, java.lang.Object, java.lang.String, java.lang.String)
+	 */
+	@Override
+	public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+			Element sourceElement, nsIDOMDocument visualDocument,
+			nsIDOMElement visualNode, Object data, String name, String value) {
+		return true;
+	}
+	
 }
\ No newline at end of file

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabTemplate.java	2008-03-20 09:40:52 UTC (rev 7033)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabTemplate.java	2008-03-20 11:46:45 UTC (rev 7034)
@@ -13,6 +13,7 @@
 import java.util.List;
 
 import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
 import org.jboss.tools.vpe.editor.context.VpePageContext;
 import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
 import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
@@ -24,12 +25,33 @@
 
 public class RichFacesTabTemplate extends VpeAbstractTemplate {
 
+	private final static String SPACER_FILE_PATH = "common/spacer.gif"; //$NON-NLS-1$
+	private final static String ACTIVE_BKG_FILE_PATH = "tabPanel/activeBackground.gif"; //$NON-NLS-1$
+	private final static String INACTIVE_BKG_FILE_PATH = "tabPanel/inactiveBackground.gif"; //$NON-NLS-1$
+	private final static String BORDER_FILE_PATH = "tabPanel/border.gif"; //$NON-NLS-1$
+	
+	private final static String VPE_USER_TOGGLE_ID = "vpe-user-toggle-id"; //$NON-NLS-1$
+
+	private static final String DISABLED = "disabled"; //$NON-NLS-1$
+	private static final String LABEL = "label"; //$NON-NLS-1$
+	
+	private static final String CSS_HEADER = "rich-tab-header"; //$NON-NLS-1$
+	private static final String CSS_LABEL = "rich-tab-label"; //$NON-NLS-1$
+	private static final String CSS_ACTIVE = "rich-tab-active"; //$NON-NLS-1$
+	private static final String CSS_INACTIVE = "rich-tab-inactive"; //$NON-NLS-1$
+	private static final String CSS_DISABLED = "rich-tab-disabled"; //$NON-NLS-1$
+	
+	private static final String ZERO = "0"; //$NON-NLS-1$
+	private static final String ONE = "1"; //$NON-NLS-1$
+	private static final String SPACE = " "; //$NON-NLS-1$
+	private static final String EMPTY = ""; //$NON-NLS-1$
+	
 	/**
 	 * Encode body of tab
 	 * @param creationData
 	 * @param sourceElement
 	 * @param visualDocument
-	 * @param parentVisualElement
+	 * @param parentTr
 	 * @param active
 	 * @param tabClass
 	 * @param activeTabClass
@@ -39,44 +61,53 @@
 	 * @param contentStyle
 	 * @return
 	 */
-	public static VpeCreationData encodeBody(VpeCreationData creationData, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMElement parentVisualElement, boolean active,
+	public static VpeCreationData encodeBody(VpeCreationData creationData, 
+			Element sourceElement, 
+			nsIDOMDocument visualDocument, 
+			nsIDOMElement parentTr, 
+			boolean active,
 			String tabClass,
 			String activeTabClass,
 			String inactiveTabClass,
 			String disabledTabClass,
 			String contentClass,
 			String contentStyle) {
-	    
-	    	nsIDOMElement td = visualDocument.createElement("td");
 
+	    	nsIDOMElement td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
 		if(creationData==null) {
 			
 			creationData = new VpeCreationData(td);
 		} else {
-			parentVisualElement.appendChild(td);
+			parentTr.appendChild(td);
 		}
 		if(!active) {
 			return creationData;
 		}
 //		td.setAttribute("style", "position: relative;");
-		td.setAttribute("height", "100%");
+		td.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, "100%");
 		
 
-		nsIDOMElement table = visualDocument.createElement("table");
+		nsIDOMElement table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
 		td.appendChild(table);
-		table.setAttribute("border", "0");
-		table.setAttribute("cellpadding", "10");
-		table.setAttribute("cellspacing", "0");
-		table.setAttribute("width", "100%");
-		table.setAttribute("class", "dr-tbpnl-cntnt-pstn rich-tabpanel-content-position");
-		table.setAttribute("style", "position: relative; z-index: 1;");
+		table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
+		table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "10");
+		table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, ZERO);
+		table.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%");
+		table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-tbpnl-cntnt-pstn" + SPACE + RichFacesTabPanelTemplate.CSS_CONTENT_POSITION);
+		table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "position: relative; z-index: 1;");
 
-		nsIDOMElement tr = visualDocument.createElement("tr");
+		nsIDOMElement tr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
 		table.appendChild(tr);
-		td = visualDocument.createElement("td");
+		td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
 		tr.appendChild(td);
-		td.setAttribute("class", "dr-tbpnl-cntnt rich-tabpanel-content " + contentClass + " " + ComponentUtil.getAttribute(sourceElement, "styleClass"));
-		td.setAttribute("style", ComponentUtil.getAttribute(sourceElement, "contentStyle") + "; " + ComponentUtil.getAttribute(sourceElement, "style"));
+		td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, 
+				ComponentUtil.getAttribute(sourceElement, HtmlComponentUtil.HTML_STYLECLASS_ATTR)
+				+ SPACE + "dr-tbpnl-cntnt"
+				+ SPACE + contentClass);
+		td.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, 
+				ComponentUtil.getAttribute(sourceElement, HtmlComponentUtil.HTML_STYLE_ATTR)
+				+ "; " +  contentStyle);
 
 		List<Node> children = ComponentUtil.getChildren(sourceElement, true);
 		VpeChildrenInfo bodyInfo = new VpeChildrenInfo(td);
@@ -89,7 +120,7 @@
 	}
 
 	public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
-		return encodeBody(null, (Element)sourceNode, visualDocument, null, true, "", "", "", "", "", "");
+		return encodeBody(null, (Element)sourceNode, visualDocument, null, true, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY);
 	}
 
 	/**
@@ -102,76 +133,96 @@
 	 * @param inactiveTabClass
 	 * @param disabledTabClass
 	 */
-	public static void encodeHeader(Element sourceElement, nsIDOMDocument visualDocument, nsIDOMElement parentDiv, boolean active,
+	public static void encodeHeader(Element sourceElement, 
+			nsIDOMDocument visualDocument, 
+			nsIDOMElement parentDiv,
+			boolean active,
 			String activeTabClass,
 			String inactiveTabClass,
-			String disabledTabClass, String toggleId) {
+			String disabledTabClass, 
+			String toggleId) {
 	    
-		nsIDOMElement td = visualDocument.createElement("td");
+		nsIDOMElement td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
 		parentDiv.appendChild(td);
-		td.setAttribute("style", "height: 100%; vertical-align: bottom;");
+		td.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "height: 100%; vertical-align: bottom;");
 		String styleClass = "dr-tbpnl-tbcell-dsbl rich-tabhdr-cell-dsbl";
-		if(!"true".equalsIgnoreCase(sourceElement.getAttribute("disabled"))) {
+		if(!"true".equalsIgnoreCase(sourceElement.getAttribute(DISABLED))) {
 			if(active) {
-				styleClass = "dr-tbpnl-tbcell-act rich-tabhdr-cell-active";
+				styleClass = "dr-tbpnl-tbcell-act" 
+					+ SPACE + RichFacesTabPanelTemplate.CSS_CELL_ACTIVE;
 			} else {
-				styleClass = "dr-tbpnl-tbcell-inact rich-tabhdr-cell-inactive";
+				styleClass = "dr-tbpnl-tbcell-inact"
+					+ SPACE + RichFacesTabPanelTemplate.CSS_CELL_INACTIVE;
 			}
 		}
-		td.setAttribute("class", styleClass);
-		td.setAttribute("vpe-user-toggle-id", toggleId);
+		td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
+		td.setAttribute(VPE_USER_TOGGLE_ID, toggleId);
 
-		nsIDOMElement table = visualDocument.createElement("table");
+		nsIDOMElement table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
 		td.appendChild(table);
-		table.setAttribute("border", "0");
-		table.setAttribute("cellpadding", "0");
-		table.setAttribute("cellspacing", "0");
-		table.setAttribute("style", "height : 100%; position : relative; z-index : 2;");
-		table.setAttribute("vpe-user-toggle-id", toggleId);
+		table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
+		table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, ZERO);
+		table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, ZERO);
+		table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "height : 100%; position : relative; z-index : 2;");
+		table.setAttribute(VPE_USER_TOGGLE_ID, toggleId);
 
-		nsIDOMElement mainTr = visualDocument.createElement("tr");
+		nsIDOMElement mainTr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
 		table.appendChild(mainTr);
 		encodeSpacer(mainTr, visualDocument);
 
-		td = visualDocument.createElement("td");
+		td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
 		mainTr.appendChild(td);
-		td.setAttribute("class", "dr-tbpnl-tbtopbrdr rich-tabhdr-side-cell");
-		td.setAttribute("style", "width: " + ComponentUtil.getAttribute(sourceElement, "labelWidth") + ";");
-		td.setAttribute("vpe-user-toggle-id", toggleId);
+		td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-tbpnl-tbtopbrdr"
+				+ SPACE + RichFacesTabPanelTemplate.CSS_SIDE_CELL);
+		td.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "width: "
+				+ ComponentUtil.getAttribute(sourceElement,"labelWidth") + ";");
+		td.setAttribute(VPE_USER_TOGGLE_ID, toggleId);
 
-		table = visualDocument.createElement("table");
+		table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
 		td.appendChild(table);
-		table.setAttribute("style", "height: 100%; width: 100%;");
-		table.setAttribute("border", "0");
-		table.setAttribute("cellpadding", "0");
-		table.setAttribute("cellspacing", "0");
-		table.setAttribute("vpe-user-toggle-id", toggleId);
+		table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "height: 100%; width: 100%;");
+		table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
+		table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, ZERO);
+		table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, ZERO);
+		table.setAttribute(VPE_USER_TOGGLE_ID, toggleId);
 
-		nsIDOMElement tr = visualDocument.createElement("tr");
+		nsIDOMElement tr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
 		table.appendChild(tr);
-		td = visualDocument.createElement("td");
+		td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
 		tr.appendChild(td);
 
-		styleClass = "dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-dsbl rich-tab-disabled " + disabledTabClass;
-		String bgImgPath = ComponentUtil.getAbsoluteResourcePath("tabPanel/inactiveBackground.gif");
+		styleClass = "dr-tbpnl-tb dr-tbpnl-tb-dsbl"
+			+ SPACE + CSS_HEADER
+			+ SPACE + CSS_LABEL
+			+ SPACE + CSS_DISABLED
+			+ SPACE + disabledTabClass;
+		String bgImgPath = ComponentUtil.getAbsoluteResourcePath(INACTIVE_BKG_FILE_PATH);
 
-		if(!"true".equalsIgnoreCase(sourceElement.getAttribute("disabled"))) {
+		if(!"true".equalsIgnoreCase(sourceElement.getAttribute(DISABLED))) {
 			if(active) {
-				styleClass = "dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-act rich-tab-active " + activeTabClass;
-				bgImgPath = ComponentUtil.getAbsoluteResourcePath("tabPanel/activeBackground.gif");
+				styleClass = "dr-tbpnl-tb dr-tbpnl-tb-act"
+					+ SPACE + CSS_HEADER
+					+ SPACE + CSS_LABEL
+					+ SPACE + CSS_ACTIVE
+					+ SPACE + activeTabClass;
+				bgImgPath = ComponentUtil.getAbsoluteResourcePath(ACTIVE_BKG_FILE_PATH);
 			} else {
-				styleClass = "dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-inact rich-tab-inactive " + inactiveTabClass;
+				styleClass = "dr-tbpnl-tb dr-tbpnl-tb-inact"
+					+ SPACE + CSS_HEADER
+					+ SPACE + CSS_LABEL
+					+ SPACE + CSS_INACTIVE
+					+ SPACE + inactiveTabClass;
 			}
 		}
 
-		td.setAttribute("class", styleClass);
+		td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
 		String style = "background-image: url(file:///" + bgImgPath.replace('\\', '/') + ");";
-		td.setAttribute("style", style);
-		td.setAttribute("vpe-user-toggle-id", toggleId);
-		String label = sourceElement.getAttribute("label");
+		td.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+		td.setAttribute(VPE_USER_TOGGLE_ID, toggleId);
+		String label = sourceElement.getAttribute(LABEL);
 		if(label==null) {
 			char space = 160;
-			label = "" + space;
+			label = EMPTY + space;
 		}
 		td.appendChild(visualDocument.createTextNode(label));
 		encodeSpacer(mainTr, visualDocument);
@@ -181,17 +232,20 @@
 	 * Add <td class="dr-tbpnl-tbbrdr rich-tabhdr-side-border"><img src="#{spacer}" width="1" height="1" alt="" border="0" /></td>
 	 */
 	private static void encodeSpacer(nsIDOMElement parentTr, nsIDOMDocument visualDocument) {
-	    	nsIDOMElement td = visualDocument.createElement("td");
+	    	nsIDOMElement td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
 		parentTr.appendChild(td);
-		td.setAttribute("class", "dr-tbpnl-tbbrdr rich-tabhdr-side-border");
-		String borderImgPath = ComponentUtil.getAbsoluteResourcePath("tabPanel/border.gif");
+		td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-tbpnl-tbbrdr"
+				+ SPACE + RichFacesTabPanelTemplate.CSS_SIDE_BORDER);
+		String borderImgPath = ComponentUtil.getAbsoluteResourcePath(BORDER_FILE_PATH);
 		String style = "background-image: url(file:///" + borderImgPath.replace('\\', '/') + ");";
-		td.setAttribute("style", style);
-		nsIDOMElement img = visualDocument.createElement("img");
+		td.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+		nsIDOMElement img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
 		td.appendChild(img);
-		ComponentUtil.setImg(img, "common/spacer.gif");
-		img.setAttribute("width", "1");
-		img.setAttribute("height", "1");
-		img.setAttribute("border", "0");
+		ComponentUtil.setImg(img, SPACER_FILE_PATH);
+		img.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, ONE);
+		img.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, ONE);
+		img.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
+
 	}
+
 }
\ No newline at end of file




More information about the jbosstools-commits mailing list