[jbosstools-commits] JBoss Tools SVN: r23246 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces: template and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Jul 6 07:03:16 EDT 2010


Author: dvinnichek
Date: 2010-07-06 07:03:16 -0400 (Tue, 06 Jul 2010)
New Revision: 23246

Modified:
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnGroupTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableStyleClassesApplier.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToggleControlTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTogglePanelTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java
Log:
fix templates for rich components according to JBIDE-6542

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -476,9 +476,9 @@
      * @return the attribute
      */
     public static String getAttribute(Element sourceElement, String attributeName) {
-        String attribute = sourceElement.getAttribute(attributeName);
-        if (attribute == null) {
-            attribute = Constants.EMPTY;
+        String attribute = Constants.EMPTY;
+        if (sourceElement.hasAttribute(attributeName)) {
+            attribute = sourceElement.getAttribute(attributeName);
         }
         return attribute;
     }

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -405,12 +405,11 @@
 		+ Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
 	if (sourceNode.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
 	    Element sourceElement = (Element) sourceNode;
-	    String nodes = sourceElement
-		    .getAttribute(RichFacesRecursiveTreeNodesAdaptorTemplate.NODES_NAME);
+	    String nodes = sourceElement.hasAttribute(RichFacesRecursiveTreeNodesAdaptorTemplate.NODES_NAME) ? 
+	    		sourceElement.getAttribute(RichFacesRecursiveTreeNodesAdaptorTemplate.NODES_NAME) : Constants.EMPTY;
 	    nsIDOMElement textContainer = VisualDomUtil
 	    		.createBorderlessContainer(visualDocument);
-	    nsIDOMText text = visualDocument
-		    .createTextNode((nodes == null) ? Constants.EMPTY : nodes);
+	    nsIDOMText text = visualDocument.createTextNode(nodes);
 	    textContainer.appendChild(text);
 	    nodeTitle.appendChild(textContainer);
 	} else {
@@ -565,7 +564,7 @@
 	if (imgName == null || imgName.length() == 0) {
 	    Node parentElement = sourceNode.getParentNode();
 	    if (parentElement instanceof Element) {
-		imgName = ((Element) parentElement).getAttribute(nodeAttrName);
+	    	imgName = ((Element) parentElement).getAttribute(nodeAttrName);
 	    }
 	} else {
 	    img.setAttribute(ICON_PARAM_NAME, Constants.EMPTY);
@@ -681,11 +680,9 @@
     protected void addAttributeToTableNode(Element sourceNode,
 	    nsIDOMElement tableRow) {
 
-	String attrValue = sourceNode
-		.getAttribute(NODE_TITLE_STYLE_CLASS_ATTR_NAME);
-	if ((attrValue != null) && (attrValue.length() > 0)) {
-	    tableRow.setAttribute(HTML.ATTR_CLASS, attrValue);
-	}
+    	if (sourceNode.hasAttribute(NODE_TITLE_STYLE_CLASS_ATTR_NAME)) {
+    		tableRow.setAttribute(HTML.ATTR_CLASS, sourceNode.getAttribute(NODE_TITLE_STYLE_CLASS_ATTR_NAME));
+    	}
     }
 
 }

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnGroupTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnGroupTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -96,7 +96,7 @@
 	@Override
 	protected String getRowClass(int row) {
 		String rowClass = super.getRowClass(row);
-		if (styleClass != null) {
+		if (styleClass != null && styleClass.length() > 0) {
 			rowClass += ' ' + styleClass;
 		}
 		return rowClass;

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableStyleClassesApplier.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableStyleClassesApplier.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableStyleClassesApplier.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -132,12 +132,7 @@
 		int classesSize = classes.size();
 		if (classesSize > 0) {
 			final String clazz = classes.get(elementIndex % classesSize);
-			String actualClass = element.getAttribute(HTML.ATTR_CLASS);
-			if (actualClass == null) {
-				actualClass = clazz;
-			} else {
-				actualClass+= HTML.VALUE_CLASS_DELIMITER + clazz;
-			}
+			String actualClass = element.hasAttribute(HTML.ATTR_CLASS) ? element.getAttribute(HTML.ATTR_CLASS) + HTML.VALUE_CLASS_DELIMITER + clazz : clazz;
 			element.setAttribute(HTML.ATTR_CLASS, actualClass);
 		}
 	}

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -162,18 +162,16 @@
 		 * Encode caption
 		 */
 		if (null != captionBody) {
-			String captionClass = (String) table.getAttribute(RichFaces.ATTR_CAPTION_CLASS);
-			String captionStyle = (String) table.getAttribute(RichFaces.ATTR_CAPTION_STYLE);
-
+			
 			nsIDOMElement caption = visualDocument.createElement(HTML.TAG_CAPTION);
 			table.appendChild(caption);
-			if (captionClass != null && captionClass.length()>0) {
-				captionClass = "dr-table-caption rich-table-caption " + captionClass; //$NON-NLS-1$
-			} else {
-				captionClass = "dr-table-caption rich-table-caption"; //$NON-NLS-1$
-			}
+			
+			String defaultCaptionClass = "dr-table-caption rich-table-caption"; //$NON-NLS-1$
+			String captionClass = table.hasAttribute(RichFaces.ATTR_CAPTION_CLASS) ? defaultCaptionClass + " " + table.getAttribute(RichFaces.ATTR_CAPTION_CLASS) : defaultCaptionClass; //$NON-NLS-1$
 			caption.setAttribute(HTML.ATTR_CLASS, captionClass);
-			if (captionStyle != null && captionStyle.length()>0) {
+			
+			if (table.hasAttribute(RichFaces.ATTR_CAPTION_STYLE)) {
+				String captionStyle = table.getAttribute(RichFaces.ATTR_CAPTION_STYLE);
 				caption.setAttribute(HTML.ATTR_STYLE, captionStyle);
 			}
 			
@@ -349,7 +347,6 @@
 						currentLength = 0;
 					}
 					String colspanStr = column.getAttribute("colspan"); //$NON-NLS-1$
-					Integer colspan = null;
 					try {
 						currentLength += Integer.parseInt(colspanStr);
 					} catch (NumberFormatException e) {

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -72,24 +72,24 @@
 	}
 
 	public nsIDOMElement create() {
+		
 		ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "editor"); //$NON-NLS-1$
-
-		String style = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
-		if (style == null) {
-			style = ""; //$NON-NLS-1$
-		}
-		String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
-		if (styleClass == null) {
-			styleClass = ""; //$NON-NLS-1$
-		}
-
 		// create nodes
 		nsIDOMElement mainSpan = visualDocument.createElement(HTML.TAG_SPAN); {
-			mainSpan.setAttribute(HTML.ATTR_CLASS, "richfacesSimpleSkin " + styleClass); //$NON-NLS-1$
+			
+			String styleClass = "richfacesSimpleSkin"; //$NON-NLS-1$
+			if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+				styleClass += " " + sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS); //$NON-NLS-1$
+			}
+			mainSpan.setAttribute(HTML.ATTR_CLASS, styleClass);
 
 			// Yahor Radtsevich: Fix of JBIDE-3653: inFlasher doesn't shows for rich:editor component
 			// (style "display: table;" has been added)
-			mainSpan.setAttribute(HTML.ATTR_STYLE, "display: table;" + style); //$NON-NLS-1$
+			String style = "display: table;"; //$NON-NLS-1$
+			if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE)) {
+				style += sourceElement.getAttribute(RichFaces.ATTR_STYLE);
+			}
+			mainSpan.setAttribute(HTML.ATTR_STYLE, style);
 		}
 		nsIDOMElement mainTable = createMainTable();
 		nsIDOMElement textContainer = createTextContainer();
@@ -112,14 +112,14 @@
 	 */
 	private nsIDOMElement createMainTable() {
 		// evaluate width and height
-		String style = "width: 183px; height: 100px;"; //$NON-NLS-1$
-		String width = sourceElement.getAttribute(RichFaces.ATTR_WIDTH);
-		if (width != null) {
+		String style = "width: 183px; height: 100px;"; //$NON-NLS-1$		
+		if (sourceElement.hasAttribute(RichFaces.ATTR_WIDTH)) {
+			String width = sourceElement.getAttribute(RichFaces.ATTR_WIDTH);
 			width = VpeStyleUtil.addPxIfNecessary(width);
 			style = VpeStyleUtil.setParameterInStyle(style, HTML.STYLE_PARAMETER_WIDTH, width);
-		}
-		String height = sourceElement.getAttribute(RichFaces.ATTR_HEIGHT);
-		if (height != null) {
+		}		
+		if (sourceElement.hasAttribute(RichFaces.ATTR_HEIGHT)) {
+			String height = sourceElement.getAttribute(RichFaces.ATTR_HEIGHT);
 			height = VpeStyleUtil.addPxIfNecessary(height);
 			style = VpeStyleUtil.setParameterInStyle(style, HTML.STYLE_PARAMETER_HEIGHT, height);
 		}

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -134,7 +134,7 @@
 		}
 
 		// Add Head
-		String headerClass = (String) sourceElement.getAttribute(HEADER_CLASS);
+		String headerClass = sourceElement.hasAttribute(HEADER_CLASS) ? sourceElement.getAttribute(HEADER_CLASS) : null;
 		nsIDOMElement thead = visualDocument.createElement(HTML.TAG_THEAD);
 		tableCommon.appendChild(thead);
 		nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
@@ -154,7 +154,7 @@
 		// Add footer
 		nsIDOMElement tfoot = visualDocument.createElement(HTML.TAG_TFOOT);
 		tableCommon.appendChild(tfoot);
-		String footerClass = (String) sourceElement.getAttribute(FOOTER_CLASS);
+		String footerClass = sourceElement.hasAttribute(FOOTER_CLASS) ? sourceElement.getAttribute(FOOTER_CLASS) : null;
 		nsIDOMElement tfootTR = visualDocument.createElement(HTML.TAG_TR);
 		tfoot.appendChild(tfootTR);
 		String styleFooterClass = ComponentUtil.encodeStyleClass(
@@ -292,7 +292,7 @@
 		String styleClass = EMPTY;
 		for (Element column : footers) {
 
-			String columnHeaderClass = column.getAttribute(classAttribute);
+			String columnHeaderClass = column.hasAttribute(classAttribute) ? column.getAttribute(classAttribute) : null;
 			nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
 			parentTr.appendChild(td);
 			styleClass = ComponentUtil.encodeStyleClass(null,
@@ -355,7 +355,7 @@
 		}
 
 		for (Element column : headers) {
-			String columnHeaderClass = column.getAttribute(classAttribute);
+			String columnHeaderClass = column.hasAttribute(classAttribute) ? column.getAttribute(classAttribute) : null;
 			nsIDOMElement td = visualDocument.createElement(HTML.TAG_TH);
 
 			nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -94,14 +94,13 @@
 		.createElement(HtmlComponentUtil.HTML_TAG_DIV);
 	VpeCreationData vpeCreationData = new VpeCreationData(div);
 
-	String srcValue = ((Element) sourceNode).getAttribute(SRC_ATTR_NAME);
-	String highlightValue = ((Element) sourceNode)
-		.getAttribute(HIGHTLIGHT_ATTR_NAME);
+	Element sourceElement = (Element)sourceNode;
+	String srcValue = sourceElement.getAttribute(SRC_ATTR_NAME);	
 	String finalStr = ""; //$NON-NLS-1$
 	String buf = ""; //$NON-NLS-1$
 
 	// if there is no source show error message 
-	if ((null == srcValue) || ("".equalsIgnoreCase(srcValue))) { //$NON-NLS-1$
+	if (!sourceElement.hasAttribute(SRC_ATTR_NAME) || "".equalsIgnoreCase(srcValue)) { //$NON-NLS-1$
 	    div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, ERROR_MESSAGE_STYLE);
 	    nsIDOMText text = visualDocument.createTextNode(RESOURCE_NOT_FOUND_MESSAGE);
 	    div.appendChild(text);
@@ -141,7 +140,8 @@
 		}
 	}
 
-	if ((highlightValue == null) || (!searchInSupportedTypes(highlightValue))){
+	String highlightValue = sourceElement.getAttribute(HIGHTLIGHT_ATTR_NAME);
+	if (!sourceElement.hasAttribute(HIGHTLIGHT_ATTR_NAME) || !searchInSupportedTypes(highlightValue)) {
 	   // finalStr = finalStr.replace('\n', ' ');
 	    nsIDOMText text = visualDocument.createTextNode(finalStr);
 	    div.appendChild(text);
@@ -282,11 +282,11 @@
 	    el.appendChild(elem);
 
 	    for (int i = 0; i < node.getAttributes().getLength(); i++)
-		elem.setAttribute(node.getAttributes().item(i).getNodeName(),
-			node.getAttributes().item(i).getNodeValue());
+			elem.setAttribute(node.getAttributes().item(i).getNodeName(),
+				node.getAttributes().item(i).getNodeValue());
 
 	    for (int i = 0; i < node.getChildNodes().getLength(); i++)
-		buildVisualNode(node.getChildNodes().item(i), elem);
+	    	buildVisualNode(node.getChildNodes().item(i), elem);
 	}
     }
 

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -36,7 +36,7 @@
     VpeTemplate {
     private static final String PERCENT_100 = "100%"; //$NON-NLS-1$
     private static final String PANEL_BAR_ITEM = ":panelBarItem"; //$NON-NLS-1$
-    private static final String DR_PNLBAR_RICH_PANELBAR_DR_PNLBAR_B = "dr-pnlbar rich-panelbar dr-pnlbar-b "; //$NON-NLS-1$
+    private static final String DR_PNLBAR_RICH_PANELBAR_DR_PNLBAR_B = "dr-pnlbar rich-panelbar dr-pnlbar-b"; //$NON-NLS-1$
     private static final String PANEL_BAR_PANEL_BAR_CSS = "panelBar/panelBar.css"; //$NON-NLS-1$
     private static Map<Node, String> toggleMap = new HashMap<Node, String>();
 
@@ -50,9 +50,11 @@
 
         ComponentUtil.setCSSLink(pageContext, PANEL_BAR_PANEL_BAR_CSS, "richFacesPanelBar"); //$NON-NLS-1$
 
-        String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
-        table.setAttribute(HTML.ATTR_CLASS,
-            DR_PNLBAR_RICH_PANELBAR_DR_PNLBAR_B + ((styleClass == null) ? Constants.EMPTY : styleClass));
+        String styleClass = DR_PNLBAR_RICH_PANELBAR_DR_PNLBAR_B;
+        if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+        	styleClass += " " + sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS); //$NON-NLS-1$
+        }
+        table.setAttribute(HTML.ATTR_CLASS, styleClass);
 
         // Set style attribute
         StringBuffer styleValue = new StringBuffer("padding: 0px; "); //$NON-NLS-1$
@@ -104,10 +106,10 @@
      * @return
      */
     private String height(Element sourceElement) {
-        String height = sourceElement.getAttribute(HTML.ATTR_HEIGHT);
+        String height = PERCENT_100;
 
-        if ((height == null) || (height.length() == 0)) {
-            height = PERCENT_100;
+        if (sourceElement.hasAttribute(HTML.ATTR_HEIGHT)) {
+            height = sourceElement.getAttribute(HTML.ATTR_HEIGHT);
         }
 
         // added by estherbin fix not worked junit JBIDE1713Test
@@ -130,10 +132,10 @@
      * @return
      */
     public String width(Element sourceElement) {
-        String width = sourceElement.getAttribute(HTML.ATTR_WIDTH);
+        String width = PERCENT_100;
 
-        if ((width == null) || (width.length() == 0)) {
-            width = PERCENT_100;
+        if (sourceElement.hasAttribute(HTML.ATTR_WIDTH)) {
+            width = sourceElement.getAttribute(HTML.ATTR_WIDTH);
         }
 
         // added by estherbin fix not worked junit JBIDE1713Test

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -569,8 +569,8 @@
 		/*
 		 * Do nothing when panel menu or panel group are disabled.
 		 */
-		if ((TRUE.equalsIgnoreCase(pm_disabled))
-				|| (TRUE.equalsIgnoreCase(pmg_disabled))) {
+		if (TRUE.equalsIgnoreCase(pm_disabled)
+				|| TRUE.equalsIgnoreCase(pmg_disabled)) {
 			return;
 		}
 		
@@ -581,7 +581,7 @@
 		/*
 		 * Expand only one group.
 		 */
-		if ((null != pm_expandSingle) && (TRUE.equalsIgnoreCase(pm_expandSingle))) {
+		if (TRUE.equalsIgnoreCase(pm_expandSingle)) {
 			if (expandedIds.contains(toggleId)) {
 				/*
 				 * Close group and its children

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -108,9 +108,7 @@
 		ComponentUtil.setCSSLink(pageContext, CSS_STYLE_PATH, COMPONENT_NAME);
 	    
 		Element sourceElement = (Element) sourceNode;
-		String widthAttr = sourceElement.getAttribute(HTML.ATTR_WIDTH);
-		String styleAttr = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
-		String styleClassAttr = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+		
 		String style = Constants.EMPTY;
 		String styleClass = CSS_PMENU;
 		
@@ -118,16 +116,19 @@
 		VpeCreationData vpeCreationData = new VpeCreationData(div);
 		div.setAttribute(HTML.ATTR_BORDER, Constants.ZERO_STRING);
 
-		if (widthAttr != null) {
-		    style += "width:" + widthAttr + "; "; //$NON-NLS-1$ //$NON-NLS-2$
+		if (sourceElement.hasAttribute(HTML.ATTR_WIDTH)) {
+			String widthAttr = sourceElement.getAttribute(HTML.ATTR_WIDTH);
+			style += "width:" + widthAttr + "; "; //$NON-NLS-1$ //$NON-NLS-2$
 		}
-		if (styleAttr != null) {
-		    style += styleAttr;
+		if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE)) {
+			String styleAttr = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
+			style += styleAttr;
 		}
 		div.setAttribute(HTML.ATTR_STYLE, style);
 
-		if (styleClassAttr != null) {
-		    styleClass += Constants.WHITE_SPACE + styleClassAttr;
+		if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+			String styleClassAttr = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+			styleClass += Constants.WHITE_SPACE + styleClassAttr;
 		}
 		div.setAttribute(HTML.ATTR_CLASS, styleClass);
 		

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -31,21 +31,25 @@
 public class RichFacesPanelTemplate extends VpeAbstractTemplate {
 
 	public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
-
 	   
 		Element sourceElement = (Element)sourceNode;
 
 		nsIDOMElement div = visualDocument.createElement("div"); //$NON-NLS-1$
+		
+		VpeCreationData creationData = new VpeCreationData(div);		
 
+		ComponentUtil.setCSSLink(pageContext, "panel/panel.css", "richFacesPanel"); //$NON-NLS-1$ //$NON-NLS-2$
 		
-		VpeCreationData creationData = new VpeCreationData(div);
+		String styleClass = "dr-pnl rich-panel"; //$NON-NLS-1$
+		String styleClassAttrName = "styleClass"; //$NON-NLS-1$
+		if (sourceElement.hasAttribute(styleClassAttrName)) {
+			styleClass += " " + sourceElement.getAttribute(styleClassAttrName); //$NON-NLS-1$
+		}
+		div.setAttribute("class", styleClass); //$NON-NLS-1$
 		
-
-		ComponentUtil.setCSSLink(pageContext, "panel/panel.css", "richFacesPanel"); //$NON-NLS-1$ //$NON-NLS-2$
-		String styleClass = sourceElement.getAttribute("styleClass"); //$NON-NLS-1$
-		div.setAttribute("class", "dr-pnl rich-panel " + (styleClass==null?"":styleClass)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		String style = sourceElement.getAttribute("style"); //$NON-NLS-1$
-		if(style!=null && style.length()>0) {
+		String styleAttrName = "style"; //$NON-NLS-1$
+		if(sourceElement.hasAttribute(styleAttrName)) {
+			String style = sourceElement.getAttribute(styleAttrName);
 			div.setAttribute("style", style); //$NON-NLS-1$
 		}
 
@@ -64,9 +68,11 @@
 			 */
 			headerDiv.setAttribute(VpeVisualDomBuilder.VPE_FACET, RichFaces.NAME_FACET_HEADER);
 			div.appendChild(headerDiv);
-			String headerClass = sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS);
-			headerDiv.setAttribute(HTML.ATTR_CLASS,
-							"dr-pnl-h rich-panel-header " + (headerClass == null ? "" : headerClass)); //$NON-NLS-1$ //$NON-NLS-2$
+			String headerClass = "dr-pnl-h rich-panel-header"; //$NON-NLS-1$
+			if (sourceElement.hasAttribute(RichFaces.ATTR_HEADER_CLASS)) {
+				headerClass += " " + sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS); //$NON-NLS-1$
+			}
+			headerDiv.setAttribute(HTML.ATTR_CLASS, headerClass);
 			headerDiv.setAttribute(HTML.ATTR_STYLE, 
 					ComponentUtil.getHeaderBackgoundImgStyle());
 
@@ -80,9 +86,11 @@
 		 */
 		nsIDOMElement bodyDiv = visualDocument.createElement(HTML.TAG_DIV);
 		div.appendChild(bodyDiv);
-		String bodyClass = sourceElement.getAttribute(RichFaces.ATTR_BODY_CLASS);
-		bodyDiv.setAttribute(HTML.ATTR_CLASS,
-						"dr-pnl-b rich-panel-body " + (bodyClass == null ? "" : bodyClass)); //$NON-NLS-1$ //$NON-NLS-2$
+		String bodyClass = "dr-pnl-b rich-panel-body"; //$NON-NLS-1$
+		if (sourceElement.hasAttribute(RichFaces.ATTR_BODY_CLASS)) {
+			bodyClass += " " + sourceElement.getAttribute(RichFaces.ATTR_BODY_CLASS); //$NON-NLS-1$
+		}
+		bodyDiv.setAttribute(HTML.ATTR_CLASS, bodyClass);
 		/*
 		 * If there are some odd HTML elements from facet
 		 * add them to the panel body first.

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -93,12 +93,12 @@
     	 * or supplementary HTML tags from facets 
     	 * then progress bar has more divs than usual.
     	 */
-    	Element initialFacet = SourceDomUtil.getFacetByName(sourceElement, "initial");
+    	Element initialFacet = SourceDomUtil.getFacetByName(sourceElement, "initial"); //$NON-NLS-1$
     	Map<String, List<Node>> initialFacetChildren = VisualDomUtil.findFacetElements(initialFacet, pageContext);
     	boolean initialFacetHtmlChildrenPresent = initialFacetChildren
 				.get(VisualDomUtil.FACET_HTML_TAGS).size() > 0;
 
-		Element completeFacet = SourceDomUtil.getFacetByName(sourceElement, "complete");
+		Element completeFacet = SourceDomUtil.getFacetByName(sourceElement, "complete"); //$NON-NLS-1$
     	Map<String, List<Node>> completeFacetChildren = VisualDomUtil.findFacetElements(completeFacet, pageContext);
     	boolean completeFacetHtmlChildrenPresent = completeFacetChildren
     	.get(VisualDomUtil.FACET_HTML_TAGS).size() > 0;
@@ -203,8 +203,8 @@
     	 * Adding common styles 
     	 */
     	remainDiv.setAttribute(HTML.ATTR_STYLE, style);
-		uploadDiv.setAttribute(HTML.ATTR_STYLE, "width: "
-				+ DEFAULT_UPLOADED_STATUS + "; " + style);
+		uploadDiv.setAttribute(HTML.ATTR_STYLE, "width: " //$NON-NLS-1$
+				+ DEFAULT_UPLOADED_STATUS + "; " + style); //$NON-NLS-1$
 		completeDiv.setAttribute(HTML.ATTR_STYLE, style);
 		vpeTextDiv.setAttribute(HTML.ATTR_STYLE, style);
         

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -79,18 +79,16 @@
 
 		Element sourceElement = (Element) sourceNode;
 
-		String width = sourceElement.getAttribute(HTML.ATTR_WIDTH);		
-		if (width == null) {
-			width = DEFAULT_WIDTH;
-		} else {
-			width = VpeStyleUtil.addPxIfNecessary(width);
+		String width = DEFAULT_WIDTH;	
+		if (sourceElement.hasAttribute(HTML.ATTR_WIDTH)) {
+			String widthAttrVal = sourceElement.getAttribute(HTML.ATTR_WIDTH);
+			width = VpeStyleUtil.addPxIfNecessary(widthAttrVal);
 		}
 		
-		String height = sourceElement.getAttribute(HTML.ATTR_HEIGHT);
-		if (height == null) {
-			height = DEFAULT_HEIGHT;
-		} else {
-			height = VpeStyleUtil.addPxIfNecessary(height);
+		String height = DEFAULT_HEIGHT;
+		if (sourceElement.hasAttribute(HTML.ATTR_HEIGHT)) {
+			String heightAttrVal = sourceElement.getAttribute(HTML.ATTR_HEIGHT);
+			height = VpeStyleUtil.addPxIfNecessary(heightAttrVal);
 		}
 		
 			
@@ -117,11 +115,11 @@
 		div.appendChild(mainTableWrapper);
 
 		ComponentUtil.setCSSLink(pageContext, CSS_STYLE_PATH, COMPONENT_NAME);
-		String tableClass = sourceElement
-				.getAttribute(RichFaces.ATTR_STYLE_CLASS);
-		mainTable.setAttribute(HTML.ATTR_CLASS, CSS_DR_TABLE
-			+ Constants.WHITE_SPACE + CSS_RICH_SDT
-			+ (tableClass == null ? Constants.EMPTY : tableClass));
+		String tableClass = CSS_DR_TABLE + Constants.WHITE_SPACE + CSS_RICH_SDT;
+		if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+			tableClass += Constants.WHITE_SPACE + sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+		}
+		mainTable.setAttribute(HTML.ATTR_CLASS, tableClass);
 
 		// Encode colgroup definition.
 		ArrayList<Element> columns = getColumns(sourceElement);
@@ -142,8 +140,8 @@
 			nsIDOMElement thead = visualDocument
 					.createElement(HTML.TAG_THEAD);
 			mainTable.appendChild(thead);
-			String headerClass = (String) sourceElement
-					.getAttribute(RichFaces.ATTR_HEADER_CLASS);
+			String headerClass = sourceElement.hasAttribute(RichFaces.ATTR_HEADER_CLASS) ? 
+					sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS) : null;
 			if (header != null) {
 			    /*
 			     * JBIDE-3204 #2:No one style or styleClass should be applyed
@@ -178,8 +176,8 @@
 			nsIDOMElement tfoot = visualDocument
 					.createElement(HTML.TAG_TFOOT);
 			mainTable.appendChild(tfoot);
-			String footerClass = (String) sourceElement
-					.getAttribute(RichFaces.ATTR_FOOTER_CLASS);
+			String footerClass = sourceElement.hasAttribute(RichFaces.ATTR_FOOTER_CLASS) ?
+					sourceElement.getAttribute(RichFaces.ATTR_FOOTER_CLASS) : null;
 			if (!columnsFooters.isEmpty()) {
 				nsIDOMElement tr = visualDocument
 						.createElement(HTML.TAG_TR);
@@ -234,25 +232,22 @@
 		// Encode caption
 		Element captionFromFacet = ComponentUtil.getFacet(sourceElement,
 				HTML.TAG_CAPTION);
-		if (captionFromFacet != null) {
-			String captionClass = (String) table.getAttribute(RichFaces.ATTR_CAPTION_CLASS);
-			String captionStyle = (String) table.getAttribute(RichFaces.ATTR_CAPTION_STYLE);
+		if (captionFromFacet != null) {						
 
 			nsIDOMElement caption = visualDocument
 					.createElement(HTML.TAG_CAPTION);
 			table.appendChild(caption);
-			if (captionClass != null && captionClass.length() > 0) {
-				captionClass = "dr-table-caption rich-table-caption " //$NON-NLS-1$
-						+ captionClass;
-			} else {
-				captionClass = "dr-table-caption rich-table-caption"; //$NON-NLS-1$
+			
+			String captionClass = "dr-table-caption rich-table-caption";  //$NON-NLS-1$
+			if (table.hasAttribute(RichFaces.ATTR_CAPTION_CLASS)) {
+				captionClass += Constants.WHITE_SPACE + table.getAttribute(RichFaces.ATTR_CAPTION_CLASS);
+			}			
+			caption.setAttribute(HTML.ATTR_CLASS, captionClass);
+						
+			if (table.hasAttribute(RichFaces.ATTR_CAPTION_STYLE)) {
+				String captionStyle = table.getAttribute(RichFaces.ATTR_CAPTION_STYLE);
+				caption.setAttribute(HTML.ATTR_STYLE, captionStyle);
 			}
-			caption.setAttribute(HTML.ATTR_CLASS,
-					captionClass);
-			if (captionStyle != null && captionStyle.length() > 0) {
-				caption.setAttribute(HTML.ATTR_STYLE,
-						captionStyle);
-			}
 
 			VpeChildrenInfo cap = new VpeChildrenInfo(caption);
 			cap.addSourceChild(captionFromFacet);
@@ -278,7 +273,7 @@
 			String headerClass, String facetName, String element) {
 		for (Element column : headersOrFooters) {
 			String classAttribute = facetName + "Class"; //$NON-NLS-1$
-			String columnHeaderClass = column.getAttribute(classAttribute);
+			String columnHeaderClass = column.hasAttribute(classAttribute) ? column.getAttribute(classAttribute) : null;
 			nsIDOMElement td = visualDocument.createElement(element);
 			parentTr.appendChild(td);
 			String styleClass = ComponentUtil.encodeStyleClass(null, skinCellClass,
@@ -291,9 +286,9 @@
 
 			td.setAttribute(HTML.ATTR_CLASS, styleClass);
 			td.setAttribute("scop", "col"); //$NON-NLS-1$ //$NON-NLS-2$
-			String colspan = column
-					.getAttribute(HTML.ATTR_COLSPAN);
-			if (colspan != null && colspan.length() > 0) {
+			
+			if (column.hasAttribute(HTML.ATTR_COLSPAN)) {
+				String colspan = column.getAttribute(HTML.ATTR_COLSPAN);
 				td.setAttribute(HTML.ATTR_COLSPAN, colspan);
 			}
 			Element facetBody = ComponentUtil.getFacet(column, facetName);

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -17,6 +17,7 @@
 import org.jboss.tools.vpe.editor.context.VpePageContext;
 import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
 import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
 import org.mozilla.interfaces.nsIDOMDocument;
 import org.mozilla.interfaces.nsIDOMElement;
 import org.mozilla.interfaces.nsIDOMNode;
@@ -70,6 +71,7 @@
 	 * @return The information on the created node of the visual tree.
 	 */
 	public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+		
 		ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "richFacesSeparator"); //$NON-NLS-1$
 		Element sourceElement = (Element) sourceNode;
 		/* Create new html element table */
@@ -83,15 +85,20 @@
 		/* Set align for separator */
 		separator.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
 				sourceElement.hasAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR) ? sourceElement.getAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR) : DEFAULT_ALIGN);
-		separator.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
-				"td-parentdiv"); //$NON-NLS-1$
-		String lineClass = sourceElement.getAttribute("styleClass"); //$NON-NLS-1$
+		separator.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "td-parentdiv"); //$NON-NLS-1$
+		
+		String styleClassAttrName = "styleClass"; //$NON-NLS-1$
+		String lineClass = sourceElement.getAttribute(styleClassAttrName);
 		/* Apply class for separator */
-		String lineType = sourceElement.getAttribute(LINE_TYPE_ATTR);
-		String style = sourceElement.getAttribute("style"); //$NON-NLS-1$
+		String styleAttrName = "style"; //$NON-NLS-1$
+		String style = sourceElement.hasAttribute(styleAttrName) ? sourceElement.getAttribute(styleAttrName) : null;
+		String lineType = sourceElement.hasAttribute(LINE_TYPE_ATTR) ? sourceElement.getAttribute(LINE_TYPE_ATTR) : null;
 		if (!sourceElement.hasAttribute(LINE_TYPE_ATTR) || lineType.equalsIgnoreCase(LINE_BEVELED)) {
-			line.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
-					"dr-table-header rich-table-header-continue" + lineClass); //$NON-NLS-1$
+			String className = "dr-table-header rich-table-header-continue"; //$NON-NLS-1$
+			if (sourceElement.hasAttribute(styleClassAttrName)) {
+				className += Constants.WHITE_SPACE + lineClass;
+			}
+			line.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, className);
 			style = setBeveledStyle(width, height, ComponentUtil
 					.getHeaderBackgoundImgStyle() + ";" + style); //$NON-NLS-1$
 		} else {
@@ -113,7 +120,7 @@
 		super.removeAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name);
 		nsIDOMElement element = queryInterface(visualNode, nsIDOMElement.class);
 		nsIDOMElement line = getLineElement(element);
-		String style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+		String style = sourceElement.hasAttribute(HtmlComponentUtil.HTML_STYLE_ATTR) ? sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR) : null;
 		String width = sourceElement.hasAttribute(HtmlComponentUtil.HTML_ATR_WIDTH) ? sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH) : null;
 		String height = sourceElement.hasAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT) ? sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT) : null;
 		String newStyle;
@@ -123,7 +130,7 @@
 		if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_ATR_HEIGHT)
 				|| name.equalsIgnoreCase(LINE_TYPE_ATTR)
 				|| name.equalsIgnoreCase(HtmlComponentUtil.HTML_ATR_WIDTH)) {
-			if (lineType != null && lineType.equalsIgnoreCase(LINE_BEVELED)) {
+			if (LINE_BEVELED.equalsIgnoreCase(lineType)) {
 				newStyle = setBeveledStyle(width, height, ComponentUtil
 						.getHeaderBackgoundImgStyle() + ";" + style); //$NON-NLS-1$
 			} else {
@@ -136,7 +143,7 @@
 		} else if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_ALIGN_ATTR)) {
 			element.removeAttribute(name);
 		} else if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_STYLE_ATTR)) {
-			if (lineType != null && lineType.equalsIgnoreCase(LINE_BEVELED)) {
+			if (LINE_BEVELED.equalsIgnoreCase(lineType)) {
 				newStyle = setBeveledStyle(width, height, ComponentUtil
 						.getHeaderBackgoundImgStyle());
 			} else {
@@ -163,7 +170,7 @@
 				visualNode, data, name, value);
 		nsIDOMElement element = queryInterface(visualNode, nsIDOMElement.class);
 		nsIDOMElement line = getLineElement(element);
-		String style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+		String style = sourceElement.hasAttribute(HtmlComponentUtil.HTML_STYLE_ATTR) ? sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR) : null;
 		String width = sourceElement.hasAttribute(HtmlComponentUtil.HTML_ATR_WIDTH) ? sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH) : null;
 		String height = sourceElement.hasAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT) ? sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT) : null;
 		String lineType = sourceElement.hasAttribute(LINE_TYPE_ATTR) ? sourceElement.getAttribute(LINE_TYPE_ATTR) : LINE_BEVELED;
@@ -172,7 +179,7 @@
 			if (!isNumber(value) && (value.indexOf(PIXEL_PREFIX)) == -1) {
 				return;
 			}
-			if (lineType.equalsIgnoreCase(LINE_BEVELED)) {
+			if (LINE_BEVELED.equalsIgnoreCase(lineType)) {
 				newStyle = setBeveledStyle(width, value, ComponentUtil
 						.getHeaderBackgoundImgStyle() + ";" + style); //$NON-NLS-1$
 			} else {

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToggleControlTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToggleControlTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToggleControlTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -28,6 +28,7 @@
 import org.jboss.tools.vpe.editor.template.VpeCreationData;
 import org.jboss.tools.vpe.editor.template.VpeTemplate;
 import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
+import org.jboss.tools.vpe.editor.util.Constants;
 import org.mozilla.interfaces.nsIDOMDocument;
 import org.mozilla.interfaces.nsIDOMElement;
 import org.mozilla.interfaces.nsIDOMNode;
@@ -47,11 +48,7 @@
 		nsIDOMElement span = visualDocument.createElement("span"); //$NON-NLS-1$
 		storedSwitchSpan = span;
 		
-		VpeCreationData creationData = new VpeCreationData(span);
-
-		String forIds = sourceElement.getAttribute("for"); //$NON-NLS-1$
-		String value = sourceElement.getAttribute("value"); //$NON-NLS-1$
-		String switchToState = sourceElement.getAttribute("switchToState"); //$NON-NLS-1$
+		VpeCreationData creationData = new VpeCreationData(span);		
 		
 		ComponentUtil.correctAttribute(sourceElement, span,
 				"styleClass", //$NON-NLS-1$
@@ -61,14 +58,16 @@
 				"style", //$NON-NLS-1$
 				HtmlComponentUtil.HTML_STYLE_ATTR, "color:blue;text-decoration:underline;", "color:blue;text-decoration:underline;"); //$NON-NLS-1$ //$NON-NLS-2$
 
-		span.setAttribute("vpe-user-toggle-id", (switchToState == null ? "" : switchToState.trim())); //$NON-NLS-1$ //$NON-NLS-2$
+		String switchToStateAttrName = "switchToState"; //$NON-NLS-1$ 
+		String switchToState = sourceElement.hasAttribute(switchToStateAttrName) ? 
+				sourceElement.getAttribute(switchToStateAttrName).trim() : Constants.EMPTY;
+		span.setAttribute("vpe-user-toggle-id", switchToState); //$NON-NLS-1$
 
 		List<Node> children = ComponentUtil.getChildren(sourceElement);
 		VpeChildrenInfo bodyInfo = new VpeChildrenInfo(span);
-		//string shoudn't be null, if then it's crash application
-		if(value==null){
-			value=""; //$NON-NLS-1$
-		}
+		
+		String valueAttrName = "value"; //$NON-NLS-1$
+		String value = sourceElement.hasAttribute(valueAttrName) ? sourceElement.getAttribute(valueAttrName) : Constants.EMPTY;
 		nsIDOMNode valueText = visualDocument.createTextNode(value);
 		span.appendChild(valueText);
 		
@@ -92,8 +91,11 @@
 		super.validate(pageContext, sourceNode, visualDocument, data);
 		if (storedSwitchSpan == null) return;
 		
-		String value = storedSwitchSpan.getAttribute("vpe-user-toggle-id"); //$NON-NLS-1$
-		applyAttributeValueOnChildren("vpe-user-toggle-id", value, ComponentUtil.getChildren(storedSwitchSpan)); //$NON-NLS-1$
+		String vpeToogleAttrName = "vpe-user-toggle-id"; //$NON-NLS-1$
+		if (storedSwitchSpan.hasAttribute(vpeToogleAttrName)) {
+			String value = storedSwitchSpan.getAttribute(vpeToogleAttrName);
+			applyAttributeValueOnChildren("vpe-user-toggle-id", value, ComponentUtil.getChildren(storedSwitchSpan)); //$NON-NLS-1$
+		}
 		applyAttributeValueOnChildren("vpe-user-toggle-lookup-parent", "true", ComponentUtil.getChildren(storedSwitchSpan)); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
@@ -114,9 +116,10 @@
 		
 		Element sourceElement = (Element)(sourceNode instanceof Element ? sourceNode : sourceNode.getParentNode());
 		
-		String forIds = sourceElement.getAttribute("for"); //$NON-NLS-1$
-		if (forIds == null) return;
-		
+		String forAttrName = "for"; //$NON-NLS-1$
+		if (!sourceElement.hasAttribute(forAttrName)) return;
+
+		String forIds = sourceElement.getAttribute(forAttrName);
 		StringTokenizer st = new StringTokenizer(forIds.trim(), ",", false); //$NON-NLS-1$
 		while (st.hasMoreElements()) {
 			String id = st.nextToken().trim();

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTogglePanelTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTogglePanelTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTogglePanelTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -78,7 +78,7 @@
 			
 			if (child instanceof Element && child.getNodeName().endsWith(":facet")) { //$NON-NLS-1$
 				Element facet = (Element)child;				
-				if (facet.hasAttribute("name")) {
+				if (facet.hasAttribute("name")) { //$NON-NLS-1$
 					String name = facet.getAttribute("name"); //$NON-NLS-1$
 					states.put(name, facet);
 				}
@@ -88,9 +88,9 @@
 	}
 	
 	private String getInitialState(Element sourceElement) {
-		String initialState = sourceElement.hasAttribute("initialState") ? sourceElement.getAttribute("initialState") : null; //$NON-NLS-1$
+		String initialState = sourceElement.hasAttribute("initialState") ? sourceElement.getAttribute("initialState") : null; //$NON-NLS-1$ //$NON-NLS-2$
 				
-		if(sourceElement.hasAttribute("stateOrder")) {
+		if(sourceElement.hasAttribute("stateOrder")) { //$NON-NLS-1$
 			String stateOrder = sourceElement.getAttribute("stateOrder"); //$NON-NLS-1$
 			StringTokenizer st = new StringTokenizer(stateOrder.trim(), ",", false); //$NON-NLS-1$
 			String firstState = null;
@@ -119,7 +119,7 @@
 	
 	private String getActiveState(Element sourceElement) {
 		String activeStateStr;
-		if(!sourceElement.hasAttribute("stateOrder"))  return null;
+		if(!sourceElement.hasAttribute("stateOrder"))  return null; //$NON-NLS-1$
 
 		activeStateStr = (String)toggleMap.get(sourceElement);
 
@@ -131,7 +131,7 @@
 	}
 
 	private String getNextState(Element sourceElement, String toggleId) {		
-		if(!sourceElement.hasAttribute("stateOrder"))  return null;
+		if(!sourceElement.hasAttribute("stateOrder"))  return null; //$NON-NLS-1$
 		String stateOrder = sourceElement.getAttribute("stateOrder"); //$NON-NLS-1$
 		String activeState = getActiveState(sourceElement);
 		

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -144,12 +144,12 @@
 		VpeCreationData creationData = null;
 		
 		Element sourceElement = (Element)sourceNode;
-		String itemSeparator = sourceElement.getAttribute(ATTR_ITEMSEPARATOR_NAME);
 		
 		if (!sourceNode.getParentNode().getNodeName().endsWith(":" + RichFacesToolBarTemplate.TAG_NAME)) { //$NON-NLS-1$
 			visualNode = RichFacesToolBarTemplate.createExceptionNode(visualDocument, TOOLBAR_PARENT_WARNING);
 			creationData = new VpeCreationData(visualNode);
 		}  else {
+			String itemSeparator = sourceElement.getAttribute(ATTR_ITEMSEPARATOR_NAME);
 			itemSeparator = RichFacesToolBarTemplate.checkAndUpdateItemSeparatorName(itemSeparator);
 			SourceToolBarGroupItems sourceToolBarGroupItems = new SourceToolBarGroupItems(sourceNode,
 					ATTR_LOCATION_RIGHT_VALUE.equals(sourceElement.getAttribute(ATTR_LOCATION_NAME)),
@@ -171,23 +171,20 @@
 				nsIDOMElement cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
 				if (toolBarGroupItem.isItem()) {
 					
-					Node parentNode = sourceElement.getParentNode();
-					
-					String styleClass = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
-					String style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
-					if (null == styleClass) {
-						styleClass = EMPTY;
-					}
-					if (null == style) {
-						style = EMPTY;
-					}
+					String styleClass = sourceElement.hasAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR) ?
+							sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR) : EMPTY;
+					String style = sourceElement.hasAttribute(HtmlComponentUtil.HTML_STYLE_ATTR) ?
+							sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR) : EMPTY;
+							
+					Node parentNode = sourceElement.getParentNode();							
 					if ((null != parentNode) && (parentNode instanceof Element)) {
-						String contentClass = ((Element)parentNode).getAttribute(RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME);
-						String contentStyle = ((Element)parentNode).getAttribute(RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME);
-						if (null != contentClass) {
+						Element parentElement = (Element)parentNode;
+						if (parentElement.hasAttribute(RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME)) {
+							String contentClass = parentElement.getAttribute(RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME);
 							styleClass += SPACE + contentClass;
 						}
-						if (null != contentStyle) {
+						if (parentElement.hasAttribute(RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME)) {
+							String contentStyle = parentElement.getAttribute(RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME);
 							style += SPACE + contentStyle;
 						}
 					}

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -113,58 +113,59 @@
 	 * in model
 	 */
 
+    Element parentElement = (Element) sourceElement.getParentNode();
 	boolean showLinesValue = getShowLinesAttr(sourceElement);
 	if (NODE_ICON_EXPANDED_ATTR_NAME.equalsIgnoreCase(name)) {
-	    nsIDOMElement expandedIconCell = queryInterface(visualNode
+	    
+		nsIDOMElement expandedIconCell = queryInterface(visualNode
 	    		.getChildNodes().item(0), nsIDOMElement.class);
 	    nsIDOMElement img = queryInterface(expandedIconCell.getChildNodes().item(0),
-			    nsIDOMElement.class);
-	    String parentAttrName = ((Element) sourceElement.getParentNode())
-		    .getAttribute(NODE_ICON_EXPANDED_ATTR_NAME);
-	    if (parentAttrName == null || parentAttrName.length() == 0) {
-		ComponentUtil.setImg(img,
-			showLinesValue == true ? ICON_EXPANDED_WITH_LINES
-				: ICON_EXPANDED_WITHOUT_LINES);
+			    nsIDOMElement.class);	    
+	    
+	    if (parentElement.hasAttribute(NODE_ICON_EXPANDED_ATTR_NAME)) {
+	    	String parentAttrName = parentElement.getAttribute(NODE_ICON_EXPANDED_ATTR_NAME);
+	    	ComponentUtil.setImgFromResources(pageContext, img,
+					parentAttrName, UNDEFINED_ICON);
 	    } else {
-		ComponentUtil.setImgFromResources(pageContext, img,
-			parentAttrName, UNDEFINED_ICON);
+	    	ComponentUtil.setImg(img,
+					showLinesValue == true ? ICON_EXPANDED_WITH_LINES
+						: ICON_EXPANDED_WITHOUT_LINES);
 	    }
-	    img
-		    .setAttribute(ICON_PARAM_NAME,
-			    DEFAULT_ICON_EXPANDED_PARAM_VALUE);
+	    img.setAttribute(ICON_PARAM_NAME, DEFAULT_ICON_EXPANDED_PARAM_VALUE);
 	} else if (NODE_ICON_ATTR_NAME.equalsIgnoreCase(name)
 		&& !isLastElement(sourceElement)) {
-	    nsIDOMElement iconCell = queryInterface(visualNode.getChildNodes().item(1),
+	    
+		nsIDOMElement iconCell = queryInterface(visualNode.getChildNodes().item(1),
 	    		nsIDOMElement.class);
-
 	    nsIDOMElement img = queryInterface(iconCell.getChildNodes().item(0),
 	    		nsIDOMElement.class);
-	    String parentAttrName = ((Element) sourceElement.getParentNode())
-		    .getAttribute(NODE_ICON_ATTR_NAME);
-	    if (parentAttrName == null || parentAttrName.length() == 0) {
-		ComponentUtil.setImg(img,
-			showLinesValue == true ? ICON_NODE_WITH_LINES
-				: ICON_NODE_WITHOUT_LINES);
+	    
+	    if (parentElement.hasAttribute(NODE_ICON_ATTR_NAME)) {
+	    	String parentAttrName = parentElement.getAttribute(NODE_ICON_ATTR_NAME);
+	    	ComponentUtil.setImgFromResources(pageContext, img,
+					parentAttrName, UNDEFINED_ICON);
 	    } else {
-		ComponentUtil.setImgFromResources(pageContext, img,
-			parentAttrName, UNDEFINED_ICON);
+	    	ComponentUtil.setImg(img,
+					showLinesValue == true ? ICON_NODE_WITH_LINES
+						: ICON_NODE_WITHOUT_LINES);
 	    }
 	    img.setAttribute(ICON_PARAM_NAME, DEFAULT_ICON_PARAM_VALUE);
 
 	} else if (NODE_ICON_LEAF_ATTR_NAME.equalsIgnoreCase(name)
 		&& isLastElement(sourceElement)) {
+		
 	    nsIDOMElement iconCell = queryInterface(visualNode.getChildNodes().item(1),
 	    		nsIDOMElement.class);
 	    nsIDOMElement img = queryInterface(iconCell.getChildNodes().item(0), nsIDOMElement.class);
-	    String parentAttrName = ((Element) sourceElement.getParentNode())
-		    .getAttribute(NODE_ICON_LEAF_ATTR_NAME);
-	    if (parentAttrName == null || parentAttrName.length() == 0) {
-		ComponentUtil.setImg(img,
-			showLinesValue == true ? ICON_LEAF_WITH_LINES
-				: ICON_LEAF_WITHOUT_LINES);
+	    
+	    if (parentElement.hasAttribute(NODE_ICON_LEAF_ATTR_NAME)) {
+	    	String parentAttrName = parentElement.getAttribute(NODE_ICON_LEAF_ATTR_NAME);
+	    	ComponentUtil.setImgFromResources(pageContext, img,
+					parentAttrName, UNDEFINED_ICON);
 	    } else {
-		ComponentUtil.setImgFromResources(pageContext, img,
-			parentAttrName, UNDEFINED_ICON);
+	    	ComponentUtil.setImg(img,
+					showLinesValue == true ? ICON_LEAF_WITH_LINES
+						: ICON_LEAF_WITHOUT_LINES);
 	    }
 	    img.setAttribute(ICON_PARAM_NAME, NODE_ICON_LEAF_ATTR_NAME);
 	}

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -68,17 +68,15 @@
 	nsIDOMElement visualElement = visualDocument
 		.createElement(HTML.TAG_DIV);
 	Element sourceElement = (Element) sourceNode;
-	String style = sourceElement
-		.getAttribute(HTML.ATTR_STYLE);
-	if (style != null) {
-	    visualElement
-		    .setAttribute(HTML.ATTR_STYLE, style);
+	
+	if (sourceElement.hasAttribute(HTML.ATTR_STYLE)) {
+		String style = sourceElement.getAttribute(HTML.ATTR_STYLE);
+	    visualElement.setAttribute(HTML.ATTR_STYLE, style);
 	}
-	String styleClass = sourceElement
-		.getAttribute(HTML.ATTR_CLASS);
-	if (styleClass != null) {
-	    visualElement.setAttribute(HTML.ATTR_CLASS,
-		    styleClass);
+	
+	if (sourceElement.hasAttribute(HTML.ATTR_CLASS)) {
+		String styleClass = sourceElement.getAttribute(HTML.ATTR_CLASS);
+	    visualElement.setAttribute(HTML.ATTR_CLASS, styleClass);
 	}
 	VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
 	vpeCreationData.addChildrenInfo(new VpeChildrenInfo(null));
@@ -97,20 +95,20 @@
      */
     private void setStylesAttributesToTree(nsIDOMElement treeTable,
 	    Element sourceNode) {
-	String styleAttr = sourceNode
-		.getAttribute(HTML.ATTR_STYLE);
-	if (styleAttr != null && styleAttr.length() != 0) {
-	    setAttributeToTree(treeTable, HTML.ATTR_STYLE,
-		    removeFromStyleWithAndHeight(styleAttr));
-	    treeTable
-		    .setAttribute(HTML.ATTR_STYLE, styleAttr);
-	}
-	String styleClassAttr = sourceNode
-		.getAttribute(TREE_STYLE_CLASS_ATR_NAME);
-	if ((styleClassAttr != null) && (styleClassAttr.length() != 0)) {
-	    setAttributeToTree(treeTable, HTML.ATTR_CLASS,
-		    styleClassAttr);
-	}
+	
+		if (sourceNode.hasAttribute(HTML.ATTR_STYLE)) {
+			String styleAttr = sourceNode.getAttribute(HTML.ATTR_STYLE);
+		    setAttributeToTree(treeTable, HTML.ATTR_STYLE,
+			    removeFromStyleWithAndHeight(styleAttr));
+		    treeTable
+			    .setAttribute(HTML.ATTR_STYLE, styleAttr);
+		}
+		
+		if (sourceNode.hasAttribute(TREE_STYLE_CLASS_ATR_NAME)) {
+			String styleClassAttr = sourceNode.getAttribute(TREE_STYLE_CLASS_ATR_NAME);
+		    setAttributeToTree(treeTable, HTML.ATTR_CLASS,
+			    styleClassAttr);
+		}
     }
 
     /**
@@ -188,10 +186,9 @@
 	try {
 	    nsIDOMNodeList list = node.getChildNodes();
 	    nsIDOMElement element = queryInterface(node, nsIDOMElement.class);
-	    String id = element
-		    .getAttribute(RichFacesTreeNodesAdaptorTemplate.ID_ATTR_NAME);
-	    if (id == null)
-		id = Constants.EMPTY;
+	    String id = element.hasAttribute(RichFacesTreeNodesAdaptorTemplate.ID_ATTR_NAME) ? 
+	    		element.getAttribute(RichFacesTreeNodesAdaptorTemplate.ID_ATTR_NAME) : 
+	    			Constants.EMPTY;
 	    if (node.getNodeName().equalsIgnoreCase(
 		    HTML.TAG_DIV)
 		    && list.getLength() == 2

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java	2010-07-06 08:47:27 UTC (rev 23245)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java	2010-07-06 11:03:16 UTC (rev 23246)
@@ -44,13 +44,12 @@
 	public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
 			nsIDOMDocument visualDocument) {
 
+		Element sourceElement = (Element) sourceNode;
 		nsIDOMElement img = visualDocument
 				.createElement(HtmlComponentUtil.HTML_TAG_IMG);
-
-		String mapStyleValue = ((Element) sourceNode)
-				.getAttribute(MAP_STYLE_ATTRIBUTE_NAME);
-
-		if (mapStyleValue != null && searchInMapStyleValues(mapStyleValue)) {
+		
+		if (sourceElement.hasAttribute(MAP_STYLE_ATTRIBUTE_NAME)) {
+			String mapStyleValue = sourceElement.getAttribute(MAP_STYLE_ATTRIBUTE_NAME);
 			if (mapStyleValue.equalsIgnoreCase(MAP_STYLE_VALUES[0]))
 				ComponentUtil.setImg(img, EARTH_ROAD);
 			else if (mapStyleValue.equalsIgnoreCase(MAP_STYLE_VALUES[1]))
@@ -62,9 +61,9 @@
 
 		copyStyleAttribute(img, sourceNode);
 
-		if (((Element) sourceNode).getAttribute(STYLE_CLASS_ATTR_NAME) != null)
+		if (sourceElement.hasAttribute(STYLE_CLASS_ATTR_NAME))
 			img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
-					((Element) sourceNode).getAttribute(STYLE_CLASS_ATTR_NAME));
+					sourceElement.getAttribute(STYLE_CLASS_ATTR_NAME));
 
 		return new VpeCreationData(img);
 	}



More information about the jbosstools-commits mailing list