[jbosstools-commits] JBoss Tools SVN: r43071 - in trunk: vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Aug 16 06:54:53 EDT 2012


Author: dmaliarevich
Date: 2012-08-16 06:54:53 -0400 (Thu, 16 Aug 2012)
New Revision: 43071

Modified:
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHasChildren.java
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Log:
https://issues.jboss.org/browse/JBIDE-3225 - adding text for a4j:push and a4j:actionParam

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml	2012-08-16 10:04:38 UTC (rev 43070)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml	2012-08-16 10:54:53 UTC (rev 43071)
@@ -182,6 +182,11 @@
     </vpe:tag>
     
     <vpe:tag name="a4j:actionparam" case-sensitive="yes">
+    <vpe:if test="haschildren('true')">
+	    <vpe:template children="yes" modify="no" >
+	    	<div></div>
+	    </vpe:template>
+    </vpe:if>
 	    <vpe:template children="no" modify="no" >
 	    </vpe:template>
     </vpe:tag>
@@ -281,6 +286,11 @@
     </vpe:tag>
     
     <vpe:tag name="a4j:push" case-sensitive="yes">
+        <vpe:if test="haschildren('true')">
+	    <vpe:template children="yes" modify="no" >
+	    	<div></div>
+	    </vpe:template>
+    </vpe:if>
 	    <vpe:template children="no" modify="no" >
 	    </vpe:template>
     </vpe:tag>

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHasChildren.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHasChildren.java	2012-08-16 10:04:38 UTC (rev 43070)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHasChildren.java	2012-08-16 10:54:53 UTC (rev 43071)
@@ -7,7 +7,7 @@
  *
  * Contributors:
  *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
+ ******************************************************************************/
 package org.jboss.tools.vpe.editor.template.expression;
 
 import org.w3c.dom.Node;
@@ -17,17 +17,21 @@
 
 public class VpeFunctionHasChildren extends VpeFunction {
 
-	public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
+	public VpeValue exec(VpePageContext pageContext, Node sourceNode)  throws VpeExpressionException {
+		boolean includeTextNodes = "true".equalsIgnoreCase( //$NON-NLS-1$
+				getParameter(0).exec(pageContext, sourceNode).stringValue());
+		
 		boolean status = false;
-		if(sourceNode != null){
-			if(sourceNode.hasChildNodes()){
+		if (sourceNode != null) {
+			if (sourceNode.hasChildNodes()) {
 				NodeList list = sourceNode.getChildNodes();
-				if(list.getLength() == 1 && ((Node)list.item(0)).getNodeType() == Node.TEXT_NODE){
+				if (!includeTextNodes && (list.getLength() == 1)
+						&& ((Node) list.item(0)).getNodeType() == Node.TEXT_NODE) {
 					status = false;
-				}else status = true;
+				} else
+					status = true;
 			}
 		}
-		
 		return new VpeValue(status);
 	}
 }

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java	2012-08-16 10:04:38 UTC (rev 43070)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java	2012-08-16 10:54:53 UTC (rev 43071)
@@ -80,16 +80,17 @@
 	public static final String ATTR_ID = "id"; //$NON-NLS-1$
 	public static final String ATTR_TYPE = "type"; //$NON-NLS-1$
 	public static final String ATTR_TEXT = "text"; //$NON-NLS-1$
-	public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
 	public static final String ATTR_TITLE = "title"; //$NON-NLS-1$
 	public static final String ATTR_NAME = "name"; //$NON-NLS-1$
 	public static final String ATTR_VALUE = "value"; //$NON-NLS-1$
 	public static final String ATTR_STYLE = "style"; //$NON-NLS-1$
 	public static final String ATTR_SIZE = "size"; //$NON-NLS-1$
 	public static final String ATTR_MULTIPLE = "multiple"; //$NON-NLS-1$
-	public static final String ATTR_COLSPAN = "colspan"; //$NON-NLS-1$
 	public static final String ATTR_CELLSPACING = "cellspacing"; //$NON-NLS-1$
 	public static final String ATTR_CELLPADDING = "cellpadding"; //$NON-NLS-1$
+	public static final String ATTR_CHECKED = "checked"; //$NON-NLS-1$
+	public static final String ATTR_COLSPAN = "colspan"; //$NON-NLS-1$
+	public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
 	public static final String ATTR_WIDTH = "width"; //$NON-NLS-1$
 	public static final String ATTR_HEIGHT = "height"; //$NON-NLS-1$
 	public static final String ATTR_HSPACE = "hspace"; //$NON-NLS-1$



More information about the jbosstools-commits mailing list