Index: RichFacesSeparatorTemplate.java =================================================================== --- RichFacesSeparatorTemplate.java (revision 23143) +++ RichFacesSeparatorTemplate.java (working copy) @@ -78,31 +78,24 @@ nsIDOMElement line = visualDocument .createElement(HtmlComponentUtil.HTML_TAG_DIV); VpeCreationData creationData = new VpeCreationData(separator); - String width = sourceElement - .getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH); - String height = sourceElement - .getAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT); + 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; /* Set align for separator */ - String align = sourceElement - .getAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR); separator.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, - (align == null ? DEFAULT_ALIGN : align)); + 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$ /* Apply class for separator */ String lineType = sourceElement.getAttribute(LINE_TYPE_ATTR); String style = sourceElement.getAttribute("style"); //$NON-NLS-1$ - if (lineType == null || lineType.equalsIgnoreCase(LINE_BEVELED)) { + if (!sourceElement.hasAttribute(LINE_TYPE_ATTR) || lineType.equalsIgnoreCase(LINE_BEVELED)) { line.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, - "dr-table-header rich-table-header-continue" //$NON-NLS-1$ - + (lineClass == null ? "" : lineClass)); //$NON-NLS-1$ + "dr-table-header rich-table-header-continue" + lineClass); //$NON-NLS-1$ style = setBeveledStyle(width, height, ComponentUtil - .getHeaderBackgoundImgStyle() - + ";" + (style == null ? "" : style)); //$NON-NLS-1$ //$NON-NLS-2$ + .getHeaderBackgoundImgStyle() + ";" + style); //$NON-NLS-1$ } else { - line.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, - (lineClass == null ? "" : lineClass)); //$NON-NLS-1$ + line.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, lineClass); style = setStyle(lineType, width, height, style); line.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "separator-color"); //$NON-NLS-1$ @@ -121,21 +114,18 @@ nsIDOMElement element = queryInterface(visualNode, nsIDOMElement.class); nsIDOMElement line = getLineElement(element); String style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR); - String width = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH); + 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; - String height = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT); - String lineType = sourceElement.getAttribute(LINE_TYPE_ATTR); - if (lineType == null) { - lineType = LINE_BEVELED; - } + String lineType = sourceElement.hasAttribute(LINE_TYPE_ATTR) ? sourceElement.getAttribute(LINE_TYPE_ATTR) : LINE_BEVELED; + 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)) { newStyle = setBeveledStyle(width, height, ComponentUtil - .getHeaderBackgoundImgStyle() - + ";" + (style == null ? "" : style)); //$NON-NLS-1$ //$NON-NLS-2$ + .getHeaderBackgoundImgStyle() + ";" + style); //$NON-NLS-1$ } else { newStyle = setStyle(lineType, (width == null ? DEFAULT_WIDTH : addPrefixSize(width)), @@ -173,24 +163,18 @@ visualNode, data, name, value); nsIDOMElement element = queryInterface(visualNode, nsIDOMElement.class); nsIDOMElement line = getLineElement(element); - String style = sourceElement - .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR); - String width = sourceElement - .getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH); - String height = sourceElement - .getAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT); - String lineType = sourceElement.getAttribute(LINE_TYPE_ATTR); - if (lineType == null) { - lineType = LINE_BEVELED; - } + String style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR); + 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; + if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_ATR_HEIGHT)) { if (!isNumber(value) && (value.indexOf(PIXEL_PREFIX)) == -1) { return; } if (lineType.equalsIgnoreCase(LINE_BEVELED)) { newStyle = setBeveledStyle(width, value, ComponentUtil - .getHeaderBackgoundImgStyle() - + ";" + (style == null ? "" : style)); //$NON-NLS-1$ //$NON-NLS-2$ + .getHeaderBackgoundImgStyle() + ";" + style); //$NON-NLS-1$ } else { newStyle = setStyle( lineType, @@ -205,8 +189,7 @@ } if (lineType.equalsIgnoreCase(LINE_BEVELED)) { newStyle = setBeveledStyle(value, height, ComponentUtil - .getHeaderBackgoundImgStyle() - + ";" + (style == null ? "" : style)); //$NON-NLS-1$ //$NON-NLS-2$ + .getHeaderBackgoundImgStyle() + ";" + style); //$NON-NLS-1$ } else { newStyle = setStyle(lineType, (value == null ? DEFAULT_WIDTH : addPrefixSize(value)), @@ -220,8 +203,7 @@ } if (value.equalsIgnoreCase(LINE_BEVELED)) { newStyle = setBeveledStyle(width, height, ComponentUtil - .getHeaderBackgoundImgStyle() - + ";" + (style == null ? "" : style)); //$NON-NLS-1$ //$NON-NLS-2$ + .getHeaderBackgoundImgStyle() + ";" + style); //$NON-NLS-1$ } else { newStyle = setStyle(value, (width == null ? DEFAULT_WIDTH : addPrefixSize(width)), Index: RichFacesTabPanelTemplate.java =================================================================== --- RichFacesTabPanelTemplate.java (revision 23143) +++ RichFacesTabPanelTemplate.java (working copy) @@ -121,8 +121,7 @@ img.setAttribute(HTML.ATTR_WIDTH, TWO); img.setAttribute(HTML.ATTR_HEIGHT, ONE); img.setAttribute(HTML.ATTR_BORDER, ZERO); - - String headerSpacing = sourceElement.getAttribute(HEADER_SPACING); + List children = ComponentUtil.getChildren(sourceElement); int activeId = getActiveId(sourceElement, children); int i = 0; @@ -136,6 +135,7 @@ } if(child.getNodeName().endsWith(TAB)) { + String headerSpacing = sourceElement.hasAttribute(HEADER_SPACING) ? sourceElement.getAttribute(HEADER_SPACING) : ONE; /* * Adds spacer before first tab */ @@ -218,9 +218,6 @@ ComponentUtil.setImg(spaceImg, SPACER_FILE_PATH); spaceImg.setAttribute(HTML.ATTR_HEIGHT, ONE); spaceImg.setAttribute(HTML.ATTR_BORDER, ZERO); - if(headerSpacing==null) { - headerSpacing = ONE; - } spaceImg.setAttribute(HTML.ATTR_STYLE, "width: " + headerSpacing + Constants.PIXEL); //$NON-NLS-1$ } @@ -233,7 +230,9 @@ } if (activeId == -1) { - activeId = getTabId(children, sourceElement.getAttribute(SELECTED_TAB)); + if (sourceElement.hasAttribute(SELECTED_TAB)) { + activeId = getTabId(children, sourceElement.getAttribute(SELECTED_TAB)); + } } if (activeId == -1) @@ -258,7 +257,6 @@ } private int getTabId(List children, String tabName) { - if (tabName == null) return -1; int count = 0; for (Node child : children) { if (child.getNodeName().endsWith(TAB)) { @@ -276,19 +274,17 @@ } private String getStyle(Element sourceElement) { - - String widthAttrValue = sourceElement.getAttribute(HTML.ATTR_WIDTH); - String heightAttrValue = sourceElement.getAttribute(HTML.ATTR_HEIGHT); + String styleAttrValue = sourceElement.getAttribute(HTML.ATTR_STYLE); - String style = styleAttrValue != null ? styleAttrValue : EMPTY; + String style = sourceElement.hasAttribute(HTML.ATTR_STYLE) ? styleAttrValue : EMPTY; if (!ComponentUtil.parameterPresent(styleAttrValue, HTML.ATTR_WIDTH)) { - String width = (widthAttrValue != null && widthAttrValue.length() > 0) ? widthAttrValue : "100%"; //$NON-NLS-1$ + String width = sourceElement.hasAttribute(HTML.ATTR_WIDTH) ? sourceElement.getAttribute(HTML.ATTR_WIDTH) : "100%"; //$NON-NLS-1$ style = ComponentUtil.addParameter(style, "width:" + width); //$NON-NLS-1$ } if (!ComponentUtil.parameterPresent(styleAttrValue, HTML.ATTR_HEIGHT)) { - String height = (heightAttrValue != null && heightAttrValue.length() > 0) ? heightAttrValue : EMPTY; + String height = sourceElement.hasAttribute(HTML.ATTR_HEIGHT) ? sourceElement.getAttribute(HTML.ATTR_HEIGHT) : EMPTY; if (height.length() > 0) { style =ComponentUtil.addParameter(style, "height:" + height); //$NON-NLS-1$ } @@ -314,11 +310,7 @@ } private String getHeaderAlignment(Element sourceElement) { - String headerAlignment = sourceElement.getAttribute(HEADER_ALINGMENT); - if(headerAlignment==null) { - headerAlignment = HTML.VALUE_ALIGN_LEFT; - } - return headerAlignment; + return sourceElement.hasAttribute(HEADER_ALINGMENT) ? sourceElement.getAttribute(HEADER_ALINGMENT) : HTML.VALUE_ALIGN_LEFT; } public void toggle(VpeVisualDomBuilder builder, Node sourceNode, String toggleId) {