Author: nbelaevski
Date: 2010-01-20 20:40:04 -0500 (Wed, 20 Jan 2010)
New Revision: 16348
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClientBehavior.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/basic.template.xml
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/ELNodeConstants.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstEmptyTreeNode.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/JavaClassConfiguration.java
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/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeImplementation.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ResourceDependency.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/xmlconfig/JAXBBinding.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.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/xhtml-el.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/encode-method-preface.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/ELParserTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
Log:
https://jira.jboss.org/jira/browse/RF-7732
Minor corrections & TODOs for the rest of CDK code
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -49,7 +49,9 @@
private boolean required = false;
private boolean readOnly = false;
private boolean passThrough = false;
- private Set<EventName> eventNames = Sets.newHashSet();
+
+ //TODO nick - ordering seems to be important!
+ private Set<EventName> eventNames = Sets.newLinkedHashSet();
private List<ClassDescription> signature = Lists.newArrayList();
private Set<String> aliases = Sets.newHashSet();
private String defaultValue;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/ELNodeConstants.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/ELNodeConstants.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/ELNodeConstants.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -52,7 +52,6 @@
public static final String DOUBLE_VALUE_OF_FUNCTION = "Double.valueOf";
public static final String EXCLAMATION_MARK = "!";
public static final String GET_FUNCTION = "get";
- public static final String GET_UTILS_FUNCTION = "getUtils";
public static final String LEFT_BRACKET = "(";
public static final String LEFT_SQUARE_BRACKET = "[";
public static final String NEGATIVE = "-";
@@ -60,9 +59,9 @@
public static final String QUOTE = "\"";
public static final String RIGHT_BRACKET = ")";
public static final String RIGHT_SQUARE_BRACKET = "]";
- public static final String THIS_GET_UTILS_IS_EMPTY_FUNCTION =
"this.getUtils().isEmpty";
public static final String THIS_PREFIX = "this";
public static final String GETTER_PREFIX = "get";
+ public static final String IS_EMPTY_FUNCTION = "isEmpty";
private ELNodeConstants() {
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstEmptyTreeNode.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstEmptyTreeNode.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstEmptyTreeNode.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -47,7 +47,7 @@
public void visit(StringBuilder sb, Map<String, Type> context, ELVisitor
visitor) throws ParsingException {
visitor.setUseEmptinessCheck(true);
- sb.append(ELNodeConstants.THIS_GET_UTILS_IS_EMPTY_FUNCTION);
+ sb.append(ELNodeConstants.IS_EMPTY_FUNCTION);
sb.append(ELNodeConstants.LEFT_BRACKET);
String childOutput = getChildOutput(0, context, visitor);
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/JavaClassConfiguration.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/JavaClassConfiguration.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/JavaClassConfiguration.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -23,19 +23,20 @@
package org.richfaces.cdk.templatecompiler;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.richfaces.cdk.CdkContext;
+
import freemarker.ext.beans.BeanModel;
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
-import org.richfaces.cdk.CdkContext;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* <p class="changed_added_4_0"></p>
*
@@ -80,7 +81,6 @@
rootMap.put("componentVariable",
RendererClassVisitor.COMPONENT_VARIABLE);
rootMap.put("responseWriterVariable",
RendererClassVisitor.RESPONSE_WRITER_VARIABLE);
rootMap.put("clientIdVariable",
RendererClassVisitor.CLIENT_ID_VARIABLE);
- rootMap.put("rendererUtilsVariable",
RendererClassVisitor.RENDERER_UTILS_VARIABLE);
t.process(rootMap, writer);
}
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 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -109,18 +109,12 @@
*
*/
static final String CLIENT_ID_VARIABLE = "clientId";
- /**
- *
- */
- static final String RENDERER_UTILS_VARIABLE = "utils";
/**
*
*/
private static final String PASS_THROUGH_ATTRIBUTES_FIELD_NAME =
"PASS_THROUGH_ATTRIBUTES";
- private static final String RENDERER_UTILS_CLASS_NAME =
"org.ajax4jsf.renderkit.RendererUtils";
-
private static final Logger LOG = LoggerFactory.getLogger();
private static final String XHTML_EL_NAMESPACE =
"http://richfaces.org/cdk/xhtml-el";
@@ -152,6 +146,7 @@
this.compositeInterface = compositeInterface;
this.classLoader = classLoader;
+ //TODO - cache unmarshalled data
SchemaSet schemaSet =
jaxbBinding.unmarshal("urn:attributes:xhtml-el.xml", null, SchemaSet.class);
this.attributesSchema = schemaSet.getSchemas().get(XHTML_EL_NAMESPACE);
}
@@ -164,7 +159,6 @@
this.generatedClass.addImport(FacesContext.class);
this.generatedClass.addImport(ResponseWriter.class);
this.generatedClass.addImport(UIComponent.class);
- this.generatedClass.addImport(RENDERER_UTILS_CLASS_NAME);
this.generatedClass.addAnnotation(Generated.class, "\"RichFaces
CDK\"");
// TODO remove this after improving Java model
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -24,6 +24,13 @@
package org.richfaces.cdk.templatecompiler;
import java.io.File;
+import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.richfaces.cdk.CdkContext;
import org.richfaces.cdk.CdkException;
@@ -31,12 +38,19 @@
import org.richfaces.cdk.StandardSources;
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
+import org.richfaces.cdk.templatecompiler.model.Attribute;
+import org.richfaces.cdk.templatecompiler.model.ClientBehavior;
import org.richfaces.cdk.templatecompiler.model.CompositeInterface;
import org.richfaces.cdk.templatecompiler.model.Template;
import org.richfaces.cdk.xmlconfig.JAXBBinding;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
/**
* <p class="changed_added_4_0">
* </p>
@@ -44,9 +58,63 @@
* @author asmirnov(a)exadel.com
*/
public class RendererTemplateParser implements ModelBuilder {
+
+ private static final Pattern PARAMETERS_STRING_PATTERN = Pattern.compile("\\( (
[^\\)]* ) \\) \\s*$",
+ Pattern.COMMENTS);
+
+ private static final Pattern COMMA_SEPARATED_PATTERN =
Pattern.compile("\\s*,\\s*", Pattern.COMMENTS);
+
private CdkContext context;
+
private JAXBBinding jaxbBinding;
+ private Set<EventName> convert(Collection<ClientBehavior>
clientBehaviors) {
+ if (clientBehaviors == null || clientBehaviors.isEmpty()) {
+ return null;
+ }
+
+ Set<EventName> result = Sets.newLinkedHashSet();
+
+ if (clientBehaviors != null) {
+ for (ClientBehavior clientBehavior : clientBehaviors) {
+ EventName eventName = new EventName();
+ eventName.setName(clientBehavior.getEvent());
+ eventName.setDefaultEvent(clientBehavior.isDefaultEvent());
+ result.add(eventName);
+ }
+ }
+
+ return result;
+ }
+
+ private List<ClassDescription> parseSignature(String signatureString) {
+ if (signatureString == null || signatureString.trim().length() == 0) {
+ return null;
+ }
+
+ List<ClassDescription> result = Lists.newArrayList();
+
+ if (signatureString != null) {
+ Matcher parametersStringMatcher =
PARAMETERS_STRING_PATTERN.matcher(signatureString);
+ if (!parametersStringMatcher.find()) {
+ // TODO - handle exception
+ throw new IllegalArgumentException(MessageFormat.format("Signature
string {0} cannot be parsed!",
+ signatureString));
+ }
+
+ String parametersString = parametersStringMatcher.group(1).trim();
+ if (parametersString.length() != 0) {
+ String[] parameters = COMMA_SEPARATED_PATTERN.split(parametersString);
+ for (String parameter : parameters) {
+ String trimmedParameter = parameter.trim();
+ result.add(new ClassDescription(trimmedParameter));
+ }
+ }
+ }
+
+ return result;
+ }
+
/*
* (non-Javadoc)
*
@@ -54,35 +122,83 @@
*/
@Override
public void build() throws CdkException {
- ComponentLibrary library = context.getLibrary();
-
Iterable<File> sources =
getContext().getSources(StandardSources.RENDERER_TEMPLATES);
if (null != sources) {
for (File file : sources) {
Template template = parseTemplate(file);
- CompositeInterface compositeInterface = template.getInterface();
- // TODO - infer values ?
- RenderKitModel renderKit =
library.addRenderKit(compositeInterface.getRenderKitId());
- RendererModel renderer =
- new RendererModel(new
RendererModel.Type(compositeInterface.getRendererType()));
- renderKit.getRenderers().add(renderer);
- String componentType = compositeInterface.getComponentType();
+ mergeTemplateIntoModel(template);
+ }
+ }
+ }
- // component.getRenderers().add(renderer);
+ protected void mergeTemplateIntoModel(Template template) throws CdkException {
+ ComponentLibrary library = context.getLibrary();
+ CompositeInterface compositeInterface = template.getInterface();
+ // TODO - infer values ?
+ RenderKitModel renderKit =
library.addRenderKit(compositeInterface.getRenderKitId());
+ RendererModel renderer = new RendererModel(new
RendererModel.Type(compositeInterface.getRendererType()));
+ renderKit.getRenderers().add(renderer);
+ String componentType = compositeInterface.getComponentType();
- String family = compositeInterface.getComponentFamily();
+ // component.getRenderers().add(renderer);
- if (null != family) {
- renderer.setFamily(family);
+ String family = compositeInterface.getComponentFamily();
+
+ if (null != family) {
+ renderer.setFamily(family);
+ }
+
+ renderer.setRendererClass(new
ClassDescription(compositeInterface.getJavaClass()));
+ renderer.setTemplate(template);
+
+ Map<String, Property> rendererAttributes = renderer.getAttributes();
+
+ List<Attribute> templateAttributes = compositeInterface.getAttributes();
+ if (templateAttributes != null) {
+ for (Attribute templateAttribute : templateAttributes) {
+ Property rendererProperty = new Property();
+ rendererProperty.setDefaultValue(templateAttribute.getDefaultValue());
+
+ // TODO is it the right one?
+
rendererProperty.setDescription(templateAttribute.getShortDescription());
+ rendererProperty.setDisplayname(templateAttribute.getDisplayName());
+
+ Set<EventName> eventNamesSet =
convert(templateAttribute.getClientBehaviors());
+ if (eventNamesSet != null) {
+ rendererProperty.getEventNames().addAll(eventNamesSet);
}
- renderer.setRendererClass(new
ClassDescription(compositeInterface.getJavaClass()));
- renderer.setTemplate(template);
+ // rendererProperty.setAliases(aliases)
+ // rendererProperty.setExtension(extension)
+ // rendererProperty.setGenerate(exists)
+ // rendererProperty.setHidden(hidden)
+ // rendererProperty.setIcon(icon)
+ // rendererProperty.setLiteral(literal)
+ // rendererProperty.setPassThrough(passThrough)
+ // rendererProperty.setReadOnly(readOnly)
+ // rendererProperty.setSuggestedValue(suggestedValue)
+
+ rendererProperty.setRequired(templateAttribute.isRequired());
+
+ List<ClassDescription> parsedSignature =
parseSignature(templateAttribute.getMethodSignature());
+ if (parsedSignature != null) {
+ rendererProperty.getSignature().addAll(parsedSignature);
+ }
+
+ String templateAttributeType = templateAttribute.getType();
+ if (templateAttributeType != null) {
+ rendererProperty.setType(new
ClassDescription(templateAttributeType));
+ }
+
+ rendererAttributes.put(templateAttribute.getName(), rendererProperty);
}
-
}
}
+ protected Template parseTemplate(String templateLocation) throws CdkException {
+ return jaxbBinding.unmarshal(templateLocation,
"http://richfaces.org/cdk/cdk-template.xsd", Template.class);
+ }
+
protected Template parseTemplate(File file) throws CdkException {
return jaxbBinding.unmarshal(file,
"http://richfaces.org/cdk/cdk-template.xsd", Template.class);
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -23,16 +23,17 @@
package org.richfaces.cdk.templatecompiler.model;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+
/**
* <p class="changed_added_4_0"></p>
*
* @author asmirnov(a)exadel.com
*/
-@XmlType(name = "uicomponent-attributeType", namespace =
Template.COMPOSITE_NAMESPACE)
public class Attribute implements Serializable {
private static final long serialVersionUID = -8183353368681247171L;
@@ -67,6 +68,9 @@
@XmlAttribute
private String type = Object.class.getName();
+ @XmlElement(name = "clientBehavior", namespace =
Template.COMPOSITE_NAMESPACE)
+ private List<ClientBehavior> clientBehaviors;
+
/**
* <p class="changed_added_4_0"></p>
*
@@ -247,4 +251,22 @@
public void setType(String type) {
this.type = type;
}
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the clientBehaviors
+ */
+ public List<ClientBehavior> getClientBehaviors() {
+ return clientBehaviors;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param clientBehaviors the clientBehaviors to set
+ */
+ public void setClientBehaviors(List<ClientBehavior> clientBehaviors) {
+ this.clientBehaviors = clientBehaviors;
+ }
}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClientBehavior.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClientBehavior.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClientBehavior.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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
+ *
+ */
+public class ClientBehavior {
+
+ @XmlAttribute
+ private String event;
+
+ @XmlAttribute(name = "default")
+ private boolean defaultEvent;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the event
+ */
+ public String getEvent() {
+ return event;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param event the event to set
+ */
+ public void setEvent(String event) {
+ this.event = event;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the default
+ */
+ public boolean isDefaultEvent() {
+ return defaultEvent;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param default the default to set
+ */
+ public void setDefaultEvent(boolean defaultEvent) {
+ this.defaultEvent = defaultEvent;
+ }
+}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeImplementation.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeImplementation.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeImplementation.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -23,15 +23,16 @@
package org.richfaces.cdk.templatecompiler.model;
-import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
+import javax.xml.bind.annotation.XmlRootElement;
+
/**
* <p class="changed_added_4_0"></p>
*
* @author asmirnov(a)exadel.com
*/
-@XmlType(name = "ImplementationType", namespace =
Template.COMPOSITE_NAMESPACE)
+@XmlRootElement(name = "implementation", namespace =
Template.COMPOSITE_NAMESPACE)
public class CompositeImplementation extends ModelFragment implements Serializable {
private static final long serialVersionUID = -3046226976516170979L;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -23,19 +23,20 @@
package org.richfaces.cdk.templatecompiler.model;
+import java.io.Serializable;
+import java.util.List;
+
import javax.faces.render.RenderKitFactory;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlType;
-import java.util.List;
-import java.io.Serializable;
+import javax.xml.bind.annotation.XmlRootElement;
/**
* <p class="changed_added_4_0"></p>
*
* @author asmirnov(a)exadel.com
*/
-@XmlType(name = "InterfaceType", namespace = Template.COMPOSITE_NAMESPACE)
+@XmlRootElement(name = "interface", namespace = Template.COMPOSITE_NAMESPACE)
public class CompositeInterface implements Serializable {
private static final long serialVersionUID = -5578359507253872500L;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ResourceDependency.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ResourceDependency.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ResourceDependency.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -21,16 +21,17 @@
*/
package org.richfaces.cdk.templatecompiler.model;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
+import java.io.Serializable;
import java.text.MessageFormat;
-import java.io.Serializable;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
/**
* @author Nick Belaevski
* @since 4.0
*/
-@XmlType(name = "resourceDependencyType", namespace = Template.CDK_NAMESPACE)
+@XmlRootElement(name = "resourceDependency", namespace =
Template.CDK_NAMESPACE)
public class ResourceDependency implements Serializable {
private static final long serialVersionUID = -7513798674871079584L;
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 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Template.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -33,6 +33,7 @@
* @author asmirnov(a)exadel.com
*/
@XmlRootElement(name = "root", namespace = Template.CDK_NAMESPACE)
+//TODO add support for attribute files imports
public class Template implements Serializable {
public static final String JSTL_CORE_NAMESPACE =
"http://richfaces.org/cdk/jstl/core";
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -121,6 +121,7 @@
}
@SuppressWarnings("unchecked")
+ //TODO nick - schemaLocation is unused
public <T> T unmarshal(String schemaLocation, Class<T> bindClass,
InputSource inputSource) throws CdkException {
T unmarshal = null;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -138,7 +138,7 @@
*/
public static class PropertyExtension extends ConfigExtension {
private boolean passThrough = false;
- private Set<EventName> eventNames = Sets.newHashSet();
+ private Set<EventName> eventNames = Sets.newLinkedHashSet();
private List<ClassDescription> signature = Lists.newArrayList();
private Set<String> aliases = Sets.newHashSet();
private boolean generate;
Modified:
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-composite.xsd 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd 2010-01-21
01:40:04 UTC (rev 16348)
@@ -81,6 +81,7 @@
<xs:choice>
<xs:element ref="cc:attribute" />
<xs:element ref="cc:extension" />
+ <xs:element ref="cc:clientBehavior" />
<xs:any processContents="lax" namespace="##other" />
</xs:choice>
</xs:sequence>
@@ -205,8 +206,6 @@
<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
@@ -224,6 +223,24 @@
<xs:attributeGroup ref="cc:beanDescriptorAttributes" />
</xs:complexType>
+ <xs:complexType name="clientBehaviorExtensionType">
+ <xs:attribute name="event">
+ <xs:annotation>
+ <xs:documentation>
+ Names of the logical event supported by the component
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="default" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Boolean attribute defining whether the specified logical event is the default
component event
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
<xs:complexType name="compositeExtensionType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax" />
@@ -275,5 +292,6 @@
<xs:element name="implementation"
type="cc:compositeImplementationType" />
<xs:element name="extension" type="cc:compositeExtensionType"
/>
<xs:element name="attribute" type="cc:attributeExtensionType"
/>
+ <xs:element name="clientBehavior"
type="cc:clientBehaviorExtensionType" />
</xs:schema>
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2010-01-21
01:40:04 UTC (rev 16348)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+
<!--
JBoss, Home of Professional Open Source
Copyright ${year}, Red Hat, Inc. and individual contributors
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/encode-method-preface.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/encode-method-preface.ftl 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/encode-method-preface.ftl 2010-01-21
01:40:04 UTC (rev 16348)
@@ -1,3 +1,2 @@
ResponseWriter ${responseWriterVariable} = ${facesContextVariable}.getResponseWriter();
-String ${clientIdVariable} = ${componentVariable}.getClientId(${facesContextVariable});
-RendererUtils ${rendererUtilsVariable} = RendererUtils.getInstance();
\ No newline at end of file
+String ${clientIdVariable} = ${componentVariable}.getClientId(${facesContextVariable});
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/ELParserTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/ELParserTest.java 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/ELParserTest.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -413,7 +413,8 @@
@Test
public void testEmpty() throws Exception {
parseExpression("#{empty action.array}");
- assertEquals("this.getUtils().isEmpty(action.getArray())",
visitor.getParsedExpression());
+ assertEquals("isEmpty(action.getArray())",
visitor.getParsedExpression());
+ assertTrue(visitor.isUseEmptinessCheck());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
}
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -0,0 +1,296 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.event.ActionEvent;
+import javax.faces.render.RenderKitFactory;
+import javax.faces.validator.Validator;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.cdk.CdkContext;
+import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.CdkTestBase;
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.RenderKitModel;
+import org.richfaces.cdk.model.RendererModel;
+import org.richfaces.cdk.model.RenderKitModel.Id;
+import org.richfaces.cdk.templatecompiler.model.Template;
+
+import com.google.common.collect.Lists;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class RendererTemplateParserTest extends CdkTestBase {
+
+ private RendererTemplateParser parser;
+
+ private CdkContext cdkContext;
+
+ private RenderKitModel getDefaultRenderkitFromModel() {
+ Map<Id, RenderKitModel> renderKits =
cdkContext.getLibrary().getRenderKits();
+ assertNotNull(renderKits);
+
+ RenderKitModel renderKit = renderKits.get(new
RenderKitModel.Id(RenderKitFactory.HTML_BASIC_RENDER_KIT));
+ assertNotNull(renderKit);
+
+ return renderKit;
+ }
+
+ private RendererModel getFirstRendererFromRenderkit(RenderKitModel renderKit) {
+ Collection<RendererModel> renderers = renderKit.getRenderers();
+ assertNotNull(renderers);
+
+ Iterator<RendererModel> renderersIterator = renderers.iterator();
+ assertTrue(renderersIterator.hasNext());
+
+ RendererModel renderer = renderersIterator.next();
+ assertNotNull(renderer);
+
+ return renderer;
+ }
+
+ private void assertNoSignature(Property property) {
+ List<ClassDescription> signature = property.getSignature();
+ assertNotNull(signature);
+ assertTrue(signature.isEmpty());
+ }
+
+ private void assertNoEventNames(Property property) {
+ Set<EventName> eventNames = property.getEventNames();
+ assertNotNull(eventNames);
+ assertTrue(eventNames.isEmpty());
+ }
+
+ private void assertNoDefaultValue(Property property) {
+ assertNull(property.getDefaultValue());
+ }
+
+ private void assertNotRequired(Property property) {
+ assertFalse(property.isRequired());
+ }
+
+ /**
+ * Checks the following conditions for attribute:<br />
+ * - signature is empty<br />
+ * - There's a single "change" event name that is not a default
event<br />
+ *
+ * @param onchangeAttr
+ */
+ private void checkDummyComponentOnchange(Property onchangeAttr) {
+ assertNotNull(onchangeAttr);
+ assertNoSignature(onchangeAttr);
+
+ Set<EventName> changeEvents = onchangeAttr.getEventNames();
+ assertNotNull(changeEvents);
+
+ EventName changeEventName;
+ Iterator<EventName> changeEventsIterator = changeEvents.iterator();
+ assertTrue(changeEventsIterator.hasNext());
+
+ changeEventName = changeEventsIterator.next();
+ assertEquals("change", changeEventName.getName());
+ assertFalse(changeEventName.isDefaultEvent());
+
+ assertFalse(changeEventsIterator.hasNext());
+ }
+
+ /**
+ * Checks the following conditions for attribute:<br />
+ *
+ * - signature is empty<br />
+ * - First event name is "click" and it's not a default event<br
/>
+ * - Second event name is "action" and it is a default event<br />
+ *
+ * @param onclickAttr
+ */
+ private void checkDummyComponentOnclick(Property onclickAttr) {
+ assertNotNull(onclickAttr);
+ assertNoSignature(onclickAttr);
+
+ Set<EventName> clickEvents = onclickAttr.getEventNames();
+ assertNotNull(clickEvents);
+
+ EventName clickEventName;
+ Iterator<EventName> clickEventsIterator = clickEvents.iterator();
+ assertTrue(clickEventsIterator.hasNext());
+
+ clickEventName = clickEventsIterator.next();
+ assertEquals("click", clickEventName.getName());
+ assertFalse(clickEventName.isDefaultEvent());
+
+ assertTrue(clickEventsIterator.hasNext());
+
+ clickEventName = clickEventsIterator.next();
+ assertEquals("action", clickEventName.getName());
+ assertTrue(clickEventName.isDefaultEvent());
+
+ assertFalse(clickEventsIterator.hasNext());
+ }
+
+ /**
+ * Checks that method signature satisfies the following declaration:
<code>java.lang.String action()</code>
+ *
+ * @param actionProperty
+ */
+ private void checkDummyComponentAction(Property actionProperty) {
+ assertNotNull(actionProperty);
+ assertNoEventNames(actionProperty);
+
+ assertEquals(Lists.newArrayList(), actionProperty.getSignature());
+ }
+
+ /**
+ * Checks that method signature satisfies the following declaration:
+ * <code>void actionListener(javax.faces.event.ActionEvent)</code>
+ *
+ * @param actionListenerProperty
+ */
+ private void checkDummyComponentActionListener(Property actionListenerProperty) {
+ assertNotNull(actionListenerProperty);
+ assertNoEventNames(actionListenerProperty);
+
+ assertEquals(Lists.newArrayList(new ClassDescription(ActionEvent.class)),
actionListenerProperty.getSignature());
+ }
+
+ /**
+ * Checks that method signature satisfies the following declaration:
+ * <code>float coolMethod(int, java.lang.String,
javax.faces.validator.Validator)</code>
+ *
+ * @param actionListenerProperty
+ */
+ private void checkDummyComponentCoolMethod(Property coolMethodProperty) {
+ assertNotNull(coolMethodProperty);
+ assertNoEventNames(coolMethodProperty);
+
+ ArrayList<ClassDescription> expectedSignature = Lists.newArrayList(new
ClassDescription(int.class),
+ new ClassDescription(String.class), new ClassDescription(Validator.class));
+
+ assertEquals(expectedSignature, coolMethodProperty.getSignature());
+ }
+
+ /**
+ * @param property
+ */
+ private void checkDummyComponentIntegerAttribute(Property integerAttribute) {
+ assertNotNull(integerAttribute);
+ assertNoEventNames(integerAttribute);
+ assertNoSignature(integerAttribute);
+ assertNotRequired(integerAttribute);
+
+ assertEquals(new ClassDescription(Integer.class), integerAttribute.getType());
+ assertEquals("-1", integerAttribute.getDefaultValue());
+ }
+
+ /**
+ * @param property
+ */
+ private void checkDummyComponentRequiredAttribute(Property requiredAttribute) {
+ assertNotNull(requiredAttribute);
+ assertNoEventNames(requiredAttribute);
+ assertNoSignature(requiredAttribute);
+ assertNoDefaultValue(requiredAttribute);
+
+ assertTrue(requiredAttribute.isRequired());
+ assertEquals("That's a required attribute",
requiredAttribute.getDescription());
+ assertEquals("Required Attribute",
requiredAttribute.getDisplayname());
+ }
+
+
+
+ @Before
+ public void setUp() throws Exception {
+ parser = new RendererTemplateParser();
+ cdkContext = new CdkContextBase(createClassLoader());
+ parser.init(cdkContext);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ parser = null;
+ cdkContext = null;
+ }
+
+ @Test
+ public void basicComponentTest() throws Exception {
+ Template template =
parser.parseTemplate("urn:resource:org/richfaces/cdk/templatecompiler/basic.template.xml");
+ assertNotNull(template);
+
+ parser.mergeTemplateIntoModel(template);
+
+ RenderKitModel renderKit = getDefaultRenderkitFromModel();
+ RendererModel renderer = getFirstRendererFromRenderkit(renderKit);
+
+ assertEquals(new
ClassDescription("org.richfaces.renderkit.html.BasicRendererImpl"), renderer
+ .getRendererClass());
+ }
+
+ @Test
+ public void parserTest() throws Exception {
+ Template template =
parser.parseTemplate("urn:resource:org/richfaces/cdk/templatecompiler/dummy.template.xml");
+ assertNotNull(template);
+
+ parser.mergeTemplateIntoModel(template);
+
+ RenderKitModel renderKit = getDefaultRenderkitFromModel();
+ RendererModel renderer = getFirstRendererFromRenderkit(renderKit);
+
+ assertEquals(new
ClassDescription("org.richfaces.renderkit.html.DummyRendererImpl"), renderer
+ .getRendererClass());
+
+ assertEquals("org.richfaces.Dummy", renderer.getFamily());
+ assertSame(template, renderer.getTemplate());
+
+ Map<String, Property> attributes = renderer.getAttributes();
+ assertNotNull(attributes);
+
+ checkDummyComponentOnclick(attributes.get("onclick"));
+ checkDummyComponentOnchange(attributes.get("onchange"));
+ checkDummyComponentAction(attributes.get("action"));
+ checkDummyComponentActionListener(attributes.get("actionListener"));
+ checkDummyComponentCoolMethod(attributes.get("coolMethod"));
+
checkDummyComponentIntegerAttribute(attributes.get("integerAttribute"));
+
checkDummyComponentRequiredAttribute(attributes.get("requiredAttribute"));
+
+ assertEquals(7, attributes.size());
+ }
+
+}
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 2010-01-20
23:16:00 UTC (rev 16347)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-01-21
01:40:04 UTC (rev 16348)
@@ -191,6 +191,10 @@
"<cc:attribute name=\"id\" required=\"true\"
/>" +
"<cc:attribute name=\"experts\" shortDescription=\"For
use by experts\" displayName=\"Expert attribute\" expert=\"true\"
/>" +
"<cc:attribute name=\"preferred\"
shortDescription=\"It's a preferred attribute\" displayName=\"Preferred
attribute\" preferred=\"true\" />" +
+ "<cc:attribute name=\"onchange\">" +
+ "<cc:clientBehavior event=\"change\" />" +
+ "<cc:clientBehavior event=\"valueChange\"
default=\"true\" />" +
+ "</cc:attribute>" +
TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
CompositeInterface interfaceSection = template.getInterface();
@@ -198,7 +202,7 @@
List<Attribute> attributes = interfaceSection.getAttributes();
assertNotNull(attributes);
- assertEquals(9, attributes.size());
+ assertEquals(10, attributes.size());
Attribute attribute;
@@ -303,6 +307,26 @@
assertEquals("It's a preferred attribute",
attribute.getShortDescription());
assertEquals("Preferred attribute", attribute.getDisplayName());
assertTrue(attribute.isPreferred());
+
+ attribute = attributes.get(9);
+ assertNotNull(attribute);
+ assertEquals("onchange", attribute.getName());
+
+ List<ClientBehavior> clientBehaviors = attribute.getClientBehaviors();
+ assertNotNull(clientBehaviors);
+ assertEquals(2, clientBehaviors.size());
+
+ ClientBehavior clientBehavior;
+
+ clientBehavior = clientBehaviors.get(0);
+ assertNotNull(clientBehavior);
+ assertEquals("change", clientBehavior.getEvent());
+ assertFalse(clientBehavior.isDefaultEvent());
+
+ clientBehavior = clientBehaviors.get(1);
+ assertNotNull(clientBehavior);
+ assertEquals("valueChange", clientBehavior.getEvent());
+ assertTrue(clientBehavior.isDefaultEvent());
}
@Test
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/basic.template.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/basic.template.xml
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/basic.template.xml 2010-01-21
01:40:04 UTC (rev 16348)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://richfaces.org/cdk/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk/core"
+
xmlns:c="http://richfaces.org/cdk/jstl/core"
xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.BasicRendererImpl</cdk:class>
+ </cc:interface>
+
+ <cc:implementation />
+
+</cdk:root>
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml 2010-01-21
01:40:04 UTC (rev 16348)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://richfaces.org/cdk/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk/core"
+
xmlns:c="http://richfaces.org/cdk/jstl/core"
xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.DummyRendererImpl</cdk:class>
+ <cdk:component-family>org.richfaces.Dummy</cdk:component-family>
+
+ <cc:attribute name="onclick">
+ <cc:clientBehavior event="click" />
+ <cc:clientBehavior event="action" default="true" />
+ </cc:attribute>
+
+ <cc:attribute name="onchange">
+ <cc:clientBehavior event="change" />
+ </cc:attribute>
+
+ <cc:attribute name="action" method-signature="java.lang.String
action( )" />
+ <cc:attribute name="actionListener" method-signature=" void
actionListener( javax.faces.event.ActionEvent ) " />
+ <cc:attribute name="coolMethod" method-signature=" float coolMethod (
+ int,
+ java.lang.String , javax.faces.validator.Validator
+ ) " />
+
+ <cc:attribute name="integerAttribute" type="java.lang.Integer"
default="-1" />
+ <cc:attribute name="requiredAttribute" shortDescription="That's a
required attribute"
+ displayName="Required Attribute" required="true" />
+ </cc:interface>
+
+ <cc:implementation />
+
+</cdk:root>