[jbosstools-commits] JBoss Tools SVN: r23271 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Jul 7 04:43:22 EDT 2010
Author: dvinnichek
Date: 2010-07-07 04:43:22 -0400 (Wed, 07 Jul 2010)
New Revision: 23271
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java
Log:
fix templates for a4j components according to JBIDE-6542
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java 2010-07-07 07:04:14 UTC (rev 23270)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java 2010-07-07 08:43:22 UTC (rev 23271)
@@ -53,17 +53,15 @@
Element sourceElement = (Element) sourceNode;
nsIDOMElement mainTag = createMainTag(visualDocument, sourceElement);
- String uriAttribute = sourceElement.getAttribute(Ajax4JSF.ATTR_URI_ATTRIBUTE);
- if (uriAttribute == null || "".equals(uriAttribute)) { //$NON-NLS-1$
- uriAttribute = HTML.ATTR_SRC;
- }
-
+ String uriAttribute = sourceElement.hasAttribute(Ajax4JSF.ATTR_URI_ATTRIBUTE) ?
+ sourceElement.getAttribute(Ajax4JSF.ATTR_URI_ATTRIBUTE) : HTML.ATTR_SRC;
+
mainTag.setAttribute(uriAttribute, "file:///" + getAbsoluteResourcePath(IMG_PATH).replace('\\', '/')); //$NON-NLS-1$
VisualDomUtil.copyAttributes(sourceElement, SAME_ATTRIBUTES_LIST, mainTag);
-
- String styleClass = sourceElement.getAttribute(Ajax4JSF.ATTR_STYLE_CLASS);
- if (styleClass != null) {
+
+ if (sourceElement.hasAttribute(Ajax4JSF.ATTR_STYLE_CLASS)) {
+ String styleClass = sourceElement.getAttribute(Ajax4JSF.ATTR_STYLE_CLASS);
mainTag.setAttribute(HTML.ATTR_CLASS, styleClass);
}
@@ -87,12 +85,10 @@
*/
private static nsIDOMElement createMainTag(nsIDOMDocument visualDocument,
Element sourceElement) {
- String element = sourceElement.getAttribute(Ajax4JSF.ATTR_ELEMENT);
+
+ String element = sourceElement.hasAttribute(Ajax4JSF.ATTR_ELEMENT) ?
+ sourceElement.getAttribute(Ajax4JSF.ATTR_ELEMENT) : HTML.TAG_IMG;
- if (element == null || "".equals(element)) { //$NON-NLS-1$
- element = HTML.TAG_IMG;
- }
-
nsIDOMElement mainTag = visualDocument.createElement(element);
return mainTag;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java 2010-07-07 07:04:14 UTC (rev 23270)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java 2010-07-07 08:43:22 UTC (rev 23271)
@@ -93,13 +93,13 @@
// set class of the span to "{@styleClass} {@stopStyleClass}"
{
- String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
- String stopStyleClass = sourceElement.getAttribute(ATTR_STOP_STYLE_CLASS);
StringBuffer spanClass = new StringBuffer();
- if (styleClass != null) {
+ if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+ String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
spanClass.append(styleClass);
}
- if (stopStyleClass != null) {
+ if (sourceElement.hasAttribute(ATTR_STOP_STYLE_CLASS)) {
+ String stopStyleClass = sourceElement.getAttribute(ATTR_STOP_STYLE_CLASS);
spanClass.append(HTML.VALUE_CLASS_DELIMITER).append(stopStyleClass);
}
span.setAttribute(HTML.ATTR_CLASS, spanClass.toString());
@@ -107,13 +107,13 @@
// set style of the span to "{@style};{@stopStyle}"
{
- String style = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
- String stopStyle = sourceElement.getAttribute(ATTR_STOP_STYLE);
StringBuffer spanStyle = new StringBuffer();
- if (style != null) {
+ if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE)) {
+ String style = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
spanStyle.append(style).append(HTML.VALUE_STYLE_DELIMITER);
}
- if (stopStyle != null) {
+ if (sourceElement.hasAttribute(ATTR_STOP_STYLE)) {
+ String stopStyle = sourceElement.getAttribute(ATTR_STOP_STYLE);
spanStyle.append(stopStyle).append(HTML.VALUE_STYLE_DELIMITER);
}
span.setAttribute(HTML.ATTR_STYLE, spanStyle.toString());
More information about the jbosstools-commits
mailing list