Author: yradtsevich
Date: 2010-07-29 12:06:19 -0400 (Thu, 29 Jul 2010)
New Revision: 23801
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.spring/src/org/jboss/tools/vpe/spring/template/SpringFormSelectTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.spring/src/org/jboss/tools/vpe/spring/template/util/Spring.java
trunk/vpe/plugins/org.jboss.tools.vpe.spring/templates/vpe-templates-spring.xml
Log:
https://jira.jboss.org/browse/JBIDE-6711
- form:option template is added
- a little refactoring of SpringSelectTemplate is done
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.spring/src/org/jboss/tools/vpe/spring/template/SpringFormSelectTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.spring/src/org/jboss/tools/vpe/spring/template/SpringFormSelectTemplate.java 2010-07-29
15:51:15 UTC (rev 23800)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.spring/src/org/jboss/tools/vpe/spring/template/SpringFormSelectTemplate.java 2010-07-29
16:06:19 UTC (rev 23801)
@@ -28,7 +28,7 @@
* @see <a
href="http://static.springsource.org/spring/docs/3.0.x/spring-framew...
select tag</>
*/
public class SpringFormSelectTemplate extends VpeAbstractTemplate {
-
+
/* (non-Javadoc)
* @see
org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
*/
@@ -47,14 +47,15 @@
select.setAttribute(HTML.ATTR_DISABLED, HTML.ATTR_DISABLED);
}
- if (sourceElement.hasAttribute("items")) {
+ if (sourceElement.hasAttribute(Spring.ATTR_ITEMS)) {
// an inner 'option' tag has to be generated
- String optionBody = sourceElement.getAttribute("items");
- if (sourceElement.hasAttribute("itemLabel")) {
- optionBody += '.' + sourceElement.getAttribute("itemLabel");
+ String optionBody = sourceElement.getAttribute(Spring.ATTR_ITEMS);
+ if (sourceElement.hasAttribute(Spring.ATTR_ITEM_LABEL)) {
+ optionBody += '.' + sourceElement.getAttribute(Spring.ATTR_ITEM_LABEL);
}
nsIDOMElement option = visualDocument.createElement(HTML.TAG_OPTION);
+ option.appendChild(visualDocument.createTextNode(optionBody));
select.appendChild(option);
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.spring/src/org/jboss/tools/vpe/spring/template/util/Spring.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.spring/src/org/jboss/tools/vpe/spring/template/util/Spring.java 2010-07-29
15:51:15 UTC (rev 23800)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.spring/src/org/jboss/tools/vpe/spring/template/util/Spring.java 2010-07-29
16:06:19 UTC (rev 23801)
@@ -16,10 +16,12 @@
*
*/
public class Spring {
- public static String ATTR_CSS_CLASS = "cssClass"; //$NON-NLS-1$
- public static String ATTR_CSS_STYLE = "cssStyle"; //$NON-NLS-1$
+ public static final String ATTR_CSS_CLASS = "cssClass"; //$NON-NLS-1$
+ public static final String ATTR_CSS_STYLE = "cssStyle"; //$NON-NLS-1$
public static final String ATTR_DISABLED = "disabled"; //$NON-NLS-1$
- public static String ATTR_ID = "id"; //$NON-NLS-1$
+ public static final String ATTR_ID = "id"; //$NON-NLS-1$
+ public static final String ATTR_ITEMS = "items"; //$NON-NLS-1$
+ public static final String ATTR_ITEM_LABEL = "itemLabel"; //$NON-NLS-1$
public static final String VALUE_TRUE = "true"; //$NON-NLS-1$
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.spring/templates/vpe-templates-spring.xml
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.spring/templates/vpe-templates-spring.xml 2010-07-29
15:51:15 UTC (rev 23800)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.spring/templates/vpe-templates-spring.xml 2010-07-29
16:06:19 UTC (rev 23801)
@@ -136,4 +136,20 @@
</vpe:dnd>
</vpe:template>
</vpe:tag>
+ <vpe:tag name="form:option" case-sensitive="yes">
+ <vpe:if test="@disabled='true'">
+ <vpe:template children="yes" modify="yes">
+ <option id="{@id}" class="{@cssClass}"
style="{@cssStyle}"
+ dir="{@dir}" disabled="disabled">
+ <vpe:value expr="{@label}" />
+ </option>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="yes" modify="yes">
+ <option id="{@id}" class="{@cssClass}"
style="{@cssStyle}"
+ dir="{@dir}">
+ <vpe:value expr="{@label}" />
+ </option>
+ </vpe:template>
+ </vpe:tag>
</vpe:templates>