Author: dmaliarevich
Date: 2008-12-19 09:05:09 -0500 (Fri, 19 Dec 2008)
New Revision: 12713
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/RichFacesDropDownMenuTemplate.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/RichFacesMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.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/RichFacesPanelMenuItemTemplate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-883, code adjustment. attrPresent method was
replaced with util's method.
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 2008-12-19
14:02:16 UTC (rev 12712)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2008-12-19
14:05:09 UTC (rev 12713)
@@ -80,7 +80,7 @@
if(hasColumnWithHeader) {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
thead.appendChild(tr);
- String styleClass = encodeStyleClass(null, "dr-table-subheader
rich-table-subheader", null, headerClass); //$NON-NLS-1$
+ String styleClass = ComponentUtil.encodeStyleClass(null, "dr-table-subheader
rich-table-subheader", null, headerClass); //$NON-NLS-1$
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
@@ -100,7 +100,7 @@
if(hasColumnWithFooter) {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
tfoot.appendChild(tr);
- String styleClass = encodeStyleClass(null, "dr-table-subfooter
rich-table-subfooter", null, footerClass); //$NON-NLS-1$
+ String styleClass = ComponentUtil.encodeStyleClass(null, "dr-table-subfooter
rich-table-subfooter", null, footerClass); //$NON-NLS-1$
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
@@ -158,7 +158,7 @@
String columnHeaderClass = column.getAttribute(classAttribute);
nsIDOMElement td = visualDocument.createElement(element);
parentTr.appendChild(td);
- String styleClass = encodeStyleClass(null, skinCellClass, headerClass,
columnHeaderClass);
+ String styleClass = ComponentUtil.encodeStyleClass(null, skinCellClass, headerClass,
columnHeaderClass);
if (!RichFacesColumnTemplate.isVisible(column)) {
VisualDomUtil.setSubAttribute(td, HTML.ATTR_STYLE,
HTML.STYLE_PARAMETER_DISPLAY, HTML.STYLE_VALUE_NONE);
@@ -200,7 +200,7 @@
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
parentTheadOrTfood.appendChild(tr);
- String styleClass = encodeStyleClass(null, skinFirstRowClass, facetBodyClass, null);
+ String styleClass = ComponentUtil.encodeStyleClass(null, skinFirstRowClass,
facetBodyClass, null);
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
@@ -210,7 +210,7 @@
nsIDOMElement td = visualDocument.createElement(element);
tr.appendChild(td);
- styleClass = encodeStyleClass(null, skinCellClass, facetBodyClass, null);
+ styleClass = ComponentUtil.encodeStyleClass(null, skinCellClass, facetBodyClass,
null);
if(styleClass!=null) {
td.setAttribute(HTML.ATTR_CLASS, styleClass);
}
@@ -257,27 +257,6 @@
return false;
}
- public static String encodeStyleClass(Object parentPredefined, Object predefined, Object
parent, Object custom) {
- StringBuffer styleClass = new StringBuffer();
- // Construct predefined classes
- if (null != parentPredefined) {
- styleClass.append(parentPredefined).append(Constants.WHITE_SPACE);
- } else if (null != predefined) {
- styleClass.append(predefined).append(Constants.WHITE_SPACE);
- }
- // Append class from parent component.
- if (null != parent) {
- styleClass.append(parent).append(Constants.WHITE_SPACE);
- }
- if (null != custom) {
- styleClass.append(custom);
- }
- if (styleClass.length() > 0) {
- return styleClass.toString();
- }
- return null;
- }
-
protected int getColumnsCount(Element sourceElement, ArrayList<Element> columns)
{
int count = 0;
// check for exact value in component
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-12-19
14:02:16 UTC (rev 12712)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-12-19
14:05:09 UTC (rev 12713)
@@ -167,7 +167,7 @@
+ CSS_RICH_DDMENU_LABEL_UNSELECT;
listBorderDivClass += SPACE + CSS_RICH_MENU_LIST_BORDER;
- if (attrPresents(ddm_styleClass)) {
+ if (ComponentUtil.isNotBlank(ddm_styleClass)) {
labelDivClass += SPACE + ddm_styleClass;
listBorderDivClass += SPACE + ddm_styleClass;
}
@@ -190,7 +190,7 @@
cssListDivStyle += SPACE + CSS_RICH_DDEMENU_LIST_DIV_STYLE;
cssListBorderDivStyle += SPACE + CSS_RICH_DDEMENU_BORDER_DIV_STYLE;
- if (attrPresents(ddm_style)) {
+ if (ComponentUtil.isNotBlank(ddm_style)) {
cssLabelDivStyle += SPACE + ddm_style;
}
@@ -273,17 +273,6 @@
ddm_styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
}
- /**
- * Checks is attribute have some value.
- *
- * @param attr the attribute
- *
- * @return true, if successful
- */
- private static boolean attrPresents(String attr) {
- return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
- }
-
@Override
public boolean isRecreateAtAttrChange(VpePageContext pageContext,
Element sourceElement, nsIDOMDocument visualDocument,
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 2008-12-19
14:02:16 UTC (rev 12712)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java 2008-12-19
14:05:09 UTC (rev 12713)
@@ -141,7 +141,7 @@
nsIDOMElement filterTR = visualDocument.createElement(HTML.TAG_TR);
thead.appendChild(tr);
thead.appendChild(filterTR);
- String styleClass = RichFacesDataTableTemplate.encodeStyleClass(null,
+ String styleClass = ComponentUtil.encodeStyleClass(null,
DR_TABLE_SUBHEADER_RICH_TABLE_SUBHEADER, null, headerClass);
if (styleClass != null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
@@ -157,7 +157,7 @@
String footerClass = (String) sourceElement.getAttribute(FOOTER_CLASS);
nsIDOMElement tfootTR = visualDocument.createElement(HTML.TAG_TR);
tfoot.appendChild(tfootTR);
- String styleFooterClass = RichFacesDataTableTemplate.encodeStyleClass(
+ String styleFooterClass = ComponentUtil.encodeStyleClass(
null, DR_TABLE_SUBFOOTER_RICH_TABLE_SUBFOOTER, null,
footerClass);
if (styleFooterClass != null) {
@@ -294,7 +294,7 @@
String columnHeaderClass = column.getAttribute(classAttribute);
nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
parentTr.appendChild(td);
- styleClass = RichFacesDataTableTemplate.encodeStyleClass(null,
+ styleClass = ComponentUtil.encodeStyleClass(null,
skinCellClass, footerClass, columnHeaderClass);
td.setAttribute(HTML.ATTR_CLASS, styleClass);
td.setAttribute(SCOP, COL);
@@ -353,7 +353,7 @@
td.appendChild(span);
parentTr.appendChild(td);
- styleClass = RichFacesDataTableTemplate.encodeStyleClass(null,
+ styleClass = ComponentUtil.encodeStyleClass(null,
skinCellClass, headerClass, columnHeaderClass);
td.setAttribute(HTML.ATTR_CLASS, styleClass);
td.setAttribute(SCOP, COL);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-12-19
14:02:16 UTC (rev 12712)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-12-19
14:05:09 UTC (rev 12713)
@@ -184,14 +184,14 @@
labelSpanClass += SPACE + CSS_RICH_MENU_ITEM_LABEL + SPACE +
CSS_RICH_MENU_GROUP_LABEL;
folderDivClass += SPACE + CSS_RICH_MENU_ITEM_FOLDER + SPACE +
CSS_RICH_MENU_GROUP_FOLDER;
- if (attrPresents(mg_styleClass)) {
+ if (ComponentUtil.isNotBlank(mg_styleClass)) {
topDivClass += SPACE + mg_styleClass;
}
- if (attrPresents(mg_iconClass)) {
+ if (ComponentUtil.isNotBlank(mg_iconClass)) {
imgSpanClass += SPACE + mg_iconClass;
folderDivClass += SPACE + mg_iconClass;
}
- if (attrPresents(mg_labelClass)) {
+ if (ComponentUtil.isNotBlank(mg_labelClass)) {
labelSpanClass += SPACE + mg_labelClass;
}
@@ -210,7 +210,7 @@
*/
String topDivStyle = EMPTY;
- if (attrPresents(mg_style)) {
+ if (ComponentUtil.isNotBlank(mg_style)) {
topDivStyle += SPACE + mg_style;
}
@@ -239,7 +239,7 @@
childInfo.addSourceChild(iconFacet);
creationData.addChildrenInfo(childInfo);
} else {
- if (attrPresents(mg_icon)) {
+ if (ComponentUtil.isNotBlank(mg_icon)) {
/*
* Add path to specified image
*/
@@ -261,7 +261,7 @@
/*
* Add group folder icon
*/
- if (attrPresents(mg_iconFolder)) {
+ if (ComponentUtil.isNotBlank(mg_iconFolder)) {
/*
* Add path to specified image
*/
@@ -329,16 +329,6 @@
mg_style = sourceElement.getAttribute(HTML.ATTR_STYLE);
mg_styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
}
- /**
- * Checks is attribute have some value.
- *
- * @param attr the attribute
- *
- * @return true, if successful
- */
- private static boolean attrPresents(String attr) {
- return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
- }
@Override
public boolean isRecreateAtAttrChange(VpePageContext pageContext,
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-12-19
14:02:16 UTC (rev 12712)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-12-19
14:05:09 UTC (rev 12713)
@@ -18,6 +18,7 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -38,8 +39,6 @@
private static final String SPACER_IMG_PATH = "menuItem/spacer.gif";
//$NON-NLS-1$
private static final String ICON_FACET_NAME = "icon"; //$NON-NLS-1$
private static final String ICON_DISABLED_FACET_NAME = "iconDisabled";
//$NON-NLS-1$
- private static final String EMPTY = ""; //$NON-NLS-1$
- private static final String SPACE = " "; //$NON-NLS-1$
/*
* Constants for drop down mechanism.
@@ -124,7 +123,7 @@
itemIconImgSpan = visualDocument.createElement(HTML.TAG_SPAN);
itemIconImg = visualDocument.createElement(HTML.TAG_IMG);
itemLabelSpan = visualDocument.createElement(HTML.TAG_SPAN);
- itemLabelText = visualDocument.createTextNode(EMPTY);
+ itemLabelText = visualDocument.createTextNode(Constants.EMPTY);
creationData = new VpeCreationData(itemMainLI);
/*
@@ -138,27 +137,27 @@
/*
* Setting attributes for the drop-down mechanism
*/
- itemMainLI.setAttribute(MENU_CHILD_ID, EMPTY);
+ itemMainLI.setAttribute(MENU_CHILD_ID, Constants.EMPTY);
/*
* Setting css classes
*/
- String topDivClass = EMPTY;
- String iconImgSpanClass = EMPTY;
- String labelSpanClass = EMPTY;
+ String topDivClass = Constants.EMPTY;
+ String iconImgSpanClass = Constants.EMPTY;
+ String labelSpanClass = Constants.EMPTY;
- topDivClass += SPACE + CSS_RICH_MENU_ITEM;
- iconImgSpanClass += SPACE + CSS_RICH_MENU_ITEM_ICON;
- labelSpanClass += SPACE + CSS_RICH_MENU_ITEM_LABEL;
+ topDivClass += Constants.WHITE_SPACE+ CSS_RICH_MENU_ITEM;
+ iconImgSpanClass += Constants.WHITE_SPACE + CSS_RICH_MENU_ITEM_ICON;
+ labelSpanClass += Constants.WHITE_SPACE + CSS_RICH_MENU_ITEM_LABEL;
- if (attrPresents(mi_styleClass)) {
- topDivClass += SPACE + mi_styleClass;
+ if (ComponentUtil.isNotBlank(mi_styleClass)) {
+ topDivClass += Constants.WHITE_SPACE + mi_styleClass;
}
- if (attrPresents(mi_iconClass)) {
- iconImgSpanClass += SPACE + mi_iconClass;
+ if (ComponentUtil.isNotBlank(mi_iconClass)) {
+ iconImgSpanClass += Constants.WHITE_SPACE + mi_iconClass;
}
- if (attrPresents(mi_labelClass)) {
- labelSpanClass += SPACE + mi_labelClass;
+ if (ComponentUtil.isNotBlank(mi_labelClass)) {
+ labelSpanClass += Constants.WHITE_SPACE + mi_labelClass;
}
// itemTopDiv.setAttribute(HTML.ATTR_CLASS, topDivClass);
@@ -171,10 +170,10 @@
/*
* Setting css styles
*/
- String topDivStyle = EMPTY;
+ String topDivStyle = Constants.EMPTY;
- if (attrPresents(mi_style)) {
- topDivStyle += SPACE + mi_style;
+ if (ComponentUtil.isNotBlank(mi_style)) {
+ topDivStyle += Constants.WHITE_SPACE + mi_style;
}
// itemTopDiv.setAttribute(HTML.ATTR_STYLE, topDivStyle);
@@ -191,7 +190,7 @@
creationData.addChildrenInfo(childInfo);
} else {
String iconPath = sourceElement.getAttribute(ICON);
- if (attrPresents(iconPath)) {
+ if (ComponentUtil.isNotBlank(iconPath)) {
/*
* Add path to specified image
*/
@@ -215,7 +214,7 @@
Attr valueAttr = sourceElement.getAttributeNode(HTML.ATTR_VALUE);
String labelValue = (valueAttr != null && valueAttr.getValue() != null)
? valueAttr.getValue()
- : EMPTY;
+ : Constants.EMPTY;
itemLabelText.setNodeValue(labelValue);
/*
@@ -255,17 +254,6 @@
mi_styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
}
- /**
- * Checks is attribute have some value.
- *
- * @param attr the attribute
- *
- * @return true, if successful
- */
- private static boolean attrPresents(String attr) {
- return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
- }
-
@Override
public boolean isRecreateAtAttrChange(VpePageContext pageContext,
Element sourceElement, nsIDOMDocument visualDocument,
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 2008-12-19
14:02:16 UTC (rev 12712)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java 2008-12-19
14:05:09 UTC (rev 12713)
@@ -316,8 +316,8 @@
labelAttr);
}
- if (attrPresents(labelValue)) {
- if (attrPresents(bundleValue)) {
+ if (ComponentUtil.isNotBlank(labelValue)) {
+ if (ComponentUtil.isNotBlank(bundleValue)) {
if (!labelValue.equals(bundleValue)) {
resultValue = bundleValue;
} else {
@@ -327,7 +327,7 @@
resultValue = labelValue;
}
} else {
- if (attrPresents(bundleValue)) {
+ if (ComponentUtil.isNotBlank(bundleValue)) {
resultValue = bundleValue;
} else {
resultValue = EMPTY;
@@ -347,7 +347,7 @@
*/
nsIDOMElement iconCell = column1;
nsIDOMElement emptyCell = column3;
- if (attrPresents(pm_iconGroupPosition)) {
+ if (ComponentUtil.isNotBlank(pm_iconGroupPosition)) {
if (RIGHT.equalsIgnoreCase(pm_iconGroupPosition)) {
/*
* Set icon image on the right
@@ -356,7 +356,7 @@
emptyCell = column1;
}
}
- if (childOfPanelMenu && attrPresents(pm_iconGroupTopPosition)) {
+ if (childOfPanelMenu && ComponentUtil.isNotBlank(pm_iconGroupTopPosition)) {
if (RIGHT.equalsIgnoreCase(pm_iconGroupTopPosition)) {
/*
* Set icon image on the right
@@ -392,10 +392,10 @@
tableClass = SPACE + CSS_DR_TOP_GROUP + SPACE + CSS_GROUP;
tableClass += SPACE + CSS_DISABLED_ELEMENT;
divClass += SPACE + CSS_DR_TOP_GROUP_DIV;
- if (attrPresents(pm_disabledGroupClass)) {
+ if (ComponentUtil.isNotBlank(pm_disabledGroupClass)) {
tableClass += SPACE + pm_disabledGroupClass;
}
- if (attrPresents(pm_topGroupStyle)) {
+ if (ComponentUtil.isNotBlank(pm_topGroupStyle)) {
tableStyle += SPACE + pm_topGroupStyle;
}
}
@@ -406,18 +406,18 @@
if (!(TRUE.equalsIgnoreCase(pm_disabled))) {
tableClass += SPACE + CSS_DISABLED_ELEMENT;
- if (attrPresents(pm_disabledGroupClass)){
+ if (ComponentUtil.isNotBlank(pm_disabledGroupClass)){
tableClass += SPACE + pm_disabledGroupClass;
}
}
- if (attrPresents(pmg_disabledClass)) {
+ if (ComponentUtil.isNotBlank(pmg_disabledClass)) {
tableClass += SPACE + pmg_disabledClass;
}
- if (attrPresents(pm_disabledGroupStyle)) {
+ if (ComponentUtil.isNotBlank(pm_disabledGroupStyle)) {
tableStyle += SPACE + pm_disabledGroupStyle;
}
- if (attrPresents(pmg_disabledStyle)) {
+ if (ComponentUtil.isNotBlank(pmg_disabledStyle)) {
tableStyle += SPACE + pmg_disabledStyle;
}
}
@@ -429,16 +429,16 @@
labelCellClass += SPACE + CSS_GROUP_LABEL;
emptyCellClass += SPACE + CSS_GROUP_ICON;
divClass += SPACE + CSS_DR_GROUP_DIV;
- if (attrPresents(pm_groupClass)) {
+ if (ComponentUtil.isNotBlank(pm_groupClass)) {
tableClass += SPACE + pm_groupClass;
}
- if (attrPresents(pm_groupStyle)) {
+ if (ComponentUtil.isNotBlank(pm_groupStyle)) {
tableStyle += SPACE + pm_groupStyle;
}
- if (attrPresents(pmg_iconClass)) {
+ if (ComponentUtil.isNotBlank(pmg_iconClass)) {
iconCellClass += SPACE + pmg_iconClass;
}
- if (attrPresents(pmg_iconStyle)) {
+ if (ComponentUtil.isNotBlank(pmg_iconStyle)) {
iconCellStyle += SPACE + pmg_iconStyle;
}
@@ -448,28 +448,28 @@
labelCellClass = SPACE + CSS_TOP_GROUP_LABEL;
emptyCellClass = SPACE + CSS_TOP_GROUP_ICON;
divClass += SPACE + CSS_DR_TOP_GROUP_DIV;
- if (attrPresents(pm_topGroupClass)) {
+ if (ComponentUtil.isNotBlank(pm_topGroupClass)) {
tableClass += SPACE + pm_topGroupClass;
}
- if (attrPresents(pm_topGroupStyle)) {
+ if (ComponentUtil.isNotBlank(pm_topGroupStyle)) {
tableStyle += pm_topGroupStyle;
}
- if (attrPresents(pmg_iconClass)) {
+ if (ComponentUtil.isNotBlank(pmg_iconClass)) {
iconCellClass += SPACE + pmg_iconClass;
}
- if (attrPresents(pmg_iconStyle)) {
+ if (ComponentUtil.isNotBlank(pmg_iconStyle)) {
iconCellStyle += SPACE + pmg_iconStyle;
}
}
}
- if (attrPresents(pm_styleClass)) {
+ if (ComponentUtil.isNotBlank(pm_styleClass)) {
tableClass += SPACE + pm_styleClass;
}
- if (attrPresents(pmg_styleClass)) {
+ if (ComponentUtil.isNotBlank(pmg_styleClass)) {
tableClass += SPACE + pmg_styleClass;
}
- if (attrPresents(pmg_style)) {
+ if (ComponentUtil.isNotBlank(pmg_style)) {
tableStyle += SPACE + pmg_style;
}
@@ -551,7 +551,7 @@
}
if (TRUE.equalsIgnoreCase(pmg_disabled)) {
- if (attrPresents(pathIconDisabled)) {
+ if (ComponentUtil.isNotBlank(pathIconDisabled)) {
if (DEFAULT_ICON_MAP.containsKey(pathIconDisabled)) {
pathIconDisabled = DEFAULT_ICON_MAP.get(pathIconDisabled);
ComponentUtil.setImg(imgIcon, pathIconDisabled);
@@ -566,7 +566,7 @@
}
} else {
if (expanded) {
- if (attrPresents(pathIconExpanded)) {
+ if (ComponentUtil.isNotBlank(pathIconExpanded)) {
if (DEFAULT_ICON_MAP.containsKey(pathIconExpanded)) {
pathIconExpanded = DEFAULT_ICON_MAP
.get(pathIconExpanded);
@@ -581,7 +581,7 @@
ComponentUtil.setImg(imgIcon, PANEL_MENU_GROUP_ICON_SPACER_PATH);
}
} else {
- if (attrPresents(pathIconCollapsed)) {
+ if (ComponentUtil.isNotBlank(pathIconCollapsed)) {
if (DEFAULT_ICON_MAP.containsKey(pathIconCollapsed)) {
pathIconCollapsed = DEFAULT_ICON_MAP
.get(pathIconCollapsed);
@@ -662,18 +662,6 @@
pmg_style = sourceElement.getAttribute(STYLE);
pmg_styleClass = sourceElement.getAttribute(STYLE_CLASS);
}
-
-
- /**
- * Checks is attribute have some value.
- *
- * @param attr the attribute
- *
- * @return true, if successful
- */
- private static boolean attrPresents(String attr) {
- return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
- }
/* (non-Javadoc)
* @see
org.jboss.tools.vpe.editor.template.VpeToggableTemplate#toggle(org.jboss.tools.vpe.editor.VpeVisualDomBuilder,
org.w3c.dom.Node, java.lang.String)
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2008-12-19
14:02:16 UTC (rev 12712)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2008-12-19
14:05:09 UTC (rev 12713)
@@ -230,8 +230,8 @@
labelAttr);
}
- if (attrPresents(labelValue)) {
- if (attrPresents(bundleValue)) {
+ if (ComponentUtil.isNotBlank(labelValue)) {
+ if (ComponentUtil.isNotBlank(bundleValue)) {
if (!labelValue.equals(bundleValue)) {
resultValue = bundleValue;
} else {
@@ -241,7 +241,7 @@
resultValue = labelValue;
}
} else {
- if (attrPresents(bundleValue)) {
+ if (ComponentUtil.isNotBlank(bundleValue)) {
resultValue = bundleValue;
} else {
resultValue = EMPTY;
@@ -274,7 +274,7 @@
nsIDOMElement iconCell = tdNowrapLeft;
nsIDOMElement emptyCell = tdRight;
- if (attrPresents(pm_iconItemPosition)) {
+ if (ComponentUtil.isNotBlank(pm_iconItemPosition)) {
if (RIGHT.equalsIgnoreCase(pm_iconItemPosition)) {
/*
* Set icon image on the right
@@ -283,7 +283,7 @@
emptyCell = tdNowrapLeft;
}
}
- if (childOfPanelMenu && attrPresents(pm_iconItemTopPosition)) {
+ if (childOfPanelMenu && ComponentUtil.isNotBlank(pm_iconItemTopPosition)) {
if (RIGHT.equalsIgnoreCase(pm_iconItemTopPosition)) {
/*
* Set icon image on the right
@@ -350,7 +350,7 @@
*/
private static String[] getSpecifiedIcon(String pm_icon, String pmi_icon) {
String[] imgPath = {EMPTY, EMPTY};
- if (attrPresents(pmi_icon)) {
+ if (ComponentUtil.isNotBlank(pmi_icon)) {
/*
* Icon was set in the panelMenuItem attribute.
*/
@@ -358,7 +358,7 @@
if (RichFacesPanelMenuGroupTemplate.DEFAULT_ICON_MAP.containsKey(pmi_icon)) {
imgPath[1] = RichFacesPanelMenuGroupTemplate.DEFAULT_ICON_MAP.get(pmi_icon);
}
- } else if (attrPresents(pm_icon)) {
+ } else if (ComponentUtil.isNotBlank(pm_icon)) {
/*
* Icon was set in the panelMenu attribute.
*/
@@ -447,10 +447,10 @@
String labelCellClass = EMPTY;
String emptyCellClass = EMPTY;
- if (attrPresents(pmi_styleClass)) {
+ if (ComponentUtil.isNotBlank(pmi_styleClass)) {
tableClass += SPACE + pmi_styleClass;
}
- if (attrPresents(pmi_style)) {
+ if (ComponentUtil.isNotBlank(pmi_style)) {
tableStyle += SPACE + pmi_style;
}
@@ -461,10 +461,10 @@
tableClass += SPACE + CSS_TOP_ITEM;
iconCellClass += SPACE + CSS_TOP_ITEM_ICON;
labelCellClass += SPACE + CSS_TOP_ITEM_LABEL;
- if (attrPresents(pm_disabledItemClass)) {
+ if (ComponentUtil.isNotBlank(pm_disabledItemClass)) {
tableClass += SPACE + pm_disabledItemClass;
}
- if (attrPresents(pm_topItemStyle)) {
+ if (ComponentUtil.isNotBlank(pm_topItemStyle)) {
tableStyle += SPACE + pm_topItemStyle;
}
}
@@ -472,17 +472,17 @@
if (TRUE.equalsIgnoreCase(pmi_disabled)) {
// tableClass += SPACE + CSS_DISABLED_ELEMENT;
- if ((attrPresents(pm_disabledItemClass))
+ if ((ComponentUtil.isNotBlank(pm_disabledItemClass))
&& !(TRUE.equalsIgnoreCase(pm_disabled))) {
tableClass += SPACE + pm_disabledItemClass;
}
- if (attrPresents(pm_disabledItemStyle)) {
+ if (ComponentUtil.isNotBlank(pm_disabledItemStyle)) {
tableStyle += SPACE + pm_disabledItemStyle;
}
- if (attrPresents(pmi_disabledClass)) {
+ if (ComponentUtil.isNotBlank(pmi_disabledClass)) {
tableClass += SPACE + pmi_disabledClass;
}
- if (attrPresents(pmi_disabledStyle)) {
+ if (ComponentUtil.isNotBlank(pmi_disabledStyle)) {
tableStyle += SPACE + pmi_disabledStyle;
}
}
@@ -495,27 +495,27 @@
labelCellClass = CSS_ITEM_LABEL;
emptyCellClass = DR_NOWARP_CLASS;
- if (attrPresents(pmi_iconClass)) {
+ if (ComponentUtil.isNotBlank(pmi_iconClass)) {
imgIconClass += SPACE + pmi_iconClass;
}
- if (attrPresents(pmi_iconStyle)) {
+ if (ComponentUtil.isNotBlank(pmi_iconStyle)) {
iconCellStyle += SPACE + pmi_iconStyle;
}
if (childOfPanelMenu) {
tableClass += SPACE + CSS_TOP_ITEM;
imgIconClass += SPACE + CSS_TOP_ITEM_ICON;
labelCellClass += SPACE + CSS_TOP_ITEM_LABEL;
- if (attrPresents(pm_topItemClass)) {
+ if (ComponentUtil.isNotBlank(pm_topItemClass)) {
tableClass += SPACE + pm_topItemClass;
}
- if (attrPresents(pm_topItemStyle)) {
+ if (ComponentUtil.isNotBlank(pm_topItemStyle)) {
tableStyle += SPACE + pm_topItemStyle;
}
} else {
- if (attrPresents(pm_itemClass)) {
+ if (ComponentUtil.isNotBlank(pm_itemClass)) {
tableClass += SPACE + pm_itemClass;
}
- if (attrPresents(pm_itemStyle)) {
+ if (ComponentUtil.isNotBlank(pm_itemStyle)) {
tableStyle += SPACE + pm_itemStyle;
}
}
@@ -627,17 +627,6 @@
pmi_styleClass = sourceElement.getAttribute(STYLE_CLASS);
}
-
- /**
- * Checks is attribute have some value.
- *
- * @param attr the attribute
- *
- * @return true, if successful
- */
- private static boolean attrPresents(String attr) {
- return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
- }
/* (non-Javadoc)
* @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#setSourceAttributeSelection(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Element, int, int, java.lang.Object)