Author: Alex.Kolonitsky
Date: 2010-01-22 14:22:24 -0500 (Fri, 22 Jan 2010)
New Revision: 16354
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/behavior.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/copyright.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyBehavior.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
Removed:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverterClass.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/UIBar.java
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/StandardOutputs.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/BehaviorProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/converter.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/validator.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedClass.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java
Log:
https://jira.jboss.org/jira/browse/RF-8232
Tags support - behavior class generator
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -50,6 +50,7 @@
*
* @return converter type.
*/
- public String value();
+ public String id() default "";
+ public String behaviorClass() default "";
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/StandardOutputs.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/StandardOutputs.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/StandardOutputs.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -36,6 +36,7 @@
COMPONENT_CLASSES(StandardOutputFolders.JAVA_CLASSES),
VALIDATOR_CLASSES(StandardOutputFolders.JAVA_CLASSES),
CONVERTER_CLASSES(StandardOutputFolders.JAVA_CLASSES),
+ BEHAVIOR_CLASSES(StandardOutputFolders.JAVA_CLASSES),
RENDERER_CLASSES(StandardOutputFolders.JAVA_CLASSES),
EVENT_LISTENER_CLASSES(StandardOutputFolders.JAVA_CLASSES),
EVENT_SOURCE_CLASSES(StandardOutputFolders.JAVA_CLASSES),
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/BehaviorProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/BehaviorProcessor.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/BehaviorProcessor.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -23,27 +23,33 @@
package org.richfaces.cdk.apt;
-import java.lang.annotation.Annotation;
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.annotations.JsfBehavior;
+import org.richfaces.cdk.model.BehaviorModel;
+import org.richfaces.cdk.model.ClassDescription;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
+import java.lang.annotation.Annotation;
-import org.richfaces.cdk.CdkProcessingException;
-import org.richfaces.cdk.annotations.JsfBehavior;
-
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
+(a)SupportedAnnotationTypes({"javax.faces.component.FacesComponent",
JsfBehavior.NAME})
public class BehaviorProcessor extends ProcessorBase implements CdkAnnotationProcessor {
- /* (non-Javadoc)
- * @see
org.richfaces.cdk.apt.CdkAnnotationProcessor#process(javax.lang.model.element.TypeElement)
- */
@Override
public void process(TypeElement element) throws CdkProcessingException {
- // TODO Auto-generated method stub
+ JsfBehavior behavior = element.getAnnotation(JsfBehavior.class);
+ BehaviorModel behaviorModel = new BehaviorModel(behavior.id(), new
ClassDescription(element.getQualifiedName().toString()));
+ setClassNames(element, behaviorModel, behavior);
+ setDescription(element, behaviorModel);
+
+ getLibrary().getBehaviors().add(behaviorModel);
}
@Override
@@ -51,5 +57,24 @@
return JsfBehavior.class;
}
+ // TODO remove this method
+ public static void setClassNames(TypeElement componentElement, BehaviorModel
validatorModel, JsfBehavior validator) {
+ String baseClass = componentElement.getQualifiedName().toString();
+ if (validator == null) {
+ validatorModel.setClassNames(baseClass, null);
+ return;
+ }
+ String validatorClass = validator.behaviorClass();
+ if (validatorClass == null || validatorClass.isEmpty() ||
baseClass.equals(validatorClass)) {
+ if (componentElement.getModifiers().contains(Modifier.ABSTRACT)) {
+ throw new IllegalStateException("You can't use an abstract class
as a validator. Please set the validatorClass or remove the 'abstract'
modifier.");
+ } else {
+ validatorModel.setClassNames(baseClass, null);
+ }
+ } else {
+ validatorModel.setClassNames(validatorClass, baseClass);
+ }
+ }
+
}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.generate.java;
+
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.Visitable;
+import org.richfaces.cdk.model.BehaviorModel;
+import org.richfaces.cdk.freemarker.FreeMarkerRenderer;
+import org.richfaces.cdk.CdkWriter;
+import org.richfaces.cdk.CdkContext;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.StandardOutputs;
+
+import java.io.File;
+
+/**
+ * @author akolonitsky
+ * @since Jan 21, 2010
+ */
+public class BehaviorClassGenerator extends FreeMarkerRenderer<BehaviorModel,
ComponentLibrary> implements CdkWriter {
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.CdkWriter#init(org.richfaces.cdk.CdkContext)
+ */
+ @Override
+ public void init(CdkContext context) {
+ super.init(context);
+ }
+
+ @Override
+ protected boolean isMyComponent(Visitable c) {
+ if (c instanceof BehaviorModel) {
+ return ((BehaviorModel) c).isGenerate();
+ }
+
+ return false;
+ }
+
+ @Override
+ protected String getOutputFile(BehaviorModel c) throws CdkException {
+ return c.getBehaviorClass().getName().replace('.', File.separatorChar) +
".java";
+ }
+
+ @Override
+ protected String getTemplateName() {
+ return "behavior.ftl";
+ }
+
+ @Override
+ protected CdkContext.OutputType getOutputType() {
+ return StandardOutputs.BEHAVIOR_CLASSES;
+ }
+}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -56,9 +56,7 @@
@Override
protected boolean isMyComponent(Visitable c) {
if (c instanceof ComponentModel) {
- ComponentModel component = (ComponentModel) c;
-
- return component.isGenerate();
+ return ((ComponentModel) c).isGenerate();
}
return false;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -46,9 +46,7 @@
@Override
protected boolean isMyComponent(Visitable visitable) {
if (visitable instanceof ValidatorModel) {
- ValidatorModel validator = (ValidatorModel) visitable;
-
- return validator.isGenerate();
+ return ((ValidatorModel) visitable).isGenerate();
}
return false;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -32,54 +32,83 @@
* @author asmirnov(a)exadel.com
*
*/
-@SuppressWarnings("serial")
-public class BehaviorModel implements ModelElement<BehaviorModel> {
+public class BehaviorModel extends ModelElementBase implements
ModelElement<BehaviorModel> {
- private Type type;
+ private static final long serialVersionUID = -5023589072935390357L;
+ private boolean generate = false;
+
+ private String behaviorId;
+
+ private ClassDescription behaviorClass;
+
+ private ClassDescription baseClass;
+
public BehaviorModel() {
}
- public BehaviorModel(Type type) {
- this.type = type;
+ public BehaviorModel(String behaviorId, ClassDescription behaviorClass) {
+ setBehaviorId(behaviorId);
+ setBehaviorClass(behaviorClass);
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the type
- */
- public Type getType() {
- return this.type;
+ public boolean isGenerate() {
+ return generate;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @param type the type to set
- */
- public void setType(Type type) {
- this.type = type;
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
}
- @Override
- public void merge(BehaviorModel other) {
+ public String getBehaviorId() {
+ return behaviorId;
+ }
- // TODO Auto-generated method stub
+ public void setBehaviorId(String behaviorId) {
+ this.behaviorId = behaviorId;
}
+ public ClassDescription getBehaviorClass() {
+ return behaviorClass;
+ }
+
+ public void setBehaviorClass(ClassDescription behaviorClass) {
+ this.behaviorClass = behaviorClass;
+ }
+
+ public ClassDescription getBaseClass() {
+ return baseClass;
+ }
+
+ public void setBaseClass(ClassDescription baseClass) {
+ this.baseClass = baseClass;
+ }
+
+ public void setClassNames(String validatorClass, String baseClass) {
+ this.behaviorClass = new ClassDescription(validatorClass);
+
+ if (baseClass != null) {
+ this.baseClass = new ClassDescription(baseClass);
+ this.generate = true;
+ } else {
+ this.generate = false;
+ }
+ }
+
@Override
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws
CdkException {
return visitor.visit(this, param);
}
@Override
- public boolean same(BehaviorModel other) {
- return null != getType() && getType().equals(other.getType());
+ public void merge(BehaviorModel other) {
+ ComponentLibrary.merge(this, other);
+
+ getAttributes().putAll(other.getAttributes());
}
-
- public static final class Type extends Key {
- public Type(String name) {
- super(name);
- }
+ @Override
+ public boolean same(BehaviorModel other) {
+ return null != getBehaviorId() &&
getBehaviorId().equals(other.getBehaviorId());
}
}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorAdapter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorAdapter.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorAdapter.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.xmlconfig.model;
+
+import org.richfaces.cdk.model.BehaviorModel;
+
+/**
+ * @author akolonitsky
+ * @since Jan 21, 2010
+ */
+public class BehaviorAdapter extends AdapterBase<BehaviorBean, BehaviorModel> {
+
+ @Override
+ protected Class<? extends BehaviorBean> getBeanClass(BehaviorModel model) {
+ return BehaviorBean.class;
+ }
+
+ @Override
+ protected Class<? extends BehaviorModel> getModelClass(BehaviorBean bean) {
+ return BehaviorModel.class;
+ }
+}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.xmlconfig.model;
+
+import com.google.common.collect.Lists;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.List;
+
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ConfigExtension;
+
+/**
+ * @author akolonitsky
+ * @since Jan 21, 2010
+ */
+@XmlType(name = "faces-config-behaviorType", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE,
+ propOrder={"behaviorId", "behaviorClass", "attributes",
"extension"})
+(a)XmlJavaTypeAdapter(BehaviorAdapter.class)
+public class BehaviorBean extends ExtensibleBean<BehaviorBean.BehaviorExtension> {
+
+ private String behaviorId;
+
+ private String behaviorClass;
+
+ private List<PropertyBase> attributes = Lists.newArrayList();
+
+ @XmlElement(name = "behavior-id", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getBehaviorId() {
+ return behaviorId;
+ }
+
+ public void setBehaviorId(String behaviorId) {
+ this.behaviorId = behaviorId;
+ }
+
+ @XmlElement(name = "behavior-class", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getBehaviorClass() {
+ return behaviorClass;
+ }
+
+ public void setBehaviorClass(String behaviorClass) {
+ this.behaviorClass = behaviorClass;
+ }
+
+
+ @XmlElements({
+ @XmlElement(name = "property", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class),
+ @XmlElement(name = "attribute", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
+ })
+ public List<PropertyBase> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(List<PropertyBase> property) {
+ this.attributes = property;
+ }
+
+ @Override
+ @XmlElement(name = "behavior-extension", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public BehaviorExtension getExtension() {
+ return super.getExtension();
+ }
+
+ @Override
+ public void setExtension(BehaviorExtension extension) {
+ super.setExtension(extension);
+ }
+
+ public static class BehaviorExtension extends ConfigExtension { }
+}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -38,6 +38,7 @@
import org.richfaces.cdk.model.Extensible;
import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.ValidatorModel;
+import org.richfaces.cdk.model.BehaviorModel;
import com.google.common.collect.Lists;
@@ -64,6 +65,10 @@
@XmlJavaTypeAdapter(ValidatorAdapter.class)
private List<ValidatorModel> validators = Lists.newArrayList();
+ @XmlElement(name = "behavior", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ @XmlJavaTypeAdapter(BehaviorAdapter.class)
+ private List<BehaviorModel> behaviors = Lists.newArrayList();
+
@XmlAttribute
private String version = "2.0";
@@ -159,6 +164,14 @@
this.validators = validators;
}
+ public List<BehaviorModel> getBehaviors() {
+ return behaviors;
+ }
+
+ public void setBehaviors(List<BehaviorModel> behaviors) {
+ this.behaviors = behaviors;
+ }
+
/**
* <p class="changed_added_4_0"></p>
*
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -27,7 +27,7 @@
* @author akolonitsky
* @since Jan 13, 2010
*/
-public class ValidatorAdapter extends AdapterBase<ValidatorBean, ValidatorModel>{
+public class ValidatorAdapter extends AdapterBase<ValidatorBean, ValidatorModel> {
@Override
protected Class<? extends ValidatorBean> getBeanClass(ValidatorModel model) {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -89,6 +89,5 @@
super.setExtension(extension);
}
- public static class ValidatorExtension extends ConfigExtension {
- }
+ public static class ValidatorExtension extends ConfigExtension { }
}
Added:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/behavior.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/behavior.ftl
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/behavior.ftl 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,111 @@
+<#include "copyright.ftl">
+
+package ${behaviorClass.package};
+
+import javax.annotation.Generated;
+import javax.faces.component.PartialStateHolder;
+import javax.faces.component.StateHelper;
+import javax.faces.component.behavior.Behavior;
+import javax.faces.context.FacesContext;
+import javax.faces.event.BehaviorEvent;
+
+/**
+ * ${description?if_exists}
+ **/
+@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
+public class ${behaviorClass.simpleName} extends ${baseClass} implements Behavior,
PartialStateHolder {
+
+ @Override
+ public void broadcast(BehaviorEvent event) {
+ }
+
+ protected enum Properties {
+ <#list generatedAttributes as attribute>${attribute.name}<#if
attribute_has_next>${",\n "}</#if></#list>
+ }
+
+ <#list generatedAttributes as attribute>
+ /**
+ * ${attribute.description?if_exists}
+ **/
+ public ${attribute.type} ${attribute.getterName}(){
+ return (${attribute.type})getStateHelper().eval(Properties.${attribute.name});
+ }
+
+ /**
+ * Setter for ${attribute.name}
+ **/
+ public void ${attribute.setterName}(${attribute.type} ${attribute.name}){
+ getStateHelper().put(Properties.${attribute.name},${attribute.name});
+ }
+ </#list>
+
+ protected StateHelper getStateHelper() {
+ return getStateHelper(true);
+ }
+
+ protected StateHelper getStateHelper(boolean create) {
+ return null;
+ }
+
+ // ----------------------------------------------------- StateHolder Methods
+ @Override
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (!initialStateMarked()) {
+ Object values[] = new Object[1];
+ <#list generatedAttributes as attribute>
+ values[${attribute_index}] = this.${attribute.getterName}();
+ </#list>
+
+ return values;
+ }
+ return null;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (state == null) {
+ return;
+ }
+
+ Object values[] = (Object[]) state;
+ <#list generatedAttributes as attribute>
+ ${attribute.setterName}((${attribute.type}) values[${attribute_index}]);
+ </#list>
+ }
+
+ private boolean transientValue = false;
+
+ @Override
+ public boolean isTransient() {
+ return this.transientValue;
+ }
+
+ @Override
+ public void setTransient(boolean transientValue) {
+ this.transientValue = transientValue;
+ }
+
+
+ private boolean initialState;
+
+ @Override
+ public void markInitialState() {
+ initialState = true;
+ }
+
+ @Override
+ public boolean initialStateMarked() {
+ return initialState;
+ }
+
+ @Override
+ public void clearInitialState() {
+ initialState = false;
+ }
+}
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-01-22
19:22:24 UTC (rev 16354)
@@ -3,29 +3,10 @@
<#nested item/><#if item_has_next>${delimiter}</#if>
</#list>
</#macro>
-/*
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+<#include "copyright.ftl">
+
package ${componentClass.package};
-// Import declarations
import javax.annotation.Generated;
import java.io.IOException;
import java.util.ArrayList;
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/converter.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/converter.ftl 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/converter.ftl 2010-01-22
19:22:24 UTC (rev 16354)
@@ -1,24 +1,5 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , 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.
- */
+<#include "copyright.ftl">
+
package ${converterClass.package};
import javax.annotation.Generated;
@@ -50,14 +31,14 @@
/**
* ${attribute.description?if_exists}
**/
- public ${attribute.type} ${attribute.getterName}(){
+ public ${attribute.type} ${attribute.getterName}() {
return (${attribute.type})getStateHelper().eval(Properties.${attribute.name});
}
/**
* Setter for ${attribute.name}
**/
- public void ${attribute.setterName}(${attribute.type} ${attribute.name}){
+ public void ${attribute.setterName}(${attribute.type} ${attribute.name}) {
getStateHelper().put(Properties.${attribute.name},${attribute.name});
}
</#list>
Added:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/copyright.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/copyright.ftl
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/copyright.ftl 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.
+ */
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/validator.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/validator.ftl 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/validator.ftl 2010-01-22
19:22:24 UTC (rev 16354)
@@ -1,24 +1,5 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , 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.
- */
+<#include "copyright.ftl">
+
package ${validatorClass.package};
import javax.annotation.Generated;
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.apt;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.richfaces.cdk.model.BehaviorModel;
+import org.richfaces.cdk.model.ComponentLibrary;
+
+import java.util.Collection;
+
+/**
+ * @author akolonitsky
+ * @since Jan 21, 2010
+ */
+public class BehaviorProcessorTest extends AnnotationProcessorTest {
+ private static final String BEHAVIOR_CLASS_JAVA =
"org/richfaces/cdk/test/component/MyBehavior.java";
+
+ @Test
+ public void testProcess() throws Exception {
+ ComponentLibrary library = prepareMockCompilationContext(BEHAVIOR_CLASS_JAVA);
+ Collection<BehaviorModel> behaviors = library.getBehaviors();
+
+ assertEquals(2, behaviors.size());
+
+ for (BehaviorModel model: behaviors) {
+ String id = model.getBehaviorId();
+ if (id != null && !id.isEmpty()) {
+ assertEquals("my_behavior", id);
+ }
+ }
+ }
+}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -54,7 +54,7 @@
for (ValidatorModel model: validators) {
String id = model.getValidatorId();
if (id != null && !id.isEmpty()) {
- assertEquals("my_validator", model.getValidatorId());
+ assertEquals("my_validator", id);
}
}
}
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.generate.java;
+
+import org.junit.Test;
+import org.richfaces.cdk.model.ValidatorModel;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.BehaviorModel;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.CdkContext;
+import static org.easymock.EasyMock.verify;
+
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Set;
+
+/**
+ * @author akolonitsky
+ * @since Jan 21, 2010
+ */
+public class BehaviorClassGeneratorTest extends AbstractClassGeneratorTest {
+
+ /**
+ * Test method for {@link
org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}.
+ * @throws Exception
+ */
+ @Test
+ public void testGetOutputFileBehavior() throws Exception {
+ final StringWriter output = new StringWriter();
+ BehaviorClassGenerator generator = new BehaviorClassGenerator() {
+ @Override
+ protected Writer getOutput(BehaviorModel c) throws CdkException {
+ return output;
+ }
+ };
+ CdkContext mockContext = createMockContext();
+
+ generator.init(mockContext);
+
+ BehaviorModel behavior = new BehaviorModel();
+ behavior.setBehaviorId("foo.bar");
+
behavior.setClassNames("org.richfaces.cdk.generate.java.GeneratedBehavior",
"Object");
+
+ // TODO add test with types boolean, int, Integer, String, Object
+ addAttribute(behavior, "testValue", Object.class, true);
+ addAttribute(behavior, "testFlag", Boolean.class, true);
+ Property attribute = addAttribute(behavior, "id", String.class,
false);
+
+ Set<EventName> eventNames = attribute.getEventNames();
+ eventNames.add(getEvent("id", false));
+ eventNames.add(getEvent("action", true));
+
+ ComponentLibrary library = new ComponentLibrary();
+ library.getBehaviors().add(behavior);
+ generator.visit(behavior, library);
+
+ System.out.println(output);
+ verify(mockContext);
+
+ compare(output, "GeneratedBehavior.java");
+ }
+}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -71,7 +71,7 @@
library.getComponents().add(component);
component.setGenerate(true);
component.setBaseClass(new ClassDescription(UIOutput.class));
- component.setComponentClass(new ClassDescription("foo.bar.UIBar"));
+ component.setComponentClass(new
ClassDescription("org.richfaces.cdk.generate.java.GeneratedComponent"));
Property attribute = component.addAttribute("testValue");
@@ -92,6 +92,6 @@
System.out.println(output);
verify(mockContext);
- compare(output, "UIBar.java");
+ compare(output, "GeneratedComponent.java");
}
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -26,12 +26,10 @@
import org.junit.Test;
import org.richfaces.cdk.CdkContext;
import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.Property;
-import org.richfaces.cdk.model.ValidatorModel;
import java.io.StringWriter;
import java.io.Writer;
@@ -62,7 +60,7 @@
ConverterModel converter = new ConverterModel();
converter.setConverterId("foo.bar");
-
converter.setClassNames("org.richfaces.cdk.generate.java.GeneratedConverterClass",
"Object");
+
converter.setClassNames("org.richfaces.cdk.generate.java.GeneratedConverter",
"Object");
addAttribute(converter, "testValue", Object.class, true);
// TODO test with primitiv type 'boolean'
@@ -81,6 +79,6 @@
verify(mockContext);
- // TODO - check generated file.
+ compare(output, "GeneratedConverter.java");
}
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -85,7 +85,7 @@
verify(mockContext);
- // TODO - check generated file.
+ compare(output, "GeneratedClass.java");
}
}
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.xmlconfig.testmodel;
+
+import org.junit.Test;
+import org.richfaces.cdk.model.BehaviorModel;
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.ComponentLibrary;
+
+import java.io.StringWriter;
+
+/**
+ * @author akolonitsky
+ * @since Jan 21, 2010
+ */
+public class BehaviorBeanTest extends ModelBeanTest {
+
+ @Test
+ public void testMarshal() throws Exception {
+ ComponentLibrary library = new ComponentLibrary();
+
+ BehaviorModel behaviorModel = new BehaviorModel("my_behavior", new
ClassDescription(Object.class));
+ library.getBehaviors().add(behaviorModel);
+
+ // Jaxb marshaling
+ StringWriter facesConfig = generateFacesConfig(library);
+
+ // Checks
+ checkXmlStructure(facesConfig);
+ validateXml(facesConfig);
+ }
+}
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.generate.java;
+
+import javax.annotation.Generated;
+import javax.faces.component.PartialStateHolder;
+import javax.faces.component.StateHelper;
+import javax.faces.component.behavior.Behavior;
+import javax.faces.context.FacesContext;
+import javax.faces.event.BehaviorEvent;
+
+/**
+ *
+ **/
+@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
+public class GeneratedBehavior extends Object implements Behavior, PartialStateHolder {
+
+ @Override
+ public void broadcast(BehaviorEvent event) {
+ }
+
+ protected enum Properties {
+ testValue,
+ testFlag
+ }
+
+ /**
+ *
+ **/
+ public java.lang.Object getTestValue(){
+ return (java.lang.Object)getStateHelper().eval(Properties.testValue);
+ }
+
+ /**
+ * Setter for testValue
+ **/
+ public void setTestValue(java.lang.Object testValue){
+ getStateHelper().put(Properties.testValue,testValue);
+ }
+ /**
+ *
+ **/
+ public java.lang.Boolean isTestFlag(){
+ return (java.lang.Boolean)getStateHelper().eval(Properties.testFlag);
+ }
+
+ /**
+ * Setter for testFlag
+ **/
+ public void setTestFlag(java.lang.Boolean testFlag){
+ getStateHelper().put(Properties.testFlag,testFlag);
+ }
+
+ protected StateHelper getStateHelper() {
+ return getStateHelper(true);
+ }
+
+ protected StateHelper getStateHelper(boolean create) {
+ return null;
+ }
+
+ // ----------------------------------------------------- StateHolder Methods
+ @Override
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (!initialStateMarked()) {
+ Object values[] = new Object[1];
+ values[0] = this.getTestValue();
+ values[1] = this.isTestFlag();
+
+ return values;
+ }
+ return null;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (state == null) {
+ return;
+ }
+
+ Object values[] = (Object[]) state;
+ setTestValue((java.lang.Object) values[0]);
+ setTestFlag((java.lang.Boolean) values[1]);
+ }
+
+ private boolean transientValue = false;
+
+ @Override
+ public boolean isTransient() {
+ return this.transientValue;
+ }
+
+ @Override
+ public void setTransient(boolean transientValue) {
+ this.transientValue = transientValue;
+ }
+
+
+ private boolean initialState;
+
+ @Override
+ public void markInitialState() {
+ initialState = true;
+ }
+
+ @Override
+ public boolean initialStateMarked() {
+ return initialState;
+ }
+
+ @Override
+ public void clearInitialState() {
+ initialState = false;
+ }
+}
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedClass.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedClass.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedClass.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -94,7 +94,7 @@
values[0] = this.getTestValue();
values[1] = this.isTestFlag();
- return (values);
+ return values;
}
return null;
}
Copied:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
(from rev 16344,
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/UIBar.java)
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.generate.java;
+
+import javax.annotation.Generated;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
+/**
+ *
+ **/
+@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
+public class GeneratedComponent extends javax.faces.component.UIOutput implements
ClientBehaviorHolder {
+
+
+ public static final String COMPONENT_TYPE="foo.bar";
+
+
+ private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
+ "id",
+ "action"
+
+ ));
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES; }
+
+
+ public String getDefaultEventName() {
+ return "action";
+ }
+ protected enum Properties {
+ testValue,
+ testFlag
+
+ }
+
+ /**
+ *
+ **/
+ public java.lang.Object getTestValue(){
+ return (java.lang.Object)getStateHelper().eval(Properties.testValue);
+ }
+
+ /**
+ * Setter for testValue
+ **/
+ public void setTestValue(java.lang.Object testValue){
+ getStateHelper().put(Properties.testValue,testValue);
+ }
+ /**
+ *
+ **/
+ public java.lang.Boolean isTestFlag(){
+ return (java.lang.Boolean)getStateHelper().eval(Properties.testFlag);
+ }
+
+ /**
+ * Setter for testFlag
+ **/
+ public void setTestFlag(java.lang.Boolean testFlag){
+ getStateHelper().put(Properties.testFlag,testFlag);
+ }
+
+}
Copied:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
(from rev 16344,
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverterClass.java)
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , 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.generate.java;
+
+import javax.annotation.Generated;
+import javax.faces.component.StateHelper;
+import javax.faces.component.PartialStateHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+/**
+ *
+ **/
+@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
+public class GeneratedConverter extends Object implements Converter, PartialStateHolder
{
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+ return null;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ return null;
+ }
+
+ protected enum Properties {
+ testValue,
+ testFlag
+ }
+
+ /**
+ *
+ **/
+ public java.lang.Object getTestValue() {
+ return (java.lang.Object)getStateHelper().eval(Properties.testValue);
+ }
+
+ /**
+ * Setter for testValue
+ **/
+ public void setTestValue(java.lang.Object testValue) {
+ getStateHelper().put(Properties.testValue,testValue);
+ }
+ /**
+ *
+ **/
+ public java.lang.Boolean isTestFlag() {
+ return (java.lang.Boolean)getStateHelper().eval(Properties.testFlag);
+ }
+
+ /**
+ * Setter for testFlag
+ **/
+ public void setTestFlag(java.lang.Boolean testFlag) {
+ getStateHelper().put(Properties.testFlag,testFlag);
+ }
+
+
+
+ protected StateHelper getStateHelper() {
+ return getStateHelper(true);
+ }
+
+ protected StateHelper getStateHelper(boolean create) {
+ return null;
+ }
+
+ // ----------------------------------------------------- StateHolder Methods
+ @Override
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (!initialStateMarked()) {
+ Object values[] = new Object[1];
+ values[0] = this.getTestValue();
+ values[1] = this.isTestFlag();
+
+ return values;
+ }
+ return null;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (state == null) {
+ return;
+ }
+
+ Object values[] = (Object[]) state;
+ setTestValue((java.lang.Object) values[0]);
+ setTestFlag((java.lang.Boolean) values[1]);
+ }
+
+ private boolean transientValue = false;
+
+ @Override
+ public boolean isTransient() {
+ return this.transientValue;
+ }
+
+ @Override
+ public void setTransient(boolean transientValue) {
+ this.transientValue = transientValue;
+ }
+
+
+ private boolean initialState;
+
+ @Override
+ public void markInitialState() {
+ initialState = true;
+ }
+
+ @Override
+ public boolean initialStateMarked() {
+ return initialState;
+ }
+
+ @Override
+ public void clearInitialState() {
+ initialState = false;
+ }
+}
Deleted:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverterClass.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverterClass.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverterClass.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -1,145 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , 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.generate.java;
-
-import javax.annotation.Generated;
-import javax.faces.component.StateHelper;
-import javax.faces.component.PartialStateHolder;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-
-/**
- *
- **/
-@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
-public class GeneratedConverterClass extends Object implements Converter,
PartialStateHolder {
- public Object getAsObject(FacesContext context, UIComponent component, String value)
{
- return null;
- }
-
- public String getAsString(FacesContext context, UIComponent component, Object value)
{
- return null;
- }
-
- protected enum Properties {
- testValue,
- testFlag
- }
-
- /**
- *
- **/
- public java.lang.Object getTestValue(){
- return (java.lang.Object)getStateHelper().eval(Properties.testValue);
- }
-
- /**
- * Setter for testValue
- **/
- public void setTestValue(java.lang.Object testValue){
- getStateHelper().put(Properties.testValue,testValue);
- }
- /**
- *
- **/
- public java.lang.Boolean isTestFlag() {
- return (java.lang.Boolean)getStateHelper().eval(Properties.testFlag);
- }
-
- /**
- * Setter for testFlag
- **/
- public void setTestFlag(java.lang.Boolean testFlag){
- getStateHelper().put(Properties.testFlag,testFlag);
- }
-
-
-
- protected StateHelper getStateHelper() {
- return getStateHelper(true);
- }
-
- protected StateHelper getStateHelper(boolean create) {
- return null;
- }
-
- // ----------------------------------------------------- StateHolder Methods
- @Override
- public Object saveState(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
- if (!initialStateMarked()) {
- Object values[] = new Object[1];
- values[0] = this.getTestValue();
- values[1] = this.isTestFlag();
-
- return values;
- }
- return null;
- }
-
- @Override
- public void restoreState(FacesContext context, Object state) {
- if (context == null) {
- throw new NullPointerException();
- }
- if (state == null) {
- return;
- }
-
- Object values[] = (Object[]) state;
- setTestValue((java.lang.Object) values[0]);
- setTestFlag((java.lang.Boolean) values[1]);
- }
-
- private boolean transientValue = false;
-
- @Override
- public boolean isTransient() {
- return this.transientValue;
- }
-
- @Override
- public void setTransient(boolean transientValue) {
- this.transientValue = transientValue;
- }
-
-
- private boolean initialState;
-
- @Override
- public void markInitialState() {
- initialState = true;
- }
-
- @Override
- public boolean initialStateMarked() {
- return initialState;
- }
-
- @Override
- public void clearInitialState() {
- initialState = false;
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/UIBar.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/UIBar.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/UIBar.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -1,92 +0,0 @@
-/*
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package foo.bar;
-
-// Import declarations
-import javax.annotation.Generated;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import javax.faces.context.FacesContext;
-import javax.faces.component.behavior.ClientBehaviorHolder;
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-
-/**
- *
- **/
-@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
-public class UIBar extends javax.faces.component.UIOutput implements ClientBehaviorHolder
{
-
-
- public static final String COMPONENT_TYPE="foo.bar";
-
-
- private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
- "id",
- "action"
-
- ));
- public Collection<String> getEventNames() {
- return EVENT_NAMES; }
-
-
- public String getDefaultEventName() {
- return "action";
- }
- protected enum Properties {
- testValue,
- testFlag
-
- }
-
- /**
- *
- **/
- public java.lang.Object getTestValue(){
- return (java.lang.Object)getStateHelper().eval(Properties.testValue);
- }
-
- /**
- * Setter for testValue
- **/
- public void setTestValue(java.lang.Object testValue){
- getStateHelper().put(Properties.testValue,testValue);
- }
- /**
- *
- **/
- public java.lang.Boolean isTestFlag(){
- return (java.lang.Boolean)getStateHelper().eval(Properties.testFlag);
- }
-
- /**
- * Setter for testFlag
- **/
- public void setTestFlag(java.lang.Boolean testFlag){
- getStateHelper().put(Properties.testFlag,testFlag);
- }
-
-}
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyBehavior.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyBehavior.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyBehavior.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,49 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.test.component;
+
+import org.richfaces.cdk.annotations.JsfConverter;
+import org.richfaces.cdk.annotations.JsfBehavior;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.Behavior;
+import javax.faces.convert.Converter;
+import javax.faces.event.BehaviorEvent;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+@JsfBehavior(id = "my_behavior")
+public class MyBehavior implements Behavior {
+
+ @Override
+ public void broadcast(BehaviorEvent event) { }
+}
+
+@JsfBehavior
+class MyBehavior04 implements Behavior {
+
+ @Override
+ public void broadcast(BehaviorEvent event) { }
+}
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java 2010-01-22
12:44:51 UTC (rev 16353)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java 2010-01-22
19:22:24 UTC (rev 16354)
@@ -25,13 +25,14 @@
import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;
+import javax.faces.convert.Converter;
/**
* @author akolonitsky
* @since Jan 14, 2010
*/
@JsfConverter(id = "my_converter", forClass = Integer.class)
-public class MyConverter implements javax.faces.convert.Converter{
+public class MyConverter implements Converter {
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
@@ -45,7 +46,7 @@
}
@JsfConverter(forClass = Integer.class)
-class MyConverter01 implements javax.faces.convert.Converter{
+class MyConverter01 implements Converter{
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
@@ -59,7 +60,7 @@
}
@JsfConverter(id = "my_converter_02")
-class MyConverter02 implements javax.faces.convert.Converter{
+class MyConverter02 implements Converter{
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
@@ -73,7 +74,7 @@
}
@JsfConverter
-class MyConverter03 implements javax.faces.convert.Converter{
+class MyConverter03 implements Converter{
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-01-22
19:22:24 UTC (rev 16354)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
+<faces-config version="2.0" metadata-complete="false"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:cdk="http://richfaces.org/cdk/extensions"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <behavior>
+ <behavior-id>my_behavior</behavior-id>
+ <behavior-class>java.lang.Object</behavior-class>
+ <behavior-extension/>
+ </behavior>
+ <faces-config-extension/>
+</faces-config>