Author: alexsmirnov
Date: 2009-08-25 21:13:23 -0400 (Tue, 25 Aug 2009)
New Revision: 15306
Added:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Behavior.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetBean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/UITestCommand.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/parent.xml
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.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/model/Component.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Extensible.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Facet.java
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/xmlconfig/CdkEntityResolver.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/ComponentAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileManagerTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/component.xml
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/include.xml
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/pom.xml
Log:
Implement and test faces.config.xml component element parser.
Added:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Behavior.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Behavior.java
(rev 0)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Behavior.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,56 @@
+/*
+ * $Id$
+ *
+ * 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.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)Retention(RetentionPolicy.CLASS)
+(a)Target(ElementType.TYPE)
+@Inherited
+public @interface Behavior {
+
+ public static final String NAME = "org.richfaces.cdk.annotations.Behavior";
+
+ /**
+ * <p class="changed_added_4_0">
+ * behavior-id with which instances of implementation class can be created b JSF
Application implementation. If this value an empty, behavior-id will be inferred from
class name.
+ * </p>
+ *
+ * @return converter type.
+ */
+ public String value() ;
+
+
+}
Property changes on:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Behavior.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -46,6 +46,7 @@
import org.richfaces.cdk.CdkContext;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.NamingConventions;
+import org.richfaces.cdk.annotations.Icon;
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.InvalidNameException;
import org.richfaces.cdk.util.PropertyUtils;
@@ -156,6 +157,10 @@
return exists;
}
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+ return element.getAnnotation(annotationType);
+ }
+
}
/**
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -24,13 +24,21 @@
package org.richfaces.cdk.apt;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
+import javax.lang.model.element.Name;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
import org.richfaces.cdk.CdkContext;
@@ -39,12 +47,14 @@
import org.richfaces.cdk.annotations.Attributes;
import org.richfaces.cdk.annotations.Component;
import org.richfaces.cdk.annotations.DisplayName;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.annotations.Generate;
import org.richfaces.cdk.annotations.Icon;
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.xmlconfig.CdkEntityResolver;
import org.richfaces.cdk.xmlconfig.FragmentParser;
/**
@@ -54,9 +64,10 @@
* @author asmirnov(a)exadel.com
*
*/
-(a)SupportedAnnotationTypes(Component.NAME)
+(a)SupportedAnnotationTypes({"javax.faces.component.FacesComponent",Component.NAME})
public class ComponentProcessor extends CdkProcessor {
+ private static final String FACES_COMPONENT =
"javax.faces.component.FacesComponent";
private final ComponentLibrary library;
private FragmentParser fragmentParser;
@@ -99,7 +110,6 @@
// Should that component be generated ?
setClassNames(componentElement, component);
setComponentProperties(componentElement, component);
- library.getComponents().add(component);
} catch (Exception e) {
// rise error and continue.
processingEnv.getMessager().printMessage(
@@ -108,7 +118,39 @@
continue;
}
}
- // TODO - process classes annotated as "FacesComponent".
+ // process classes annotated as "FacesComponent".
+ TypeElement facesComponentAnnotation =
this.processingEnv.getElementUtils().getTypeElement(FACES_COMPONENT);
+ Set<? extends TypeElement> annotatedWith =
ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(facesComponentAnnotation));
+ for (TypeElement element : annotatedWith) {
+ List<? extends AnnotationMirror> mirrors = element.getAnnotationMirrors();
+ for (AnnotationMirror mirror : mirrors) {
+ if(FACES_COMPONENT.equals(mirror.getAnnotationType().toString())){
+ Map<? extends ExecutableElement, ? extends AnnotationValue>
valuesWithDefaults =
processingEnv.getElementUtils().getElementValuesWithDefaults(mirror);
+ for (Entry<? extends ExecutableElement, ? extends AnnotationValue> valueEntry
: valuesWithDefaults.entrySet()) {
+ Name name = valueEntry.getKey().getSimpleName();
+ if("value".equals(name.toString())){
+ try {
+ Object value = valueEntry.getValue().getValue();
+ if(null!=value && value instanceof String){
+ org.richfaces.cdk.model.Component component =
library.findOrCreateComponent(value.toString());
+ ClassDescription componentClass = new ClassDescription(element
+ .getQualifiedName().toString());
+ component.setComponentClass(componentClass);
+ component.setGenerate(false);
+ setComponentProperties(element, component);
+ }
+ } catch (Exception e) {
+ // rise error and continue.
+ processingEnv.getMessager().printMessage(
+ javax.tools.Diagnostic.Kind.ERROR, e.getMessage(),
+ element);
+ continue;
+ }
+ }
+ }
+ }
+ }
+ }
return true;
}
return false;
@@ -119,12 +161,48 @@
// Component family
setComponeneFamily(componentElement, component);
setComponentDescription(componentElement, component);
+ processFacets(componentElement,component);
// TODO - process Events attribute.
// TODO - renderers, ....
// Process attributes.
processAttributes(componentElement, component);
}
+ private void processFacets(TypeElement componentElement,
+ org.richfaces.cdk.model.Component component) throws CdkException {
+ Set<BeanProperty> properties = getBeanPropertiesAnnotatedWith(
+ Facet.class, componentElement);
+ // TODO - encapsulate attribute builder into utility class.
+ for (BeanProperty beanProperty : properties) {
+ org.richfaces.cdk.model.Facet facet = component.findOrCreateFacet(beanProperty
+ .getName());
+ // Documentation
+ facet.setDescription(beanProperty.getDocComment());
+ Icon icon = beanProperty.getAnnotation(Icon.class);
+ if (null != icon) {
+ facet.setIcon(icon.value());
+ }
+ DisplayName displayName = beanProperty
+ .getAnnotation(DisplayName.class);
+ if (null != displayName) {
+ facet.setDisplayname(displayName.value());
+ }
+ // Flags.
+ facet.setGenerate(beanProperty.isExists());
+ }
+ // TODO - @Facets annotation.
+// Face attributes = componentElement
+// .getAnnotation(Attributes.class);
+// if (null != attributes) {
+// String[] includes = attributes.value();
+// for (String attributesConfig : includes) {
+// // process additional properties.
+// component.getAttributes().addAll(fragmentParser.parseProperties(attributesConfig));
+// }
+// }
+
+ }
+
private void setComponentDescription(TypeElement componentElement,
org.richfaces.cdk.model.Component component) {
// JavaDoc comments
@@ -171,14 +249,14 @@
if (null != generate) {
component.setComponentClass(new ClassDescription(generate.value()));
component.setBaseClass(baseClass);
- component.setExists(false);
+ component.setGenerate(false);
} else if (componentElement.getModifiers().contains(Modifier.ABSTRACT)) {
// Final component class will be set by validator.
component.setBaseClass(baseClass);
- component.setExists(false);
+ component.setGenerate(false);
} else {
component.setComponentClass(baseClass);
- component.setExists(true);
+ component.setGenerate(true);
}
}
@@ -192,11 +270,20 @@
.getName());
// Documentation
atribute.setDescription(beanProperty.getDocComment());
- // Id.
+ Icon icon = beanProperty.getAnnotation(Icon.class);
+ if (null != icon) {
+ atribute.setIcon(icon.value());
+ }
+ DisplayName displayName = beanProperty
+ .getAnnotation(DisplayName.class);
+ if (null != displayName) {
+ atribute.setDisplayname(displayName.value());
+ }
+ // type.
atribute.setType(new ClassDescription(beanProperty.getType()
.toString()));
// Flags.
- atribute.setExists(beanProperty.isExists());
+ atribute.setGenerate(beanProperty.isExists());
}
Attributes attributes = componentElement
.getAnnotation(Attributes.class);
@@ -208,9 +295,29 @@
}
}
// TODO - Process standard information for parent classes
+ List<? extends TypeMirror> interfaces = componentElement.getInterfaces();
+ for (TypeMirror interfaceMirror : interfaces) {
+ processTypeProperties(component,interfaceMirror);
+ }
+ processTypeProperties(component,componentElement.getSuperclass());
// and interfaces.
}
+ private void processTypeProperties(
+ org.richfaces.cdk.model.Component component,
+ TypeMirror interfaceMirror) {
+ String name = interfaceMirror.toString();
+ try{
+ component.getAttributes().addAll(fragmentParser.parseProperties(CdkEntityResolver.URN_ATTRIBUTES+name+".xml"));
+ } catch(CdkException e){
+ // TODO - log errors ?
+ }
+ List<? extends TypeMirror> supertypes =
processingEnv.getTypeUtils().directSupertypes(interfaceMirror);
+ for (TypeMirror supertype : supertypes) {
+ processTypeProperties(component, supertype);
+ }
+ }
+
public ComponentLibrary getLibrary() {
return library;
}
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 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -57,7 +57,7 @@
protected boolean isMyComponent(Visitable c) {
if (c instanceof Component) {
Component component = (Component) c;
- return !component.isExists();
+ return !component.isGenerate();
}
return false;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -28,7 +28,7 @@
@SuppressWarnings("serial")
@XmlType(name="faces-config-componentType")
@XmlAccessorType( XmlAccessType.NONE )
-public final class Component implements ModelElement<Component,Component.Type>,
DescriptionGroup,Extensible<ConfigExtension> {
+public final class Component implements ModelElement<Component,Component.Type>,
DescriptionGroup,Extensible {
/**
@@ -78,7 +78,7 @@
/**
* <p class="changed_added_4_0">Is that component c</p>
*/
- private boolean exists = true;
+ private boolean generate = true;
/**
* <p class="changed_added_4_0">
@@ -102,7 +102,7 @@
@Override
public Facet create(Name key) {
- return new Facet(key.getType());
+ return new Facet(key);
}
};
@@ -295,19 +295,19 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the exists
+ * @return the generate
*/
@Merge
- public boolean isExists() {
- return exists;
+ public boolean isGenerate() {
+ return generate;
}
/**
* <p class="changed_added_4_0"></p>
- * @param exists the exists to set
+ * @param generate the generate to set
*/
- public void setExists(boolean exists) {
- this.exists = exists;
+ public void setGenerate(boolean exists) {
+ this.generate = exists;
}
/**
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,113 @@
+/*
+ * $Id$
+ *
+ * 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.model;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+@SuppressWarnings("serial")
+public class EventName implements Serializable {
+
+ private String name;
+
+ private boolean defaultEvent = false;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the name
+ */
+ @XmlValue
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the defaultEvent
+ */
+ @XmlAttribute(name="default")
+ public boolean isDefaultEvent() {
+ return defaultEvent;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param defaultEvent the defaultEvent to set
+ */
+ public void setDefaultEvent(boolean defaultEvent) {
+ this.defaultEvent = defaultEvent;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EventName other = (EventName) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Extensible.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Extensible.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Extensible.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -36,6 +36,6 @@
*/
public E getExtension();
-// public void setExtension(E ext);
+ public void setExtension(E ext);
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Facet.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Facet.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Facet.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -29,7 +29,7 @@
*
*/
@SuppressWarnings("serial")
-public class Facet implements ModelElement<Facet,Facet.Name>{
+public class Facet implements
ModelElement<Facet,Facet.Name>,DescriptionGroup,Extensible<ConfigExtension>{
public static final class Name extends Key {
@@ -42,14 +42,28 @@
private String description;
+ private String displayname;
+ private String icon;
+
+ private ConfigExtension extension;
+
+ private boolean generate;
/**
* <p class="changed_added_4_0"></p>
* @param name
*/
- public Facet(String name) {
- this.name = new Name(name);
+ public Facet(Name name) {
+ this.name = name;
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the name
+ */
+ public Name getName() {
+ return name;
+ }
+
@Override
public Name getKey() {
return name;
@@ -73,12 +87,68 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the name
+ * @return the displayname
*/
- public Name getName() {
- return name;
+ public String getDisplayname() {
+ return displayname;
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param displayname the displayname to set
+ */
+ public void setDisplayname(String displayname) {
+ this.displayname = displayname;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the icon
+ */
+ public String getIcon() {
+ return icon;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param icon the icon to set
+ */
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the generate
+ */
+ public boolean isGenerate() {
+ return generate;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param generate the generate to set
+ */
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the extension
+ */
+ public ConfigExtension getExtension() {
+ return extension;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param extension the extension to set
+ */
+ public void setExtension(ConfigExtension extension) {
+ this.extension = extension;
+ }
+
@Override
public void merge(Facet other) {
ComponentLibrary.merge(this, other);
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 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -21,15 +21,19 @@
package org.richfaces.cdk.model;
+import java.util.List;
import java.util.Set;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
/**
* That class represents JSF component property.
* @author asmirnov(a)exadel.com
*
*/
@SuppressWarnings("serial")
-public class Property implements DescriptionGroup,
ModelElement<Property,Property.Name> {
+public class Property implements DescriptionGroup,
ModelElement<Property,Property.Name>, Extensible {
public static final class Name extends Key {
@@ -64,24 +68,30 @@
/**
- * <p class="changed_added_4_0">Is that bean property exists in the
class or should be generated ?</p>
+ * <p class="changed_added_4_0">Is that bean property generate in the
class or should be generated ?</p>
*/
- private boolean exists;
+ private boolean generate=false;
- private boolean hidden;
+ private boolean hidden=false;
- private boolean elExpression;
+ private boolean literal=false;
+
+ private boolean required=false;
- private String dafaultValue;
+ private String defaultValue;
private String suggestedValue;
private boolean passThrough=false;
-
- private boolean defaultBehavior=false;
- private Set<String> behaviorNames;
+ private Set<EventName> eventNames = Sets.newHashSet();
+ private List<ClassDescription> signature = Lists.newArrayList();
+
+ private Set<String> aliases = Sets.newHashSet();
+
+ private ConfigExtension extension;
+
/**
* <p class="changed_added_4_0"></p>
* @param name
@@ -178,19 +188,19 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the dafaultValue
+ * @return the defaultValue
*/
@Merge
- public String getDafaultValue() {
- return dafaultValue;
+ public String getDefaultValue() {
+ return defaultValue;
}
/**
* <p class="changed_added_4_0"></p>
- * @param dafaultValue the dafaultValue to set
+ * @param defaultValue the defaultValue to set
*/
- public void setDafaultValue(String dafaultValue) {
- this.dafaultValue = dafaultValue;
+ public void setDefaultValue(String dafaultValue) {
+ this.defaultValue = dafaultValue;
}
/**
@@ -212,22 +222,166 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the exists
+ * @return the generate
*/
@Merge
- public boolean isExists() {
- return exists;
+ public boolean isGenerate() {
+ return generate;
}
/**
* <p class="changed_added_4_0"></p>
- * @param exists the exists to set
+ * @param generate the generate to set
*/
- public void setExists(boolean exists) {
- this.exists = exists;
+ public void setGenerate(boolean exists) {
+ this.generate = exists;
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the eventNames
+ */
+ public Set<EventName> getEventNames() {
+ return eventNames;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param eventNames the eventNames to set
+ */
+ public void setEventNames(Set<EventName> eventNames) {
+ this.eventNames = eventNames;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the hidden
+ */
+ public boolean isHidden() {
+ return hidden;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param hidden the hidden to set
+ */
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the literal
+ */
+ public boolean isLiteral() {
+ return literal;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param literal the literal to set
+ */
+ public void setLiteral(boolean literal) {
+ this.literal = literal;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the required
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param required the required to set
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the passThrough
+ */
+ public boolean isPassThrough() {
+ return passThrough;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param passThrough the passThrough to set
+ */
+ public void setPassThrough(boolean passThrough) {
+ this.passThrough = passThrough;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the signature
+ */
+ public List<ClassDescription> getSignature() {
+ return signature;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param signature the signature to set
+ */
+ public void setSignature(List<ClassDescription> signature) {
+ this.signature = signature;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the aliases
+ */
+ public Set<String> getAliases() {
+ return aliases;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param aliases the aliases to set
+ */
+ public void setAliases(Set<String> aliases) {
+ this.aliases = aliases;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the extension
+ */
+ public ConfigExtension getExtension() {
+ return extension;
+ }
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param extension the extension to set
+ */
+ public void setExtension(ConfigExtension extension) {
+ this.extension = extension;
+ }
+
+
@Override
public void merge(Property other) {
ComponentLibrary.merge(this, other);
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -75,15 +75,15 @@
private static final String SYSTEM_PREFIX = "/META-INF/schema/";
- private static final String URN_RESOURCE = "urn:resource:";
+ public static final String URN_RESOURCE = "urn:resource:";
private static final String RESOURCE_PREFIX = "";
- private static final String URN_CONFIG = "urn:config:";
+ public static final String URN_CONFIG = "urn:config:";
- private static final String URN_TEMPLATES = "urn:templates:";
+ public static final String URN_TEMPLATES = "urn:templates:";
- private static final String URN_ATTRIBUTES = "urn:attributes:";
+ public static final String URN_ATTRIBUTES = "urn:attributes:";
private static final String ATTRIBUTES_PREFIX = "META-INF/cdk/attributes/";
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 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -23,12 +23,19 @@
package org.richfaces.cdk.xmlconfig;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collection;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
@@ -42,7 +49,12 @@
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.ConfigExtension;
+import org.richfaces.cdk.model.Extensible;
+import org.richfaces.cdk.model.Key;
+import org.richfaces.cdk.model.ModelElement;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
@@ -110,6 +122,7 @@
spf.setFeature(
"http://apache.org/xml/features/xinclude/fixup-base-uris",
false);
+ spf.setXIncludeAware(true);
} catch (ParserConfigurationException e) {
throw new CdkException(
"parser does not support desired configuration", e);
@@ -121,28 +134,28 @@
return spf;
}
- public <T> T unmarshal(File file,
- String schemaLocation, Class<T> bindClass) throws CdkException {
+ public <T> T unmarshal(File file, String schemaLocation, Class<T>
bindClass)
+ throws CdkException {
try {
InputSource input = new InputSource(new FileInputStream(file));
T unmarshal = unmarshal(schemaLocation, bindClass, input);
return unmarshal;
} catch (FileNotFoundException e) {
- throw new CdkException("XML file not found",e);
+ throw new CdkException("XML file not found", e);
}
}
- public <T> T unmarshal(String url, String schemaLocation,
- Class<T> bindClass) throws CdkException {
+ public <T> T unmarshal(String url, String schemaLocation, Class<T>
bindClass)
+ throws CdkException {
try {
InputSource inputSource = resolver.resolveSystemId(url);
- if(null == inputSource){
+ if (null == inputSource) {
inputSource = new InputSource(url);
}
T unmarshal = unmarshal(schemaLocation, bindClass, inputSource);
return unmarshal;
} catch (FileNotFoundException e) {
- throw new CdkException("XML file not found",e);
+ throw new CdkException("XML file not found", e);
}
}
@@ -222,4 +235,182 @@
}
+ /**
+ * <p class="changed_added_4_0">
+ * This method creates adapter object and copies properties from model
+ * object to adapter.
+ * </p>
+ *
+ * @param <A>
+ * type of adapter object
+ * @param <T>
+ * type of model object.
+ * @param adapterClass
+ * adapter class.
+ * @param modelObject
+ * model object class.
+ * @return initialized instance of adapter object.
+ */
+ public static <A, T> A createAdapter(Class<A> adapterClass, T modelObject)
+ throws CdkException {
+ try {
+ A adapter = adapterClass.newInstance();
+ // Copy properties from model to adapter.
+ copyProperties(modelObject, adapter);
+ copyExtensions(modelObject, adapter, true);
+ return adapter;
+ } catch (InstantiationException e) {
+ throw new CdkException("JAXB adapter class instantiation error", e);
+ } catch (IllegalAccessException e) {
+ throw new CdkException("JAXB adapter class instantiation error", e);
+ }
+ }
+
+ public static <A, T extends ModelElement<T, K>, K extends Key> T
createModelElement(
+ Class<T> modelClass, A adapter, K key) throws CdkException {
+ try {
+ Constructor<T> constructor = modelClass.getConstructor(key
+ .getClass());
+ T modelBean = constructor.newInstance(key);
+ copyProperties(adapter, modelBean);
+ copyExtensions(adapter, modelBean, false);
+ return modelBean;
+ } catch (Exception e) {
+ throw new CdkException("CDK model class instantiation error", e);
+ }
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param <S>
+ * @param <D>
+ * @param source
+ * @param destination
+ * @param fromModel
+ * @throws CdkException
+ */
+ public static <S, D> void copyExtensions(S source, D destination,
+ boolean fromModel) throws CdkException {
+ try {
+ if (source instanceof Extensible
+ && destination instanceof Extensible) {
+ Extensible extensibleSource = (Extensible) source;
+ Extensible extensibleDestination = (Extensible) destination;
+ ConfigExtension sourceExtension = extensibleSource
+ .getExtension();
+ if (null != sourceExtension) {
+ ConfigExtension destinationExtension = createExtension(destination);
+ destinationExtension.setExtensions(sourceExtension
+ .getExtensions());
+ if (fromModel) {
+ copyProperties(source, destinationExtension);
+ } else {
+ copyProperties(sourceExtension, destination);
+ }
+ extensibleDestination.setExtension(destinationExtension);
+ } else if (fromModel) {
+ ConfigExtension destinationExtension = createExtension(destination);
+ copyProperties(source, destinationExtension);
+ extensibleDestination.setExtension(destinationExtension);
+ }
+ }
+ } catch (Exception e) {
+ throw new CdkException("Properties copiing error", e);
+ }
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param <D>
+ * @param destination
+ * @return
+ * @throws NoSuchMethodException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ */
+ private static <D> ConfigExtension createExtension(D destination)
+ throws NoSuchMethodException, InstantiationException,
+ IllegalAccessException {
+ Method method = destination.getClass().getMethod("getExtension");
+ Class<? extends ConfigExtension> destinationExtensionType = (Class<? extends
ConfigExtension>) method
+ .getReturnType();
+ ConfigExtension destinationExtension = destinationExtensionType
+ .newInstance();
+ return destinationExtension;
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param <S>
+ * @param <D>
+ * @param source
+ * @param destination
+ * @throws CdkException
+ */
+ public static <S, D> void copyProperties(S source, D destination)
+ throws CdkException {
+ try {
+ PropertyDescriptor[] targetProperties = Introspector.getBeanInfo(
+ destination.getClass()).getPropertyDescriptors();
+ PropertyDescriptor[] sourceProperties = Introspector.getBeanInfo(
+ source.getClass()).getPropertyDescriptors();
+ for (PropertyDescriptor targetProperty : targetProperties) {
+ Method writeMethod = targetProperty.getWriteMethod();
+ String name = targetProperty.getName();
+ for (PropertyDescriptor sourceProperty : sourceProperties) {
+ Method readMethod = sourceProperty.getReadMethod();
+ if (name.equals(sourceProperty.getName())
+ && null != readMethod) {
+ Class<?> targetType = targetProperty.getPropertyType();
+ Class<?> sourceType = sourceProperty.getPropertyType();
+ Object propertyValue = readMethod.invoke(source);
+ if (null != propertyValue) {
+ if (null != writeMethod) {
+ if (targetType.isAssignableFrom(sourceType)) {
+ writeMethod.invoke(destination,
+ propertyValue);
+ } else if (targetType.equals(String.class)) {
+ writeMethod.invoke(destination,
+ propertyValue.toString());
+ } else if (isCollections(targetType, propertyValue)) {
+ Collection targetCollection = (Collection) targetProperty
+ .getReadMethod()
+ .invoke(destination);
+ if (null != targetCollection) {
+ targetCollection
+ .addAll((Collection) propertyValue);
+ } else {
+ writeMethod.invoke(destination,
+ propertyValue);
+ }
+ }
+ } else if (isCollections(targetType, propertyValue)) {
+ Collection targetCollection = (Collection) targetProperty
+ .getReadMethod().invoke(destination);
+ if (null != targetCollection) {
+ targetCollection
+ .addAll((Collection) propertyValue);
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw new CdkException("Properties copiing error", e);
+ }
+ }
+
+ private static boolean isCollections(Class<?> targetType, Object propertyValue) {
+ return Collection.class
+ .isAssignableFrom(targetType)
+ && propertyValue instanceof Collection;
+ }
+
}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,49 @@
+/*
+ * $Id$
+ *
+ * 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.xmlconfig.model;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.richfaces.cdk.model.ClassDescription;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class ClassAdapter extends XmlAdapter<ClassBean, ClassDescription> {
+
+ @Override
+ public ClassBean marshal(ClassDescription v) throws Exception {
+ ClassBean bean = new ClassBean();
+ bean.setName(v.getName());
+ return bean;
+ }
+
+ @Override
+ public ClassDescription unmarshal(ClassBean v) throws Exception {
+ return new ClassDescription(v.getName());
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassBean.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassBean.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,58 @@
+/*
+ * $Id$
+ *
+ * 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.xmlconfig.model;
+
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.richfaces.cdk.model.ComponentLibrary;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+@XmlType(name="fully-qualified-classType",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+public class ClassBean {
+
+ private String name;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the name
+ */
+ @XmlValue
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -28,6 +28,7 @@
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.Component;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
/**
* <p class="changed_added_4_0"></p>
@@ -38,32 +39,15 @@
@Override
public ComponentBean marshal(Component v) throws Exception {
- ComponentBean bean = new ComponentBean();
- bean.setType(v.getType().toString());
- bean.setClassName(v.getComponentClass().getName());
- bean.getAttributes().addAll(v.getAttributes());
- ComponentBean.ComponentExtension extension = new ComponentBean.ComponentExtension();
- extension.setFamily(v.getFamily());
- ConfigExtension configExtension = v.getExtension();
- if(null != configExtension){
- extension.setExtensions(configExtension.getExtensions());
- }
- bean.setExtension(extension);
+ ComponentBean bean = JAXBBinding.createAdapter(ComponentBean.class, v);
return bean;
}
@Override
public Component unmarshal(ComponentBean v) throws Exception {
Component component = new Component(new Component.Type(v.getType()));
- component.setComponentClass(new ClassDescription(v.getClassName()));
- component.getAttributes().addAll(v.getAttributes());
- ConfigExtension extension = new ConfigExtension();
- ComponentBean.ComponentExtension configExtension = v.getExtension();
- if(null != configExtension){
- component.setFamily(configExtension.getFamily());
- extension.setExtensions(configExtension.getExtensions());
- component.setExtension(extension);
- }
+ JAXBBinding.copyProperties(v, component);
+ JAXBBinding.copyExtensions(v, component, false);
return component;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -24,31 +24,47 @@
package org.richfaces.cdk.xmlconfig.model;
import java.util.List;
+import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.Extensible;
+import org.richfaces.cdk.model.Facet;
import org.richfaces.cdk.model.Property;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public class ComponentBean {
+public class ComponentBean implements
Extensible<ComponentBean.ComponentExtension>,DescriptionGroup {
private String type;
- private String className;
+ private ClassDescription componentClass;
+
private List<Property> attributes = Lists.newArrayList();
private ComponentExtension extension;
+
+ private String icon;
+
+ private String description;
+ private String displayname;
+
+ private List<Facet> facets = Lists.newArrayList();
+
/**
* <p class="changed_added_4_0"></p>
* @return the type
@@ -68,19 +84,20 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the className
+ * @return the componentClass
*/
@XmlElement(name="component-class",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getClassName() {
- return className;
+ @XmlJavaTypeAdapter(ClassAdapter.class)
+ public ClassDescription getComponentClass() {
+ return componentClass;
}
/**
* <p class="changed_added_4_0"></p>
- * @param className the className to set
+ * @param componentClass the componentClass to set
*/
- public void setClassName(String className) {
- this.className = className;
+ public void setComponentClass(ClassDescription className) {
+ this.componentClass = className;
}
/**
* <p class="changed_added_4_0"></p>
@@ -102,9 +119,28 @@
/**
* <p class="changed_added_4_0"></p>
+ * @return the facets
+ */
+ @XmlElement(name="facet",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ @XmlJavaTypeAdapter(FacetAdapter.class)
+ public List<Facet> getFacets() {
+ return facets;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param facets the facets to set
+ */
+ public void setFacets(List<Facet> facets) {
+ this.facets = facets;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
* @return the extension
*/
@XmlElement(name="component-extension",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ @Override
public ComponentExtension getExtension() {
return extension;
}
@@ -113,14 +149,70 @@
* <p class="changed_added_4_0"></p>
* @param extension the extension to set
*/
+ @Override
public void setExtension(ComponentExtension extension) {
this.extension = extension;
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the icon
+ */
+ @XmlElement(name="icon",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getIcon() {
+ return icon;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param icon the icon to set
+ */
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the description
+ */
+ @XmlElement(name="description",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the displayname
+ */
+ @XmlElement(name="display-name",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDisplayname() {
+ return displayname;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param displayname the displayname to set
+ */
+ public void setDisplayname(String displayname) {
+ this.displayname = displayname;
+ }
+
public static class ComponentExtension extends ConfigExtension {
private String family;
+ private ClassDescription baseClass;
+
+ private boolean generate;
+
/**
* <p class="changed_added_4_0"></p>
* @param family the family to set
@@ -137,5 +229,40 @@
public String getFamily() {
return family;
}
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the baseClass
+ */
+ @XmlElement(name="base-class",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
+ public ClassDescription getBaseClass() {
+ return baseClass;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param baseClass the baseClass to set
+ */
+ public void setBaseClass(ClassDescription baseClass) {
+ this.baseClass = baseClass;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the generate
+ */
+ @XmlElement(name="generate",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public boolean isGenerate() {
+ return generate;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param generate the generate to set
+ */
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
+ }
}
}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetAdapter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetAdapter.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetAdapter.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,48 @@
+/*
+ * $Id$
+ *
+ * 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.xmlconfig.model;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.richfaces.cdk.model.Facet;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class FacetAdapter extends XmlAdapter<FacetBean, Facet> {
+
+ @Override
+ public FacetBean marshal(Facet v) throws Exception {
+ return JAXBBinding.createAdapter(FacetBean.class, v);
+ }
+
+ @Override
+ public Facet unmarshal(FacetBean v) throws Exception {
+ return JAXBBinding.createModelElement(Facet.class, v, new Facet.Name(v.getName()));
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetBean.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetBean.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,163 @@
+/*
+ * $Id$
+ *
+ * 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.xmlconfig.model;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.Extensible;
+import org.richfaces.cdk.xmlconfig.model.ComponentBean.ComponentExtension;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class FacetBean implements
Extensible<FacetBean.FacetExtension>,DescriptionGroup{
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+ public static final class FacetExtension extends ConfigExtension {
+
+ private boolean generate;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the generate
+ */
+ @XmlElement(name="generate",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public boolean isGenerate() {
+ return generate;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param generate the generate to set
+ */
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
+ }
+
+ }
+
+ private String name;
+
+ private FacetExtension extension;
+
+ private String icon;
+
+ private String description;
+
+ private String displayname;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the name
+ */
+ @XmlElement(name="facet-name",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the icon
+ */
+ @XmlElement(name="icon",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getIcon() {
+ return icon;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param icon the icon to set
+ */
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the description
+ */
+ @XmlElement(name="description",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the displayname
+ */
+ @XmlElement(name="display-name",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDisplayname() {
+ return displayname;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param displayname the displayname to set
+ */
+ public void setDisplayname(String displayname) {
+ this.displayname = displayname;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the extension
+ */
+ @XmlElement(name="facet-extension",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public FacetExtension getExtension() {
+ return extension;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param extension the extension to set
+ */
+ public void setExtension(FacetExtension extension) {
+ this.extension = extension;
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyAdapter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyAdapter.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyAdapter.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -27,6 +27,7 @@
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
/**
* <p class="changed_added_4_0"></p>
@@ -37,17 +38,12 @@
@Override
public PropertyBean marshal(Property v) throws Exception {
- PropertyBean bean = new PropertyBean();
- bean.setName(v.getName().toString());
- bean.setType(v.getType().toString());
- return bean;
+ return JAXBBinding.createAdapter(PropertyBean.class, v);
}
@Override
public Property unmarshal(PropertyBean v) throws Exception {
- Property property = new Property(new Property.Name(v.getName()));
- property.setType(new ClassDescription(v.getType()));
- return property;
+ return JAXBBinding.createModelElement(Property.class, v, new
Property.Name(v.getName()));
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -23,19 +23,211 @@
package org.richfaces.cdk.xmlconfig.model;
+import java.util.List;
+import java.util.Set;
+
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.Extensible;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public class PropertyBean {
+public class PropertyBean implements
Extensible<PropertyBean.PropertyExtension>,DescriptionGroup {
/**
* <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+ public static class PropertyExtension extends ConfigExtension {
+
+ private boolean generate;
+
+ private boolean hidden;
+
+ private boolean literal;
+
+ private boolean required;
+
+ private boolean passThrough=false;
+
+ private Set<EventName> eventNames = Sets.newHashSet();
+
+ private List<ClassDescription> signature = Lists.newArrayList();
+
+ private Set<String> aliases = Sets.newHashSet();
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the generate
+ */
+ @XmlElement(name="generate",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public boolean isGenerate() {
+ return generate;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param generate the generate to set
+ */
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the hidden
+ */
+ @XmlElement(name="hidden",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public boolean isHidden() {
+ return hidden;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param hidden the hidden to set
+ */
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the literal
+ */
+ @XmlElement(name="literal",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public boolean isLiteral() {
+ return literal;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param literal the literal to set
+ */
+ public void setLiteral(boolean literal) {
+ this.literal = literal;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the required
+ */
+ @XmlElement(name="required",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param required the required to set
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the passThrough
+ */
+ @XmlElement(name="pass-through",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public boolean isPassThrough() {
+ return passThrough;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param passThrough the passThrough to set
+ */
+ public void setPassThrough(boolean passThrough) {
+ this.passThrough = passThrough;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the eventNames
+ */
+ @XmlElement(name="event-name",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public Set<EventName> getEventNames() {
+ return eventNames;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param eventNames the eventNames to set
+ */
+ public void setEventNames(Set<EventName> eventNames) {
+ this.eventNames = eventNames;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the signature
+ */
+ @XmlElementWrapper(name="signature",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlElement(name="param",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
+ public List<ClassDescription> getSignature() {
+ return signature;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param signature the signature to set
+ */
+ public void setSignature(List<ClassDescription> signature) {
+ this.signature = signature;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the aliases
+ */
+ @XmlElement(name="alias",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public Set<String> getAliases() {
+ return aliases;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param aliases the aliases to set
+ */
+ public void setAliases(Set<String> aliases) {
+ this.aliases = aliases;
+ }
+
+ }
+
+ private String name;
+
+ private ClassDescription type;
+
+ private String icon;
+
+ private String description;
+
+ private String displayname;
+
+ private String defaultValue;
+
+ private String suggestedValue;
+
+ private PropertyExtension extension;
+
+ /**
+ * <p class="changed_added_4_0"></p>
* @return the name
*/
@XmlElement(name="property-name",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
@@ -56,7 +248,8 @@
* @return the type
*/
@XmlElement(name="property-class",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getType() {
+ @XmlJavaTypeAdapter(ClassAdapter.class)
+ public ClassDescription getType() {
return type;
}
@@ -64,12 +257,108 @@
* <p class="changed_added_4_0"></p>
* @param type the type to set
*/
- public void setType(String type) {
+ public void setType(ClassDescription type) {
this.type = type;
}
- private String name;
-
- private String type;
-
-}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the icon
+ */
+ @XmlElement(name="icon",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getIcon() {
+ return icon;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param icon the icon to set
+ */
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the description
+ */
+ @XmlElement(name="description",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the displayname
+ */
+ @XmlElement(name="display-name",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDisplayname() {
+ return displayname;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param displayname the displayname to set
+ */
+ public void setDisplayname(String displayname) {
+ this.displayname = displayname;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the defaultValue
+ */
+ @XmlElement(name="default-value",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the suggestedValue
+ */
+ @XmlElement(name="suggested-value",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getSuggestedValue() {
+ return suggestedValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param suggestedValue the suggestedValue to set
+ */
+ public void setSuggestedValue(String suggestedValue) {
+ this.suggestedValue = suggestedValue;
+ }
+
+ @Override
+ @XmlElement(name="property-extension",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public PropertyExtension getExtension() {
+ return extension;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param extension the extension to set
+ */
+ @Override
+ public void setExtension(PropertyExtension extension) {
+ this.extension = extension;
+ }
+
+}
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -66,12 +66,8 @@
public class ComponentProcessorTest extends CdkTestBase {
- private static final String INTERFACE_JAVA =
"org/richfaces/cdk/apt/TestInterface.java";
- private static final String SUB_CLASS_JAVA =
"org/richfaces/cdk/apt/TestSubClass.java";
- private static final String CLASS_JAVA =
"org/richfaces/cdk/apt/TestClass.java";
- private static final ImmutableSet<String> PROCESS_ANNOTATIONS = ImmutableSet
- .of(TestAnnotation.class.getName());
private static final String COMPONENT_CLASS_JAVA =
"org/richfaces/cdk/test/component/AbstractTestComponent.java";
+ private static final String FACES_COMPONENT_CLASS_JAVA =
"org/richfaces/cdk/test/component/UITestCommand.java";
/**
@@ -95,9 +91,33 @@
assertEquals(1, components.size());
Component component = Iterables.get(components, 0);
Collection<Property> attributes = component.getAttributes();
- assertEquals(3, attributes.size());
+ assertEquals(5, attributes.size());
}
+ /**
+ * Test method for
+ * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set,
javax.annotation.processing.RoundEnvironment)}
+ * .
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testProcessFacesComponent() throws Exception {
+ // Prepare Mock compilation context.
+ CdkContext cdkContext = createMockContext();
+ ComponentLibrary library = new ComponentLibrary();
+ ComponentProcessor processor = new ComponentProcessor(cdkContext,library);
+ AptBuilder compiler = new AptBuilder();
+ compiler.init(cdkContext);
+ compiler.process(ImmutableList.of(getJavaFile(FACES_COMPONENT_CLASS_JAVA)),
processor);
+ verify(cdkContext);
+ Collection<Component> components = library.getComponents();
+ assertEquals(1, components.size());
+ Component component = Iterables.get(components, 0);
+ Collection<Property> attributes = component.getAttributes();
+ assertEquals(2, attributes.size());
+ }
+
private CdkContext createMockContext() throws Exception {
CdkContext cdkContext = createMock(CdkContext.class);
expect(cdkContext.getSourceFolders(StandardSources.JAVA_SOURCES)).andStubReturn(testSourceDirectory);
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileManagerTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileManagerTest.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileManagerTest.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -90,7 +90,7 @@
fileManager.setJavaSourceDirectory(javaSourceDirectory);
replay(mockFileManager);
ArrayList<JavaFileObject> list =
Lists.newArrayList(fileManager.list(StandardLocation.SOURCE_PATH, "",
ImmutableSet.of(Kind.HTML,Kind.SOURCE), true));
- assertEquals(5, list.size());
+ assertEquals(6, list.size());
}
@Test
public void testGetFileForInputLocationStringString() throws Exception {
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -32,6 +32,7 @@
import org.richfaces.cdk.CdkTestBase;
import org.richfaces.cdk.model.Component;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.Facet;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.xmlconfig.model.FacesConfigBean;
@@ -55,7 +56,15 @@
assertEquals("javax.faces.Panel", component.getType().toString());
assertEquals("javax.faces.Panel", component.getFamily());
assertEquals("javax.faces.component.UIPanel",
component.getComponentClass().getName());
+ assertEquals("panel.gif", component.getIcon());
+ assertEquals("Panel component", component.getDescription());
+ assertEquals("Panel", component.getDisplayname());
+ assertTrue(component.isGenerate());
+ Facet facet = Iterables.getOnlyElement(component.getFacets());
+ assertEquals("header", facet.getName().toString());
+ assertEquals("Header facet", facet.getDescription());
+ assertTrue(facet.isGenerate());
Collection<Property> attributes = component.getAttributes();
- assertEquals(10, attributes.size());
+ assertEquals(3, attributes.size());
}
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -26,12 +26,17 @@
import static org.junit.Assert.*;
import java.util.Collection;
+import java.util.List;
+import java.util.Set;
import org.junit.Test;
import org.richfaces.cdk.AbstractCdkContext;
+import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.Property;
+import com.google.common.collect.Iterables;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -46,4 +51,35 @@
assertEquals(3,properties.size());
}
+ @Test
+ public void xincludeTest() throws Exception {
+ FragmentParser parser = FragmentParser.getInstance(new
AbstractCdkContext(this.getClass().getClassLoader()));
+ Collection<Property> properties =
parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/parent.xml");
+ assertEquals(1,properties.size());
+ }
+
+ @Test
+ public void propertyTest() throws Exception {
+ FragmentParser parser = FragmentParser.getInstance(new
AbstractCdkContext(this.getClass().getClassLoader()));
+ Collection<Property> properties =
parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/include.xml");
+ assertEquals(1,properties.size());
+ Property property = Iterables.getOnlyElement(properties);
+ assertEquals("ontest2",property.getName().toString());
+ assertEquals("int",property.getType().getName());
+ assertEquals("test2 property",property.getDescription());
+ assertEquals("ontest2.png",property.getIcon());
+ assertEquals("test2 event property",property.getDisplayname());
+ assertEquals("3",property.getDefaultValue());
+ assertEquals("15",property.getSuggestedValue());
+ // CDK extensions.
+ assertTrue(property.isGenerate());
+ assertTrue(property.isHidden());
+ assertTrue(property.isLiteral());
+ assertTrue(property.isPassThrough());
+ assertTrue(property.isRequired());
+ List<ClassDescription> signature = property.getSignature();
+ assertEquals(2, signature.size());
+ Set<String> aliases = property.getAliases();
+ assertEquals(2, aliases.size());
+ }
}
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,50 @@
+package org.richfaces.cdk.xmlconfig;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.Component;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.xmlconfig.model.ComponentBean;
+import org.richfaces.cdk.xmlconfig.model.ComponentBean.ComponentExtension;
+
+public class JAXBCopyTest {
+
+ private static final String FOO_FAMILY = "foo.Family";
+ private static final String BAZ = "baz";
+ private static final String FOO_DESCTIPTION = "foo.Desctiption";
+ private static final String FOO_UI_BAR = "foo.UIBar";
+ private static final String FOO_BAR = "foo.Bar";
+
+ @Test
+ public void testCreateAdapter() throws Exception {
+ Component component = new Component(new Component.Type(FOO_BAR));
+ component.setDescription(FOO_DESCTIPTION);
+ component.setComponentClass(new ClassDescription(FOO_UI_BAR));
+ component.findOrCreateAttribute(BAZ);
+ component.setFamily(FOO_FAMILY);
+ ComponentBean componentBean = JAXBBinding.createAdapter(ComponentBean.class,
component);
+ assertEquals(FOO_BAR,componentBean.getType());
+ List<Property> attributes = componentBean.getAttributes();
+ assertEquals(1,attributes.size());
+ assertEquals(BAZ,attributes.get(0).getName().toString());
+ ComponentExtension extension = componentBean.getExtension();
+ assertNotNull(extension);
+ assertEquals(FOO_FAMILY, extension.getFamily());
+ }
+
+ @Test
+ public void testCopyExtensions() {
+// fail("Not yet implemented");
+ }
+
+ @Test
+ public void testCopyProperties() {
+// fail("Not yet implemented");
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/UITestCommand.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/UITestCommand.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/UITestCommand.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,132 @@
+/*
+ * $Id$
+ *
+ * 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 javax.el.MethodExpression;
+import javax.faces.component.ActionSource2;
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.ActionListener;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)FacesComponent("cdk.TestCommand")
+public class UITestCommand extends UIComponentBase implements ActionSource2 {
+
+ private static final String COMPONENT_FAMILY="cdk.TestFamily";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.faces.component.ActionSource#addActionListener(javax.faces.event.ActionListener)
+ */
+ public void addActionListener(ActionListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#getAction()
+ */
+ public MethodBinding getAction() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#getActionListener()
+ */
+ public MethodBinding getActionListener() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#getActionListeners()
+ */
+ public ActionListener[] getActionListeners() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#isImmediate()
+ */
+ public boolean isImmediate() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.faces.component.ActionSource#removeActionListener(javax.faces.event.ActionListener)
+ */
+ public void removeActionListener(ActionListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#setAction(javax.faces.el.MethodBinding)
+ */
+ public void setAction(MethodBinding action) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.faces.component.ActionSource#setActionListener(javax.faces.el.MethodBinding)
+ */
+ public void setActionListener(MethodBinding actionListener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setActionExpression(MethodExpression action) {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#setImmediate(boolean)
+ */
+ public void setImmediate(boolean immediate) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public MethodExpression getActionExpression() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/UITestCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/component.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/component.xml 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/component.xml 2009-08-26
01:13:23 UTC (rev 15306)
@@ -8,79 +8,16 @@
<component>
<component-type>javax.faces.Panel</component-type>
<component-class>javax.faces.component.UIPanel</component-class>
+ <facet>
+ <description>Header facet</description>
+ <facet-name>header</facet-name>
+ <facet-extension>
+ <cdk:generate>true</cdk:generate>
+ </facet-extension>
+ </facet>
<property>
<description><![CDATA[
- A mutable Map of the attributes associated with
- this component, keyed by attribute name.
- ]]></description>
- <display-name>Attributes Map</display-name>
- <icon />
- <property-name>attributes</property-name>
- <property-class>java.util.Map</property-class>
- <property-extension>
- <tag-attribute>false</tag-attribute>
- <read-only>true</read-only>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[
- The number of child components associated with
- this component.
- ]]></description>
- <display-name>Child Component Count</display-name>
- <icon />
- <property-name>childCount</property-name>
- <property-class>int</property-class>
- <property-extension>
- <tag-attribute>false</tag-attribute>
- <read-only>true</read-only>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[
- A mutable List of the child components associated with
- this component.
- ]]></description>
- <display-name>Child Component List</display-name>
- <icon />
- <property-name>children</property-name>
- <property-class>java.util.List</property-class>
- <property-extension>
- <tag-attribute>false</tag-attribute>
- <read-only>true</read-only>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[
- A mutable Map of the facets associated with
- this component, keyed by facet name.
- ]]></description>
- <display-name>Facets Map</display-name>
- <icon />
- <property-name>facets</property-name>
- <property-class>java.util.Map</property-class>
- <property-extension>
- <tag-attribute>false</tag-attribute>
- <read-only>true</read-only>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[
- The component family to which this component belongs. This property
- is used to select an appropriate Renderer.
- ]]></description>
- <display-name>Component Family</display-name>
- <icon />
- <property-name>family</property-name>
- <property-class>java.lang.String</property-class>
- <property-extension>
- <tag-attribute>false</tag-attribute>
- <read-only>true</read-only>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[
The component identifier for this component. This value must be
unique within the closest parent component that is a naming
container.
@@ -119,37 +56,13 @@
<value-expression-enabled>true</value-expression-enabled>
</property-extension>
</property>
- <property>
- <description><![CDATA[
- Identifier used (in conjunction with the "family" property) to
- select an appropriate Renderer to encode and decode this component.
- ]]></description>
- <display-name>Renderer Type</display-name>
- <icon />
- <property-name>rendererType</property-name>
- <property-class>java.lang.String</property-class>
- <property-extension>
- <tag-attribute>false</tag-attribute>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[
- Flag indicating whether or not this component takes responsibility
- for rendering its own children. This decision is normally delegated
- to the associated Renderer, if there is one.
- ]]></description>
- <display-name>Renders Children</display-name>
- <icon />
- <property-name>rendersChildren</property-name>
- <property-class>boolean</property-class>
- <property-extension>
- <tag-attribute>false</tag-attribute>
- <read-only>true</read-only>
- </property-extension>
- </property>
-
+ <icon>panel.gif</icon>
+ <description>Panel component</description>
+ <display-name>Panel</display-name>
<component-extension>
<cdk:component-family>javax.faces.Panel</cdk:component-family>
+ <cdk:base-class>javax.faces.component.UIComponentBase</cdk:base-class>
+ <cdk:generate>true</cdk:generate>
</component-extension>
</component>
</faces-config>
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/include.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/include.xml 2009-08-25
21:18:02 UTC (rev 15305)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/include.xml 2009-08-26
01:13:23 UTC (rev 15306)
@@ -3,25 +3,27 @@
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:cdk="http://richfaces.org/cdk/extensions">
<property>
- <description><![CDATA[
- test2 property.
- ]]></description>
- <display-name>test2</display-name>
- <property-name>test2</property-name>
+ <description><![CDATA[test2 property]]></description>
+ <display-name>test2 event property</display-name>
+ <icon>ontest2.png</icon>
+ <property-name>ontest2</property-name>
<property-class>int</property-class>
+ <default-value>3</default-value>
+ <suggested-value>15</suggested-value>
<property-extension>
- <cdk:el-expression>false</cdk:el-expression>
+ <cdk:literal>true</cdk:literal>
+ <cdk:generate>true</cdk:generate>
+ <cdk:hidden>true</cdk:hidden>
+ <cdk:required>true</cdk:required>
+ <cdk:pass-through>true</cdk:pass-through>
+ <cdk:event-name>ontest2</cdk:event-name>
+ <cdk:event-name default="true">action</cdk:event-name>
+ <cdk:signature>
+ <cdk:param>boolean</cdk:param>
+ <cdk:param>java.lang.String</cdk:param>
+ </cdk:signature>
+ <cdk:alias>foo</cdk:alias>
+ <cdk:alias>bar</cdk:alias>
</property-extension>
</property>
- <property>
- <description><![CDATA[
- test3 property.
- ]]></description>
- <display-name>test3</display-name>
- <property-name>test3</property-name>
- <property-class>double</property-class>
- <property-extension>
- <cdk:el-expression>false</cdk:el-expression>
- </property-extension>
- </property>
</cdk:properties>
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/parent.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/parent.xml
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/parent.xml 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<cdk:properties
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:cdk="http://richfaces.org/cdk/extensions">
+ <!--
+ <xi:include
+ href="urn:resource:org/richfaces/cdk/xmlconfig/include.xml"
+
xpointer="xmlns(jsf=http://java.sun.com/xml/ns/javaee)xpointer(//jsf...
+ -->
+
+ <xi:include
+ href="urn:resource:org/richfaces/cdk/xmlconfig/include.xml"
+
+ xpointer="element(/1/1)"/>
+
+</cdk:properties>
Property changes on:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/parent.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/pom.xml
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/pom.xml 2009-08-25
21:18:02 UTC (rev 15305)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/pom.xml 2009-08-26
01:13:23 UTC (rev 15306)
@@ -48,5 +48,10 @@
<artifactId>annotations</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.2</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java
(rev 0)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java 2009-08-26
01:13:23 UTC (rev 15306)
@@ -0,0 +1,132 @@
+/*
+ * $Id$
+ *
+ * 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 javax.el.MethodExpression;
+import javax.faces.component.ActionSource2;
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.ActionListener;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)FacesComponent("cdk.TestCommand")
+public class UITestCommand extends UIComponentBase implements ActionSource2 {
+
+ private static final String COMPONENT_FAMILY="cdk.TestFamily";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.faces.component.ActionSource#addActionListener(javax.faces.event.ActionListener)
+ */
+ public void addActionListener(ActionListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#getAction()
+ */
+ public MethodBinding getAction() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#getActionListener()
+ */
+ public MethodBinding getActionListener() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#getActionListeners()
+ */
+ public ActionListener[] getActionListeners() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#isImmediate()
+ */
+ public boolean isImmediate() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.faces.component.ActionSource#removeActionListener(javax.faces.event.ActionListener)
+ */
+ public void removeActionListener(ActionListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#setAction(javax.faces.el.MethodBinding)
+ */
+ public void setAction(MethodBinding action) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.faces.component.ActionSource#setActionListener(javax.faces.el.MethodBinding)
+ */
+ public void setActionListener(MethodBinding actionListener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setActionExpression(MethodExpression action) {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see javax.faces.component.ActionSource#setImmediate(boolean)
+ */
+ public void setImmediate(boolean immediate) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public MethodExpression getActionExpression() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain