Author: dvinnichek
Date: 2010-07-08 03:22:06 -0400 (Thu, 08 Jul 2010)
New Revision: 23304
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jbpm/src/org/jboss/tools/jsf/vpe/jbpm/template/JBPMDataForm.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/ComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlUrlTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlXOutTemplate.java
Log:
fix templates for jbpm and jstl according to JBIDE-6542
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jbpm/src/org/jboss/tools/jsf/vpe/jbpm/template/JBPMDataForm.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jbpm/src/org/jboss/tools/jsf/vpe/jbpm/template/JBPMDataForm.java 2010-07-08
04:26:04 UTC (rev 23303)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jbpm/src/org/jboss/tools/jsf/vpe/jbpm/template/JBPMDataForm.java 2010-07-08
07:22:06 UTC (rev 23304)
@@ -17,6 +17,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.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -40,11 +41,10 @@
nsIDOMDocument visualDocument) {
nsIDOMElement element = visualDocument.createElement(HTML.TAG_TABLE);
Element sourceElement = (Element) sourceNode;
- element
- .setAttribute(
- HTML.ATTR_STYLE,
- computeBaseTableStyleValue()
- + (sourceElement.getAttribute(HTML.ATTR_STYLE) == null ? "" :
sourceElement.getAttribute(HTML.ATTR_STYLE))); //$NON-NLS-1$
+ element.setAttribute(HTML.ATTR_STYLE,
+ computeBaseTableStyleValue() +
+ (sourceElement.hasAttribute(HTML.ATTR_STYLE) ?
+ sourceElement.getAttribute(HTML.ATTR_STYLE) : Constants.EMPTY));
VpeCreationData creationData = new VpeCreationData(element);
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(element);
NodeList children = sourceNode.getChildNodes();
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/ComponentUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/ComponentUtil.java 2010-07-08
04:26:04 UTC (rev 23303)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/ComponentUtil.java 2010-07-08
07:22:06 UTC (rev 23304)
@@ -31,11 +31,7 @@
* @return the attribute
*/
public static String getAttribute(Element sourceElement, String attributeName) {
- String attribute = sourceElement.getAttribute(attributeName);
- if (attribute == null) {
- attribute = Constants.EMPTY;
- }
- return attribute;
+ return getAttribute(sourceElement, attributeName, Constants.EMPTY);
}
/**
@@ -48,11 +44,8 @@
* @return the attribute
*/
public static String getAttribute(Element sourceElement, String attributeName, String
defaultValue) {
- String attribute = sourceElement.getAttribute(attributeName);
- if (attribute == null) {
- attribute = defaultValue;
- }
- return attribute;
+ return sourceElement.hasAttribute(attributeName) ?
+ sourceElement.getAttribute(attributeName) : defaultValue;
}
/**
@@ -64,10 +57,7 @@
* @return the attribute
*/
public static String getAttribute(nsIDOMElement sourceElement, String attributeName)
{
- String attribute = sourceElement.getAttribute(attributeName);
- if (attribute == null) {
- attribute = Constants.EMPTY;
- }
- return attribute;
+ return sourceElement.hasAttribute(attributeName) ?
+ sourceElement.getAttribute(attributeName) : Constants.EMPTY;
}
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlUrlTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlUrlTemplate.java 2010-07-08
04:26:04 UTC (rev 23303)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlUrlTemplate.java 2010-07-08
07:22:06 UTC (rev 23304)
@@ -35,14 +35,18 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- Element sourceElement = (Element) sourceNode;
- String value = sourceElement.getAttribute(HTML.ATTR_VALUE);
- nsIDOMElement span = VisualDomUtil.createBorderlessContainer(visualDocument);
- nsIDOMText urlText = visualDocument.createTextNode(value);
- span.appendChild(urlText);
- VpeCreationData creationData = new VpeCreationData(span);
-
- return creationData;
+
+ Element sourceElement = (Element) sourceNode;
+ nsIDOMElement span = VisualDomUtil.createBorderlessContainer(visualDocument);
+
+ if (sourceElement.hasAttribute(HTML.ATTR_VALUE)) {
+ String value = sourceElement.getAttribute(HTML.ATTR_VALUE);
+ nsIDOMText urlText = visualDocument.createTextNode(value);
+ span.appendChild(urlText);
+ }
+
+ VpeCreationData creationData = new VpeCreationData(span);
+ return creationData;
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlXOutTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlXOutTemplate.java 2010-07-08
04:26:04 UTC (rev 23303)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlXOutTemplate.java 2010-07-08
07:22:06 UTC (rev 23304)
@@ -14,7 +14,6 @@
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.HTML;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -36,15 +35,19 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- Element sourceElement = (Element) sourceNode;
- String select = sourceElement.getAttribute(Jstl.ATTR_SELECT);
- nsIDOMElement span = VisualDomUtil
- .createBorderlessContainer(visualDocument);
- nsIDOMText text = visualDocument.createTextNode(select);
- span.appendChild(text);
- VpeCreationData creationData = new VpeCreationData(span);
-
- return creationData;
+
+ Element sourceElement = (Element) sourceNode;
+ nsIDOMElement span = VisualDomUtil
+ .createBorderlessContainer(visualDocument);
+
+ if (sourceElement.hasAttribute(Jstl.ATTR_SELECT)) {
+ String select = sourceElement.getAttribute(Jstl.ATTR_SELECT);
+ nsIDOMText text = visualDocument.createTextNode(select);
+ span.appendChild(text);
+ }
+
+ VpeCreationData creationData = new VpeCreationData(span);
+ return creationData;
}
}
Show replies by date