[richfaces-svn-commits] JBoss Rich Faces SVN: r15864 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/templatecompiler/model and 2 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Nov 11 15:48:15 EST 2009


Author: nbelaevski
Date: 2009-11-11 15:48:15 -0500 (Wed, 11 Nov 2009)
New Revision: 15864

Added:
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkChooseElement.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkConditionalJstlElementBase.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkIfElement.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkOtherwiseElement.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkWhenElement.java
   root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd
   root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd
Removed:
   root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/faces-composite.xsd
Modified:
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelElement.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelFragment.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Template.java
   root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/TemplateVisitor.java
   root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
   root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
Log:
https://jira.jboss.org/jira/browse/RF-7732
Added support for JSTL core if/choose/when/otherwise elements
Added support for cdk:object

Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java	2009-11-11 18:14:51 UTC (rev 15863)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -29,16 +29,19 @@
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
-import java.util.Stack;
 import java.util.regex.Pattern;
 
 import org.richfaces.builder.model.JavaClass;
 import org.richfaces.builder.model.MethodBodyStatement;
-import org.richfaces.builder.templates.BaseTemplateConsumer;
 import org.richfaces.cdk.CdkException;
 import org.richfaces.cdk.templatecompiler.model.AnyElement;
 import org.richfaces.cdk.templatecompiler.model.CdkBodyElement;
 import org.richfaces.cdk.templatecompiler.model.CdkCallElement;
+import org.richfaces.cdk.templatecompiler.model.CdkChooseElement;
+import org.richfaces.cdk.templatecompiler.model.CdkIfElement;
+import org.richfaces.cdk.templatecompiler.model.CdkObjectElement;
+import org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement;
+import org.richfaces.cdk.templatecompiler.model.CdkWhenElement;
 import org.richfaces.cdk.templatecompiler.model.CompositeInterface;
 import org.richfaces.cdk.templatecompiler.model.TemplateVisitor;
 
@@ -146,5 +149,77 @@
         // TODO Auto-generated method stub
 
     }
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
+	 */
+	@Override
+	public void endElement(CdkIfElement cdkIfElement) {
+		// TODO Auto-generated method stub
+		
+	}
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
+	 */
+	@Override
+	public void startElement(CdkIfElement cdkIfElement) {
+		// TODO Auto-generated method stub
+		
+	}
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
+	 */
+	@Override
+	public void endElement(CdkWhenElement cdkWhenElement) {
+		// TODO Auto-generated method stub
+		
+	}
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+	 */
+	@Override
+	public void endElement(CdkChooseElement cdkChooseElement) {
+		// TODO Auto-generated method stub
+		
+	}
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
+	 */
+	@Override
+	public void endElement(CdkOtherwiseElement cdkOtherwiseElement) {
+		// TODO Auto-generated method stub
+		
+	}
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
+	 */
+	@Override
+	public void startElement(CdkWhenElement cdkWhenElement) {
+		// TODO Auto-generated method stub
+		
+	}
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+	 */
+	@Override
+	public void startElement(CdkChooseElement cdkChooseElement) {
+		// TODO Auto-generated method stub
+		
+	}
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
+	 */
+	@Override
+	public void startElement(CdkOtherwiseElement cdkOtherwiseElement) {
+		// TODO Auto-generated method stub
+		
+	}
+	/* (non-Javadoc)
+	 * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#visitElement(org.richfaces.cdk.templatecompiler.model.CdkObjectElement)
+	 */
+	@Override
+	public void visitElement(CdkObjectElement cdkObjectElement) {
+		// TODO Auto-generated method stub
+		
+	}
 
 }

Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkChooseElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkChooseElement.java	                        (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkChooseElement.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler.model;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.richfaces.cdk.CdkException;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+ at XmlRootElement(name="choose", namespace=Template.JSTL_CORE_NAMESPACE)
+public class CdkChooseElement extends ModelFragment {
+
+	@XmlElements({
+		@XmlElement(name="when", namespace=Template.JSTL_CORE_NAMESPACE, type = CdkWhenElement.class),
+		@XmlElement(name="otherwise", namespace=Template.JSTL_CORE_NAMESPACE, type = CdkOtherwiseElement.class)
+	})
+	@Override
+	public List<Object> getChildren() {
+		return super.getChildren();
+	}
+	
+	@Override
+	public void setChildren(List<Object> body) {
+		super.setChildren(body);
+	}
+
+	@Override
+	public void beforeVisit(TemplateVisitor visitor) throws CdkException {
+		visitor.startElement(this);
+	}
+	
+	@Override
+	public void afterVisit(TemplateVisitor visitor) throws CdkException {
+		visitor.endElement(this);
+	}
+}

Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkConditionalJstlElementBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkConditionalJstlElementBase.java	                        (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkConditionalJstlElementBase.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler.model;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public abstract class CdkConditionalJstlElementBase extends ModelFragment {
+
+	@XmlAttribute(required = true)
+	private String test;
+	
+	/**
+	 * @return the test
+	 */
+	public String getTest() {
+		return test;
+	}
+	
+	/**
+	 * @param test the test to set
+	 */
+	public void setTest(String test) {
+		this.test = test;
+	}
+
+}

Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkIfElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkIfElement.java	                        (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkIfElement.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.richfaces.cdk.CdkException;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+ at XmlRootElement(name="if", namespace=Template.JSTL_CORE_NAMESPACE)
+public class CdkIfElement extends CdkConditionalJstlElementBase {
+
+	@Override
+	public void beforeVisit(TemplateVisitor visitor) throws CdkException {
+		visitor.startElement(this);
+	}
+	
+	@Override
+	public void afterVisit(TemplateVisitor visitor) throws CdkException {
+		visitor.endElement(this);
+	}
+}

Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java	                        (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler.model;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.richfaces.cdk.CdkException;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+ at XmlRootElement(name = "object", namespace = Template.CDK_NAMESPACE)
+public class CdkObjectElement implements ModelElement {
+	
+	@XmlAttribute(required = true)
+	private String name;
+	
+	/**
+	 * @return the bodyValue
+	 */
+	public String getBodyValue() {
+		return bodyValue;
+	}
+
+	/**
+	 * @param bodyValue the bodyValue to set
+	 */
+	public void setBodyValue(String bodyValue) {
+		this.bodyValue = bodyValue;
+	}
+
+	@XmlAttribute
+	private String value;
+
+	@XmlValue
+	private String bodyValue;
+	
+	@XmlAttribute(required = true)
+	private String type;
+
+	/**
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * @param name the name to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * @return the value
+	 */
+	public String getValue() {
+		return value;
+	}
+
+	/**
+	 * @param value the value to set
+	 */
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+	/**
+	 * @return the type
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * @param type the type to set
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	@Override
+	public void visit(TemplateVisitor visitor) throws CdkException {
+		visitor.visitElement(this);
+	}
+
+}

Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkOtherwiseElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkOtherwiseElement.java	                        (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkOtherwiseElement.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler.model;
+
+import org.richfaces.cdk.CdkException;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class CdkOtherwiseElement extends ModelFragment {
+
+	@Override
+	public void beforeVisit(TemplateVisitor visitor) throws CdkException {
+		visitor.startElement(this);
+	}
+
+	@Override
+	public void afterVisit(TemplateVisitor visitor) throws CdkException {
+		visitor.endElement(this);
+	}
+}

Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkWhenElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkWhenElement.java	                        (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkWhenElement.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler.model;
+
+import org.richfaces.cdk.CdkException;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class CdkWhenElement extends CdkConditionalJstlElementBase {
+
+	@Override
+	public void beforeVisit(TemplateVisitor visitor) throws CdkException {
+		visitor.startElement(this);
+	}
+	
+	@Override
+	public void afterVisit(TemplateVisitor visitor) throws CdkException {
+		visitor.endElement(this);
+	}
+}

Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelElement.java	2009-11-11 18:14:51 UTC (rev 15863)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelElement.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -1,12 +1,6 @@
 package org.richfaces.cdk.templatecompiler.model;
 
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlMixed;
-
 import org.richfaces.cdk.CdkException;
-import org.w3c.dom.Element;
 
 public interface ModelElement {
 

Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelFragment.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelFragment.java	2009-11-11 18:14:51 UTC (rev 15863)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelFragment.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -14,13 +14,20 @@
  * @author asmirnov at exadel.com
  *
  */
- at XmlSeeAlso({CdkCallElement.class,CdkBodyElement.class})
+ at XmlSeeAlso({
+	CdkCallElement.class, 
+	CdkBodyElement.class, 
+	CdkIfElement.class, 
+	CdkChooseElement.class,
+	CdkObjectElement.class
+})
 public class ModelFragment implements LeafModelElement {
 
     private List<Object> children;
 
 
-    @XmlAnyElement(lax=true,value=ElementsHandler.class)
+    //TODO filter unhandled elements from known namespaces
+    @XmlAnyElement(lax=true, value=ElementsHandler.class)
     @XmlMixed
     public List<Object> getChildren() {
         return this.children;

Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Template.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Template.java	2009-11-11 18:14:51 UTC (rev 15863)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Template.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -34,7 +34,8 @@
 @XmlRootElement(name="root",namespace=Template.CDK_NAMESPACE)
 public class Template {
     
-
+	public static final String JSTL_CORE_NAMESPACE = "http://java.sun.com/jsp/jstl/core";
+	
     public static final String CDK_NAMESPACE="http://richfaces.org/cdk";
     
     public static final String COMPOSITE_NAMESPACE="http://java.sun.com/jsf/composite";

Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/TemplateVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/TemplateVisitor.java	2009-11-11 18:14:51 UTC (rev 15863)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/TemplateVisitor.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -44,4 +44,22 @@
 
     void endElement(CdkBodyElement cdkBodyElement) throws CdkException;
 
+	void startElement(CdkIfElement cdkIfElement);
+
+	void endElement(CdkIfElement cdkIfElement);
+
+	void startElement(CdkWhenElement cdkWhenElement);
+
+	void endElement(CdkWhenElement cdkWhenElement);
+
+	void startElement(CdkChooseElement cdkChooseElement);
+
+	void endElement(CdkChooseElement cdkChooseElement);
+
+	void startElement(CdkOtherwiseElement cdkOtherwiseElement);
+
+	void endElement(CdkOtherwiseElement cdkOtherwiseElement);
+
+	void visitElement(CdkObjectElement cdkObjectElement);
+
 }

Copied: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd (from rev 15863, root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/faces-composite.xsd)
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd	                        (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd	2009-11-11 20:48:15 UTC (rev 15864)
@@ -0,0 +1,247 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+
+<xs:schema targetNamespace="http://java.sun.com/jsf/composite"
+	xmlns:cc="http://java.sun.com/jsf/composite" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:xml="http://www.w3.org/XML/1998/namespace" elementFormDefault="qualified"
+	attributeFormDefault="unqualified">
+
+	<xs:attributeGroup name="beanDescriptorAttributes">
+		<xs:attribute name="displayName">
+			<xs:annotation>
+				<xs:documentation>
+					The name to display in a tool palette containing
+					this component. The
+					value of this attribute will be set as the value
+					for this property
+					on the composite component bean descriptor.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="preferred" type="xs:boolean" default="false">
+			<xs:annotation>
+				<xs:documentation>Is this a "preferred" component. The value of this
+					attribute will be set as the value for this property on the
+					composite component bean descriptor.</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="expert" type="xs:boolean" default="false">
+			<xs:annotation>
+				<xs:documentation>Is this component only for expert users? The value
+					of this attribute will be set as the value for this property on the
+					composite component bean descriptor.</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="shortDescription">
+			<xs:annotation>
+				<xs:documentation>
+					A short description of the purpose of this
+					component. The value of
+					this attribute will be set as the value for
+					this property on the
+					composite component bean descriptor.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+	</xs:attributeGroup>
+
+	<xs:complexType name="attributeExtensionType">
+		<xs:sequence minOccurs="0" maxOccurs="unbounded">
+			<xs:choice>
+				<xs:element ref="cc:attribute" />
+				<xs:element ref="cc:extension" />
+				<xs:any processContents="lax" namespace="##other" />
+			</xs:choice>
+		</xs:sequence>
+		<xs:attribute name="name" use="required">
+			<xs:annotation>
+				<xs:documentation>
+					The name of the attribute as it must appear on the
+					composite component
+					tag in the using page. If the value of the name
+					attribute is equal
+					to (without the quotes) "action",
+					"actionListener", "validator", or
+					"valueChangeListener", the action
+					described in
+					ViewHandler.retargetMethodExpressions() must be taken
+					to handle the
+					attribute. In these cases, the method-sigature
+					attribute, if
+					present, must be ignored as its value is derived as
+					described in
+					retargetMethodExpressions().
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="targets">
+			<xs:annotation>
+				<xs:documentation>
+					If this element has a method-signature attribute, the value of the
+					targets attribute must be interpreted as a space (not tab)
+					separated list of client ids (relative to the top level component)
+					of components within the
+					&lt;composite:implementation&gt; section. Space is used as the delimiter
+						for compatibility with the IDREFS and NMTOKENS data types from the
+						XML Schema. Each entry in the list must be interpreted as the id
+						of an inner component to which the MethodExpression from the
+						composite component tag in the using page must be applied. If this
+						element has a method-signature attribute, but no targets
+						attribute, the value of the name attribute is used as the single
+						entry in the list. If the value of the name attribute is not one
+						of the special values listed in the description of the name
+						attribute, targets (or its derived value) need not correspond to
+						the id of an inner component.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="default">
+			<xs:annotation>
+				<xs:documentation>
+					If this attribute is not required, and a value is
+					not supplied by the
+					page author, use this as the default value.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="required" type="xs:boolean" default="false">
+			<xs:annotation>
+				<xs:documentation>
+					True if the page author must supply a value for
+					this attribute.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="method-signature">
+			<xs:annotation>
+				<xs:documentation>
+					Declares that this attribute must be a
+					MethodExpression whose method
+					signature is described by the value of
+					this attribute. The
+					signature must be described using fully
+					qualified class names
+					wherever a type is required. This attribute is
+					mutually exclusive
+					with the "type" attribute. If both attributes are
+					present, the
+					"method-signature" attribute is ignored.
+
+					PENDING: when
+					this file is generated from the web-facesuicomponent_2_0.xsd,
+					we
+					will not need to copy the content here manually.
+
+					Provides the
+					signature of the Java method. The syntax of the
+					method-signature
+					element is as follows (taken from
+					function-signature in
+					web-jsptaglibrary_2_1.xsd):
+
+					MethodSignature ::= ReturnType S
+					MethodName S? '(' S? Parameters? S? ')'
+
+					ReturnType ::= Type
+
+					MethodName ::= Identifier
+
+					Parameters ::= Parameter | ( Parameter S?
+					',' S? Parameters )
+
+					Parameter ::= Type
+
+					Where:
+
+					Type is a basic type or
+					a fully qualified Java class name (including
+					package name), as per
+					the 'Type' production in the Java Language
+					Specification, Second
+					Edition, Chapter 18.
+
+					Identifier is a Java identifier, as per the
+					'Identifier' production in the
+					Java Language Specification, Second
+					Edition, Chapter 18.
+
+					Example:
+
+					java.lang.String nickName(java.lang.String, int)
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="type">
+			<xs:annotation>
+				<xs:documentation>
+					<xs:annotation name="type">
+					</xs:annotation>
+					Declares that this attribute must be a ValueExpression whose
+					expected type
+					is given by the value of this attribute. If not
+					specified, and no
+					"method-signature" attribute is present,
+					java.lang.Object is
+					assumed. This attribute is mutually exclusive
+					with the "type"
+					attribute. If both attributes are present, the
+					"method-signature"
+					attribute is ignored.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attributeGroup ref="cc:beanDescriptorAttributes" />
+	</xs:complexType>
+
+	<xs:complexType name="compositeExtensionType">
+		<xs:sequence minOccurs="0" maxOccurs="unbounded">
+			<xs:any processContents="lax" />
+		</xs:sequence>
+	</xs:complexType>
+
+	<xs:complexType name="compositeInterfaceType">
+		<xs:sequence minOccurs="0" maxOccurs="unbounded">
+			<xs:choice>
+				<xs:any namespace="##any" processContents="lax" />
+			</xs:choice>
+		</xs:sequence>
+		<xs:attribute type="xs:string" name="name">
+			<xs:annotation>
+				<xs:documentation>
+					The name of this composite component. Advisory
+					only. The real name is
+					taken from the filename. The value of this
+					attribute will be set as
+					the value for this property on the
+					composite component bean
+					descriptor.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute type="xs:string" name="componentType">
+			<xs:annotation>
+				<xs:documentation>
+					The component-type of the UIComponent that will
+					serve as the composite
+					component root for this composite component.
+					The declared
+					component-family for this component must be
+					javax.faces.NamingContainer.	
+			</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attributeGroup ref="cc:beanDescriptorAttributes" />
+	</xs:complexType>
+
+	<xs:complexType name="compositeImplementationType"
+		mixed="true">
+		<xs:choice>
+			<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+		</xs:choice>
+	</xs:complexType>
+
+	<xs:element name="interface" type="cc:compositeInterfaceType" />
+	<xs:element name="implementation" type="cc:compositeImplementationType" />
+	<xs:element name="extension" type="cc:compositeExtensionType" />
+	<xs:element name="attribute" type="cc:attributeExtensionType" />
+
+</xs:schema>

Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd	                        (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd	2009-11-11 20:48:15 UTC (rev 15864)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	targetNamespace="http://java.sun.com/jsp/jstl/core" xmlns="http://java.sun.com/jsp/jstl/core"
+	xmlns:cdk="http://richfaces.org/cdk"
+	elementFormDefault="qualified" attributeFormDefault="unqualified">
+
+	<xs:import schemaLocation="cdk-template.xsd" namespace="http://richfaces.org/cdk" />
+
+	<xs:attributeGroup name="testGroup">
+		<xs:attribute name="test" form="unqualified" use="required"
+			type="cdk:elStrictExpression" />
+	</xs:attributeGroup>
+
+	<xs:complexType name="arbitraryContent" mixed="true">
+		<xs:choice>
+			<xs:any minOccurs="0" maxOccurs="unbounded" />
+		</xs:choice>
+	</xs:complexType>
+
+	<xs:complexType name="arbitraryConditionalContent">
+		<xs:complexContent>
+			<xs:extension base="arbitraryContent">
+				<xs:attributeGroup ref="testGroup" />
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+
+	<xs:element name="if" type="arbitraryConditionalContent" />
+	<xs:element name="choose">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element maxOccurs="unbounded" name="when"
+					type="arbitraryConditionalContent" />
+				<xs:element minOccurs="0" name="otherwise" type="arbitraryContent" />
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd	2009-11-11 18:14:51 UTC (rev 15863)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd	2009-11-11 20:48:15 UTC (rev 15864)
@@ -1,14 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
 	targetNamespace="http://richfaces.org/cdk" xmlns="http://richfaces.org/cdk"
-	elementFormDefault="qualified" attributeFormDefault="qualified"
-	xmlns:xhtml="http://richfaces.org/xhtml-el"
-	xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+	elementFormDefault="qualified" attributeFormDefault="unqualified"
+	xmlns:xhtml="http://richfaces.org/xhtml-el" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+	xmlns:c="http://java.sun.com/jsp/jstl/core"
 	xmlns:cc="http://java.sun.com/jsf/composite">
-	
-    <xs:import schemaLocation="web-facesuicomponent_2_0.xsd" namespace="http://java.sun.com/xml/ns/javaee" />
-    <xs:import schemaLocation="faces-composite.xsd" namespace="http://java.sun.com/jsf/composite" />
 
+	<xs:import schemaLocation="web-facesuicomponent_2_0.xsd" namespace="http://java.sun.com/xml/ns/javaee" />
+	<xs:import schemaLocation="cdk-composite.xsd" namespace="http://java.sun.com/jsf/composite" />
+	<xs:import schemaLocation="cdk-jstl-core.xsd" namespace="http://java.sun.com/jsp/jstl/core" />
+
 	<xs:simpleType name="elStrictExpression">
 		<xs:restriction base="xs:string">
 			<xs:pattern value="#\{[^\}]+\}" />
@@ -29,10 +30,6 @@
 		<xs:attribute name="passThroughWithExclusions" type="xs:NMTOKENS" />
 	</xs:attributeGroup>
 
-	<xs:attributeGroup name="testGroup">
-		<xs:attribute name="test" form="unqualified" use="required" type="elStrictExpression" />
-	</xs:attributeGroup>
-
 	<xs:element name="root">
 		<xs:complexType>
 			<xs:sequence>
@@ -50,16 +47,17 @@
 		</xs:restriction>
 	</xs:simpleType>
 
-    <xs:complexType name="resource-dependenciesComplexType">
-    	<xs:sequence minOccurs="0" maxOccurs="unbounded">
-    		<xs:element name="resource-dependency" type="resourceDependencyType" />
-    	</xs:sequence>
-    </xs:complexType>
+	<xs:complexType name="resource-dependenciesComplexType">
+		<xs:sequence minOccurs="0" maxOccurs="unbounded">
+			<xs:element name="resource-dependency" type="resourceDependencyType" />
+		</xs:sequence>
+	</xs:complexType>
 
 	<xs:complexType name="resourceDependencyType">
 		<xs:attribute name="name" use="required" form="unqualified" />
 		<xs:attribute name="library" form="unqualified" />
-		<xs:attribute name="target" form="unqualified" type="resourceDependencyTargets" />
+		<xs:attribute name="target" form="unqualified"
+			type="resourceDependencyTargets" />
 	</xs:complexType>
 
 	<xs:element name="resource-dependencies">
@@ -91,48 +89,26 @@
 					</xs:choice>
 				</xs:complexType>
 			</xs:element>
-			<xs:element ref="if" />
-			<xs:element ref="choose" />
+			<xs:element ref="c:if" />
+			<xs:element ref="c:choose" />
 			<xs:element ref="call" />
 		</xs:choice>
 	</xs:group>
 
-	<xs:element name="if">
-		<xs:complexType mixed="true">
-			<xs:choice>
-				<xs:any minOccurs="0" maxOccurs="unbounded" />
-			</xs:choice>
-			<xs:attributeGroup ref="testGroup" />
-		</xs:complexType>
-	</xs:element>
-	<xs:element name="choose">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element maxOccurs="unbounded" name="when">
-					<xs:complexType>
-						<xs:choice>
-							<xs:any minOccurs="0"
-								maxOccurs="unbounded">
-							</xs:any>
-						</xs:choice>
-						<xs:attributeGroup ref="testGroup" />
-					</xs:complexType>
-				</xs:element>
-				<xs:element minOccurs="0" name="otherwise">
-					<xs:complexType>
-						<xs:choice>
-							<xs:any minOccurs="0"
-								maxOccurs="unbounded">
-							</xs:any>
-						</xs:choice>
-					</xs:complexType>
-				</xs:element>
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
 	<xs:element name="call">
 		<xs:complexType>
 			<xs:attribute name="expression" form="unqualified" />
 		</xs:complexType>
 	</xs:element>
+	<xs:element name="object">
+		<xs:complexType mixed="true">
+			<xs:simpleContent>
+				<xs:extension base="xs:string">
+					<xs:attribute name="name" form="unqualified" use="required" />
+					<xs:attribute name="value" form="unqualified" />
+					<xs:attribute name="type" form="unqualified" />
+				</xs:extension>
+			</xs:simpleContent>
+		</xs:complexType>
+	</xs:element>
 </xs:schema>

Deleted: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/faces-composite.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/faces-composite.xsd	2009-11-11 18:14:51 UTC (rev 15863)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/faces-composite.xsd	2009-11-11 20:48:15 UTC (rev 15864)
@@ -1,247 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-
-<xs:schema targetNamespace="http://java.sun.com/jsf/composite"
-	xmlns:cc="http://java.sun.com/jsf/composite" xmlns:xs="http://www.w3.org/2001/XMLSchema"
-	xmlns:xml="http://www.w3.org/XML/1998/namespace" elementFormDefault="qualified"
-	attributeFormDefault="unqualified">
-
-	<xs:attributeGroup name="beanDescriptorAttributes">
-		<xs:attribute name="displayName">
-			<xs:annotation>
-				<xs:documentation>
-					The name to display in a tool palette containing
-					this component. The
-					value of this attribute will be set as the value
-					for this property
-					on the composite component bean descriptor.
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute name="preferred" type="xs:boolean" default="false">
-			<xs:annotation>
-				<xs:documentation>Is this a "preferred" component. The value of this
-					attribute will be set as the value for this property on the
-					composite component bean descriptor.</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute name="expert" type="xs:boolean" default="false">
-			<xs:annotation>
-				<xs:documentation>Is this component only for expert users? The value
-					of this attribute will be set as the value for this property on the
-					composite component bean descriptor.</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute name="shortDescription">
-			<xs:annotation>
-				<xs:documentation>
-					A short description of the purpose of this
-					component. The value of
-					this attribute will be set as the value for
-					this property on the
-					composite component bean descriptor.
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-	</xs:attributeGroup>
-
-	<xs:complexType name="attributeExtensionType">
-		<xs:sequence minOccurs="0" maxOccurs="unbounded">
-			<xs:choice>
-				<xs:element ref="cc:attribute" />
-				<xs:element ref="cc:extension" />
-				<xs:any processContents="lax" namespace="##other" />
-			</xs:choice>
-		</xs:sequence>
-		<xs:attribute name="name" use="required">
-			<xs:annotation>
-				<xs:documentation>
-					The name of the attribute as it must appear on the
-					composite component
-					tag in the using page. If the value of the name
-					attribute is equal
-					to (without the quotes) "action",
-					"actionListener", "validator", or
-					"valueChangeListener", the action
-					described in
-					ViewHandler.retargetMethodExpressions() must be taken
-					to handle the
-					attribute. In these cases, the method-sigature
-					attribute, if
-					present, must be ignored as its value is derived as
-					described in
-					retargetMethodExpressions().
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute name="targets">
-			<xs:annotation>
-				<xs:documentation>
-					If this element has a method-signature attribute, the value of the
-					targets attribute must be interpreted as a space (not tab)
-					separated list of client ids (relative to the top level component)
-					of components within the
-					&lt;composite:implementation&gt; section. Space is used as the delimiter
-						for compatibility with the IDREFS and NMTOKENS data types from the
-						XML Schema. Each entry in the list must be interpreted as the id
-						of an inner component to which the MethodExpression from the
-						composite component tag in the using page must be applied. If this
-						element has a method-signature attribute, but no targets
-						attribute, the value of the name attribute is used as the single
-						entry in the list. If the value of the name attribute is not one
-						of the special values listed in the description of the name
-						attribute, targets (or its derived value) need not correspond to
-						the id of an inner component.
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute name="default">
-			<xs:annotation>
-				<xs:documentation>
-					If this attribute is not required, and a value is
-					not supplied by the
-					page author, use this as the default value.
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute name="required" type="xs:boolean" default="false">
-			<xs:annotation>
-				<xs:documentation>
-					True if the page author must supply a value for
-					this attribute.
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute name="method-signature">
-			<xs:annotation>
-				<xs:documentation>
-					Declares that this attribute must be a
-					MethodExpression whose method
-					signature is described by the value of
-					this attribute. The
-					signature must be described using fully
-					qualified class names
-					wherever a type is required. This attribute is
-					mutually exclusive
-					with the "type" attribute. If both attributes are
-					present, the
-					"method-signature" attribute is ignored.
-
-					PENDING: when
-					this file is generated from the web-facesuicomponent_2_0.xsd,
-					we
-					will not need to copy the content here manually.
-
-					Provides the
-					signature of the Java method. The syntax of the
-					method-signature
-					element is as follows (taken from
-					function-signature in
-					web-jsptaglibrary_2_1.xsd):
-
-					MethodSignature ::= ReturnType S
-					MethodName S? '(' S? Parameters? S? ')'
-
-					ReturnType ::= Type
-
-					MethodName ::= Identifier
-
-					Parameters ::= Parameter | ( Parameter S?
-					',' S? Parameters )
-
-					Parameter ::= Type
-
-					Where:
-
-					Type is a basic type or
-					a fully qualified Java class name (including
-					package name), as per
-					the 'Type' production in the Java Language
-					Specification, Second
-					Edition, Chapter 18.
-
-					Identifier is a Java identifier, as per the
-					'Identifier' production in the
-					Java Language Specification, Second
-					Edition, Chapter 18.
-
-					Example:
-
-					java.lang.String nickName(java.lang.String, int)
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute name="type">
-			<xs:annotation>
-				<xs:documentation>
-					<xs:annotation name="type">
-					</xs:annotation>
-					Declares that this attribute must be a ValueExpression whose
-					expected type
-					is given by the value of this attribute. If not
-					specified, and no
-					"method-signature" attribute is present,
-					java.lang.Object is
-					assumed. This attribute is mutually exclusive
-					with the "type"
-					attribute. If both attributes are present, the
-					"method-signature"
-					attribute is ignored.
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attributeGroup ref="cc:beanDescriptorAttributes" />
-	</xs:complexType>
-
-	<xs:complexType name="compositeExtensionType">
-		<xs:sequence minOccurs="0" maxOccurs="unbounded">
-			<xs:any processContents="lax" />
-		</xs:sequence>
-	</xs:complexType>
-
-	<xs:complexType name="compositeInterfaceType">
-		<xs:sequence minOccurs="0" maxOccurs="unbounded">
-			<xs:choice>
-				<xs:any namespace="##any" processContents="lax" />
-			</xs:choice>
-		</xs:sequence>
-		<xs:attribute type="xs:string" name="name">
-			<xs:annotation>
-				<xs:documentation>
-					The name of this composite component. Advisory
-					only. The real name is
-					taken from the filename. The value of this
-					attribute will be set as
-					the value for this property on the
-					composite component bean
-					descriptor.
-				</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attribute type="xs:string" name="componentType">
-			<xs:annotation>
-				<xs:documentation>
-					The component-type of the UIComponent that will
-					serve as the composite
-					component root for this composite component.
-					The declared
-					component-family for this component must be
-					javax.faces.NamingContainer.	
-			</xs:documentation>
-			</xs:annotation>
-		</xs:attribute>
-		<xs:attributeGroup ref="cc:beanDescriptorAttributes" />
-	</xs:complexType>
-
-	<xs:complexType name="compositeImplementationType"
-		mixed="true">
-		<xs:choice>
-			<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
-		</xs:choice>
-	</xs:complexType>
-
-	<xs:element name="interface" type="cc:compositeInterfaceType" />
-	<xs:element name="implementation" type="cc:compositeImplementationType" />
-	<xs:element name="extension" type="cc:compositeExtensionType" />
-	<xs:element name="attribute" type="cc:attributeExtensionType" />
-
-</xs:schema>

Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java	2009-11-11 18:14:51 UTC (rev 15863)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java	2009-11-11 20:48:15 UTC (rev 15864)
@@ -45,7 +45,7 @@
 
     private static final String TEMPLATE_EPILOG = "</cc:implementation></cdk:root>";
     private static final String TEMPLATE_MIDDLE = "</cc:interface><cc:implementation>";
-    public static final String TEMPLATE_PROLOG = "<cdk:root xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:cdk=\"http://richfaces.org/cdk\" xmlns:cc=\"http://java.sun.com/jsf/composite\"><cc:interface>";
+    public static final String TEMPLATE_PROLOG = "<cdk:root xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:cdk=\"http://richfaces.org/cdk\" xmlns:c=\"http://java.sun.com/jsp/jstl/core\" xmlns:cc=\"http://java.sun.com/jsf/composite\"><cc:interface>";
 	private static final Object DEFAULT_ATTRIBUTE_TYPE = Object.class.getName();
 
     @Test
@@ -71,15 +71,86 @@
     }
 
     @Test
+	public void testJstlCoreElements() throws Exception {
+        Template template = unmarshal(Template.class, TEMPLATE_PROLOG
+                + TEMPLATE_MIDDLE +
+                "start" +
+                "<c:if test=\"#{someTest}\">if content</c:if>" +
+                "<c:choose>" +
+                	"<c:when test=\"#{anotherTest}\">when content</c:when>" +
+                	"<c:when test=\"#{coolTest}\">" + 
+                		"<c:if test=\"#{nestedIfTest}\">nested if content</c:if>" +
+                	"</c:when>" +
+                	"<c:otherwise>otherwise content</c:otherwise>" +
+				"</c:choose>" +
+				"finish" + 
+                TEMPLATE_EPILOG);
+	
+        CompositeImplementation implementation = template.getImplementation();
+        assertNotNull(implementation);
+        
+        List<Object> children = implementation.getChildren();
+        assertNotNull(children);
+        assertEquals(4, children.size());
+        assertEquals("start", children.get(0));
+        assertEquals(CdkIfElement.class, children.get(1).getClass());
+        CdkIfElement ifElement = (CdkIfElement) children.get(1);
+        assertEquals("#{someTest}", ifElement.getTest());
+        List<Object> ifChildren = ifElement.getChildren();
+        assertNotNull(ifChildren);
+        assertEquals(1, ifChildren.size());
+        assertEquals("if content", ifChildren.get(0));
+        
+        assertEquals(CdkChooseElement.class, children.get(2).getClass());
+        CdkChooseElement chooseElement = (CdkChooseElement) children.get(2);
+        List<Object> chooseChildren = chooseElement.getChildren();
+        assertNotNull(chooseChildren);
+        assertEquals(3, chooseChildren.size());
+
+        assertEquals(CdkWhenElement.class, chooseChildren.get(0).getClass());
+        CdkWhenElement firstWhen = (CdkWhenElement) chooseChildren.get(0);
+        assertEquals("#{anotherTest}", firstWhen.getTest());
+        List<Object> childrenOfFirstWhen = firstWhen.getChildren();
+        assertNotNull(childrenOfFirstWhen);
+        assertEquals(1, childrenOfFirstWhen.size());
+        assertEquals("when content", childrenOfFirstWhen.get(0));
+        
+        assertEquals(CdkWhenElement.class, chooseChildren.get(1).getClass());
+        CdkWhenElement secondWhen = (CdkWhenElement) chooseChildren.get(1);
+        assertEquals("#{coolTest}", secondWhen.getTest());
+
+        List<Object> childrenOfSecondWhen = secondWhen.getChildren();
+        assertNotNull(childrenOfSecondWhen);
+        assertEquals(1, childrenOfSecondWhen.size());
+
+        assertEquals(CdkIfElement.class, childrenOfSecondWhen.get(0).getClass());
+        CdkIfElement nestedIf = (CdkIfElement) childrenOfSecondWhen.get(0);
+        assertEquals("#{nestedIfTest}", nestedIf.getTest());
+        List<Object> childrenOfNestedIf = nestedIf.getChildren();
+        assertNotNull(childrenOfNestedIf);
+        assertEquals(1, childrenOfNestedIf.size());
+        assertEquals("nested if content", childrenOfNestedIf.get(0));
+        
+        assertEquals(CdkOtherwiseElement.class, chooseChildren.get(2).getClass());
+        CdkOtherwiseElement otherwiseElement = (CdkOtherwiseElement) chooseChildren.get(2);
+        List<Object> childrenOfOtherwiseElement = otherwiseElement.getChildren();
+        assertNotNull(childrenOfOtherwiseElement);
+        assertEquals(1, childrenOfOtherwiseElement.size());
+        assertEquals("otherwise content", childrenOfOtherwiseElement.get(0));
+        
+        assertEquals("finish", children.get(3));
+    }
+    
+    @Test
 	public void testInterface() throws Exception {
         Template template = unmarshal(Template.class, TEMPLATE_PROLOG + 
-        		"	<cdk:class>org.richfaces.renderkit.html.TreeRenderer</cdk:class>" +
-        		"	<cdk:superclass>org.richfaces.renderkit.TreeRendererBase</cdk:superclass>" +
-        		"	<cdk:component-family>org.richfaces.TreeFamily</cdk:component-family>" +
-        		"	<cdk:component-type>org.richfaces.Tree</cdk:component-type>" +
-        		"	<cdk:renderer-type>org.richfaces.TreeRenderer</cdk:renderer-type>" +
-        		"	<cdk:renderkit-id>RF4_XHTML</cdk:renderkit-id>" +
-        		"	<cdk:renders-children>false</cdk:renders-children>" +
+        		"<cdk:class>org.richfaces.renderkit.html.TreeRenderer</cdk:class>" +
+        		"<cdk:superclass>org.richfaces.renderkit.TreeRendererBase</cdk:superclass>" +
+        		"<cdk:component-family>org.richfaces.TreeFamily</cdk:component-family>" +
+        		"<cdk:component-type>org.richfaces.Tree</cdk:component-type>" +
+        		"<cdk:renderer-type>org.richfaces.TreeRenderer</cdk:renderer-type>" +
+        		"<cdk:renderkit-id>RF4_XHTML</cdk:renderkit-id>" +
+        		"<cdk:renders-children>false</cdk:renders-children>" +
         		TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
 		
         CompositeInterface interfaceSection = template.getInterface();
@@ -224,11 +295,11 @@
     @Test
 	public void testResourceDependencies() throws Exception {
         Template template = unmarshal(Template.class, TEMPLATE_PROLOG + 
-        		"	<cdk:resource-dependencies>" + 
-    			"		<cdk:resource-dependency name=\"jquery.js\" />" +
-    			"		<cdk:resource-dependency name=\"richfaces.css\" library=\"org.richfaces\" />" +
-    			"		<cdk:resource-dependency name=\"richfaces.js\" library=\"org.richfaces\" target=\"body\" /> " +
-    			"	</cdk:resource-dependencies> " +
+        		"<cdk:resource-dependencies>" + 
+    				"<cdk:resource-dependency name=\"jquery.js\" />" +
+    				"<cdk:resource-dependency name=\"richfaces.css\" library=\"org.richfaces\" />" +
+    				"<cdk:resource-dependency name=\"richfaces.js\" library=\"org.richfaces\" target=\"body\" /> " +
+    			"</cdk:resource-dependencies> " +
 
         		TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
 		
@@ -259,7 +330,38 @@
 		assertEquals("org.richfaces", resourceDependency.getLibrary());
 		assertEquals("body", resourceDependency.getTarget());
 	}
-    
+ 
+    @Test
+	public void testObject() throws Exception {
+        Template template = unmarshal(Template.class, TEMPLATE_PROLOG + TEMPLATE_MIDDLE +
+        		"<cdk:object name=\"rowCount\" type=\"int\" value=\"#{getRowCount(context)}\" />" + 
+        		"<cdk:object name=\"bodyExpression\" type=\"java.lang.String\">" + 
+        			"\"test expression\" +\n\"second line\"" +
+        		"</cdk:object>" + 
+
+        		TEMPLATE_EPILOG);
+        
+        CompositeImplementation implementation = template.getImplementation();
+        assertNotNull(implementation);
+        
+        List<Object> children = implementation.getChildren();
+        assertNotNull(children);
+        assertEquals(2, children.size());
+        
+        assertEquals(CdkObjectElement.class, children.get(0).getClass());
+        CdkObjectElement firstObject = (CdkObjectElement) children.get(0);
+        assertNotNull(firstObject);
+        assertEquals("rowCount", firstObject.getName());
+        assertEquals("int", firstObject.getType());
+        assertEquals("#{getRowCount(context)}", firstObject.getValue());
+        
+        assertEquals(CdkObjectElement.class, children.get(1).getClass());
+        CdkObjectElement secondObject = (CdkObjectElement) children.get(1);
+        assertNotNull(secondObject);
+        assertEquals("bodyExpression", secondObject.getName());
+        assertEquals("java.lang.String", secondObject.getType());
+        assertEquals("\"test expression\" +\n\"second line\"", secondObject.getBodyValue());
+    }
 }
 
 



More information about the richfaces-svn-commits mailing list