Author: alexsmirnov
Date: 2010-03-08 20:17:56 -0500 (Mon, 08 Mar 2010)
New Revision: 16537
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Named.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java
Removed:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescriptor.java
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/BehaviorProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerGeneratorVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassName.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.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/model/TagModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/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/ConverterBean.java
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/ValidatorBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/package-info.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/NamingConventionsTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/FreeMarkerRendererTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/ValidatorTagGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.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/JAXBCopyTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/TaglibGeneratorVisitorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java
Log:
CODING IN PROGRESS - issue RF-7736: Library model verifier.
https://jira.jboss.org/jira/browse/RF-7736
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -24,7 +24,7 @@
package org.richfaces.cdk;
import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.InvalidNameException;
/**
@@ -50,7 +50,7 @@
* @return JSF component type.
* @throws InvalidNameException if className does not match naming conventions.
*/
- public ComponentModel.Type inferComponentType(ClassName componentClass) throws
InvalidNameException;
+ public FacesId inferComponentType(ClassName componentClass) throws
InvalidNameException;
/**
* <p class="changed_added_4_0">Calculates concrete component class
from explicit value or type.</p>
@@ -63,7 +63,7 @@
* @return Descriptor of generated UIComponent class.
* @throws InvalidNameException if component type does not follow naming
conventions.
*/
- public ClassName inferUIComponentClass(ComponentModel.Type componentType) throws
InvalidNameException;
+ public ClassName inferUIComponentClass(FacesId componentType) throws
InvalidNameException;
/**
@@ -72,10 +72,10 @@
* @return
* @throws InvalidNameException
*/
- public String inferUIComponentFamily(ComponentModel.Type componentType) throws
InvalidNameException;
+ public String inferUIComponentFamily(FacesId componentType) throws
InvalidNameException;
- public ClassName inferTagHandlerClass(ComponentModel.Type componentType, String
markup) throws InvalidNameException;
+ public ClassName inferTagHandlerClass(FacesId componentType, String markup) throws
InvalidNameException;
- public String inferTagName(ComponentModel.Type componentType) throws
InvalidNameException;
+ public String inferTagName(FacesId componentType) throws InvalidNameException;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -1,7 +1,7 @@
package org.richfaces.cdk;
import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.InvalidNameException;
import org.richfaces.cdk.model.Name;
import org.richfaces.cdk.model.Name.Classifier;
@@ -28,7 +28,7 @@
@Override
- public ComponentModel.Type inferComponentType(ClassName componentClass) throws
InvalidNameException {
+ public FacesId inferComponentType(ClassName componentClass) throws
InvalidNameException {
// check parameters.
if (null == componentClass) {
@@ -70,11 +70,11 @@
name.setSimpleName(simpleName);
- return new ComponentModel.Type(name.toString());
+ return new FacesId(name.toString());
}
@Override
- public ClassName inferUIComponentClass(ComponentModel.Type componentType) throws
InvalidNameException {
+ public ClassName inferUIComponentClass(FacesId componentType) throws
InvalidNameException {
if (null == componentType) {
throw new IllegalArgumentException();
}
@@ -94,7 +94,7 @@
}
@Override
- public String inferUIComponentFamily(ComponentModel.Type componentType) {
+ public String inferUIComponentFamily( FacesId componentType) {
if (null == componentType) {
throw new IllegalArgumentException();
}
@@ -112,7 +112,7 @@
*
* */
@Override
- public ClassName inferTagHandlerClass(ComponentModel.Type componentType, String
markup) {
+ public ClassName inferTagHandlerClass(FacesId componentType, String markup) {
if (null == componentType) {
throw new IllegalArgumentException();
}
@@ -124,7 +124,7 @@
}
@Override
- public String inferTagName(ComponentModel.Type componentType) {
+ public String inferTagName(FacesId componentType) {
if (null == componentType) {
throw new IllegalArgumentException();
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/BehaviorProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/BehaviorProcessor.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/BehaviorProcessor.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -26,6 +26,8 @@
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.JsfBehavior;
import org.richfaces.cdk.model.BehaviorModel;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.FacesId;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.element.TypeElement;
@@ -44,7 +46,7 @@
public void process(TypeElement element) throws CdkProcessingException {
JsfBehavior behavior = element.getAnnotation(JsfBehavior.class);
- BehaviorModel behaviorModel = new BehaviorModel(behavior.id());
+ BehaviorModel behaviorModel = new BehaviorModel(new FacesId(behavior.id()));
setClassNames(element, behaviorModel, behavior);
setTagInfo(behavior.tag(), behaviorModel);
@@ -61,11 +63,6 @@
public void setClassNames(TypeElement element, BehaviorModel behaviorModel,
JsfBehavior behavior) {
String baseClass = element.getQualifiedName().toString();
- if (behavior == null) {
- behaviorModel.setClassNames(baseClass, null);
- return;
- }
-
setClassNames(element, behaviorModel, behavior.behaviorClass(), baseClass);
}
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 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -25,16 +25,9 @@
package org.richfaces.cdk.apt;
-import com.google.common.collect.Lists;
-import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.annotations.*;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
-import org.richfaces.cdk.apt.SourceUtils.SuperTypeVisitor;
-import org.richfaces.cdk.model.*;
-import org.richfaces.cdk.model.ComponentModel.Type;
-import org.richfaces.cdk.util.Strings;
-import org.richfaces.cdk.xmlconfig.CdkEntityResolver;
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.Set;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.faces.event.FacesEvent;
@@ -43,10 +36,37 @@
import javax.lang.model.type.MirroredTypeException;
import javax.lang.model.type.MirroredTypesException;
import javax.lang.model.type.TypeMirror;
-import java.lang.annotation.Annotation;
-import java.util.List;
-import java.util.Set;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Attributes;
+import org.richfaces.cdk.annotations.Component;
+import org.richfaces.cdk.annotations.DefaultValue;
+import org.richfaces.cdk.annotations.DisplayName;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.EventNames;
+import org.richfaces.cdk.annotations.Facet;
+import org.richfaces.cdk.annotations.Facets;
+import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.annotations.Fires;
+import org.richfaces.cdk.annotations.Generate;
+import org.richfaces.cdk.annotations.Icon;
+import org.richfaces.cdk.annotations.Signature;
+import org.richfaces.cdk.annotations.SuggestedValue;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
+import org.richfaces.cdk.apt.SourceUtils.SuperTypeVisitor;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.FacetModel;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.util.Strings;
+import org.richfaces.cdk.xmlconfig.CdkEntityResolver;
+
+import com.google.common.collect.Lists;
+
/**
* <p class="changed_added_4_0">That class process component-related
annotations such as {@link Component} or
* {@link javax.faces.component.FacesComponent} and stores information in model.
@@ -62,7 +82,7 @@
ComponentLibrary library = getLibrary();
// Process class-level annotations.
ComponentModel component = new ComponentModel();
- component.setType(new Type(getComponentType(componentElement)));
+ component.setType(new FacesId(getComponentType(componentElement)));
// Should that component be generated ?
setClassNames(componentElement, component);
setComponentProperties(componentElement, component);
@@ -115,7 +135,7 @@
// TODO - encapsulate attribute builder into utility class.
for (BeanProperty beanProperty : properties) {
- FacetModel facet = component.addFacet(beanProperty.getName());
+ FacetModel facet = component.getOrCreateFacet(beanProperty.getName());
// Documentation
facet.setDescription(beanProperty.getDocComment());
@@ -144,7 +164,7 @@
for (Facet facet : facets) {
if (!Strings.isEmpty(facet.value())) {
- component.addFacet(facet.value());
+ component.getOrCreateFacet(facet.value());
} else {
// TODO - record error.
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -25,6 +25,7 @@
import org.richfaces.cdk.annotations.JsfConverter;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ConverterModel;
+import org.richfaces.cdk.model.FacesId;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.element.TypeElement;
@@ -44,7 +45,7 @@
JsfConverter converter = element.getAnnotation(JsfConverter.class);
ConverterModel converterModel = new ConverterModel();
- converterModel.setConverterId(converter.id());
+ converterModel.setId(FacesId.parseId(converter.id()));
try {
converterModel.setConverterForClass(new
ClassName(converter.forClass().getName()));
@@ -68,10 +69,6 @@
// TODO same method in the ValidatorProcessor move their in one class
public void setClassNames(TypeElement componentElement, ConverterModel
converterModel, JsfConverter converter) {
String baseClass = componentElement.getQualifiedName().toString();
- if (converter == null) {
- converterModel.setClassNames(baseClass, null);
- return;
- }
setClassNames(componentElement, converterModel, converter.converterClass(),
baseClass);
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -62,93 +62,22 @@
}
protected void setTagInfo(Tag tag, ModelElementBase model) {
- ClassDescriptor tagHandler = getTagHandler(tag, model);
String name = tag.name();
// if (Strings.isEmpty(name)) {
// name = namingConventions.inferTagName(model.getGeneratedClass());
// }
- model.setTag(new TagModel(model, name, tagHandler));
+ TagModel tagModel = new TagModel();
+ tagModel.setName(name);
+ tagModel.setTargetClass(ClassName.parseName(tag.handlerName()));
+ tagModel.setType(tag.type());
+ // TODO - set base class name,
+ // TODO - move refference integrity to model.
+ tagModel.setModel(model);
+ model.setTag(tagModel);
}
- private ClassDescriptor getTagHandler(Tag tag, ModelElementBase model) {
- String tagHandlerClass = getTagHandlerClass(tag);
- if (tagHandlerClass != null) {
- return new ClassDescriptor(tagHandlerClass, false);
- }
-
- String handlerBase = getTagHandlerParentClass(tag);
- String tagHandlerClassName = getTagHandlerClassName(tag);
- boolean generate = isGenerateTagHandler(model, handlerBase,
tagHandlerClassName);
-
-// if (Strings.isEmpty(tagHandlerClassName)) {
-// tagHandlerClassName =
namingConventions.inferTagHandlerName(model.getGeneratedClass());
-// }
-
- if (handlerBase == null) {
- handlerBase = getDafaultParentTagHandlerClass();
- }
-
- return new ClassDescriptor(tagHandlerClassName, handlerBase, generate);
- }
-
- private boolean isGenerateTagHandler(ModelElementBase model, String handlerBase,
String tagHandlerClassName) {
- if (!Strings.isEmpty(tagHandlerClassName) || handlerBase != null) {
- return true;
- }
-
- for (Property entry : model.getAttributes()) {
- if (entry.isBindingAttribute()) {
- return true;
- }
- }
-
- return false;
- }
-
- private String getTagHandlerClassName(Tag tag) {
- return tag.handlerName();
- }
-
- private String getTagHandlerParentClass(Tag tag) {
- String tagHandlerParentClass = null;
- try {
- tagHandlerParentClass = tag.baseHandler().getName();
- } catch (MirroredTypesException mirror) {
- List<? extends TypeMirror> mirrors = mirror.getTypeMirrors();
- if (!mirrors.isEmpty()) {
- tagHandlerParentClass = mirrors.get(0).toString();
- }
- } catch (MirroredTypeException mirror) {
- tagHandlerParentClass = mirror.getTypeMirror().toString();
- }
-
- if (TAG_HANDLER_DEFULT_CLASS.equals(tagHandlerParentClass)) {
- tagHandlerParentClass = null;
- }
- return tagHandlerParentClass;
- }
-
- private String getTagHandlerClass(Tag tag) {
- String tagHandlerClass = null;
- try {
- tagHandlerClass = tag.handler().getName();
- } catch (MirroredTypesException mirror) {
- List<? extends TypeMirror> mirrors = mirror.getTypeMirrors();
- if (!mirrors.isEmpty()) {
- tagHandlerClass = mirrors.get(0).toString();
- }
- } catch (MirroredTypeException mirror) {
- tagHandlerClass = mirror.getTypeMirror().toString();
- }
-
- if (TAG_HANDLER_DEFULT_CLASS.equals(tagHandlerClass)) {
- tagHandlerClass = null;
- }
- return tagHandlerClass;
- }
-
protected String getDafaultParentTagHandlerClass() {
return null;
}
@@ -199,18 +128,11 @@
protected void setClassNames(TypeElement componentElement, ModelElementBase
modelElement,
String generatedClass, String baseClass) {
- if (generatedClass == null || generatedClass.isEmpty() ||
baseClass.equals(generatedClass)) {
if (componentElement.getModifiers().contains(Modifier.ABSTRACT)) {
modelElement.setGenerate(true);
- //namingConventions.inferUIComponentClass(modelElement.getId(), null,
baseClass, true);
- generatedClass = componentElement.getQualifiedName().toString() +
"Generated";
- modelElement.setClassNames(generatedClass, baseClass);
- } else {
- modelElement.setClassNames(baseClass, null);
}
- } else {
- modelElement.setClassNames(generatedClass, baseClass);
- }
+ modelElement.setBaseClass(ClassName.parseName(baseClass));
+ modelElement.setTargetClass(ClassName.parseName(generatedClass));
}
protected Collection<Property> parseProperties(String attributesConfig) {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -23,6 +23,7 @@
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.JsfValidator;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.ValidatorModel;
import javax.annotation.processing.SupportedAnnotationTypes;
@@ -41,7 +42,7 @@
public void process(TypeElement element) throws CdkProcessingException {
JsfValidator validator = element.getAnnotation(JsfValidator.class);
- ValidatorModel validatorModel = new ValidatorModel(validator.id());
+ ValidatorModel validatorModel = new
ValidatorModel(FacesId.parseId((validator.id())));
setClassNames(element, validatorModel, validator);
setDescription(element, validatorModel);
@@ -58,11 +59,6 @@
public void setClassNames(TypeElement componentElement, ValidatorModel
validatorModel,
JsfValidator validator) {
String baseClass = componentElement.getQualifiedName().toString();
- if (validator == null) {
- validatorModel.setClassNames(baseClass, null);
- return;
- }
-
setClassNames(componentElement, validatorModel, validator.validatorClass(),
baseClass);
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -25,6 +25,7 @@
package org.richfaces.cdk.freemarker;
+import java.io.File;
import java.io.IOException;
import java.io.Writer;
@@ -33,6 +34,7 @@
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.LibraryVisitor;
+import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.Trackable;
import org.richfaces.cdk.model.Visitable;
@@ -119,7 +121,14 @@
}
}
- protected abstract String getOutputFile(C c) throws CdkException;
+ protected String getOutputFile(C c) throws CdkException {
+ if (c instanceof ModelElementBase) {
+ ModelElementBase modelElement = (ModelElementBase) c;
+ return modelElement.getTargetClass().getName().replace('.',
File.separatorChar) + ".java";
+ } else {
+ throw new CdkException("Unknown model object "+c);
+ }
+ }
protected abstract boolean isMyComponent(Visitable c);
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -63,11 +63,6 @@
}
@Override
- protected String getOutputFile(BehaviorModel c) throws CdkException {
- return c.getBehaviorClass().getName().replace('.', File.separatorChar) +
".java";
- }
-
- @Override
protected String getTemplateName() {
return "behavior.ftl";
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -67,11 +67,6 @@
}
@Override
- protected String getOutputFile(ComponentModel c) throws CdkException {
- return c.getComponentClass().getName().replace('.', File.separatorChar) +
".java";
- }
-
- @Override
protected String getTemplateName() {
return "component.ftl";
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -60,11 +60,6 @@
}
@Override
- protected String getOutputFile(ConverterModel converter) throws CdkException {
- return converter.getConverterClass().getName().replace('.',
File.separatorChar) + ".java";
- }
-
- @Override
protected String getTemplateName() {
return "converter.ftl";
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -59,11 +59,6 @@
}
@Override
- protected String getOutputFile(ValidatorModel validator) throws CdkException {
- return validator.getValidatorClass().getName().replace('.',
File.separatorChar) + ".java";
- }
-
- @Override
protected String getTemplateName() {
return "validator.ftl";
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerClassGenerator.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerClassGenerator.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -91,6 +91,6 @@
}
private String getOutputFileName(TagModel tag) {
- return tag.getTagHandlerClass().replace('.', File.separatorChar) +
".java";
+ return tag.getTargetClass().getName().replace('.', File.separatorChar) +
".java";
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerGeneratorVisitor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerGeneratorVisitor.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerGeneratorVisitor.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -57,7 +57,7 @@
private void generateTagHandler(ModelElementBase model) {
TagModel tag = model.getTag();
- if (tag == null || !tag.getHandler().isGenerate()) {
+ if (tag == null || !tag.isGenerate()) {
return;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -69,37 +69,32 @@
}
private void addTagHandler(Element parent, TagModel tag) {
- if (tag != null && tag.getTagHandlerClass() != null &&
tag.getHandler().isGenerate()) {
-
parent.addElement("handler-class").addText(tag.getTagHandlerClass());
+ if (tag != null && tag.getTargetClass() != null) {
+
parent.addElement("handler-class").addText(tag.getTargetClass().toString());
}
}
private String getComponentTagName(ComponentModel model) {
- return getTagName(model, getTagName(model.getType().getType()));
+ return getTagName(model);
}
- private String getTagName(ModelElementBase model, String defaults) {
- try {
+ private String getTagName(ModelElementBase model) {
return model.getTag().getName();
- } catch (NullPointerException e) {
- return defaults;
- }
}
- private String getTagName(String type) {
- String name = ClassName.getSimpleName(type);
- return name.substring(0, 1).toLowerCase() + name.substring(1);
- }
public void visitConverter(ConverterModel model) {
- Element tag = createTag(getTagName(model, getTagName(model.getConverterId())));
+ TagModel tagModel = model.getTag();
+ if (null != tagModel) {
+ Element tag = createTag(tagModel.getName());
Element converter = tag.addElement("converter");
- converter.addElement("converter-id", model.getConverterId());
+ converter.addElement("converter-id", model.getId().toString());
addTagHandler(converter, model.getTag());
appendAttributs(tag, model);
- }
+ } }
+
/**
* <tag>
* <tag-name>formatValidator</tag-name>
@@ -115,9 +110,9 @@
*
* */
public void visitValidator(ValidatorModel model) {
- Element tag = createTag(getTagName(model, getTagName(model.getValidatorId())));
+ Element tag = createTag(getTagName(model));
Element validator = tag.addElement("validator");
- validator.addElement("validator-id", model.getValidatorId());
+ validator.addElement("validator-id", model.getId().toString());
addTagHandler(validator, model.getTag());
appendAttributs(tag, model);
@@ -164,16 +159,12 @@
public void visitBehavior(BehaviorModel model) {
Element tag = createTag(getTagName(model));
Element validator = tag.addElement("behavior");
- validator.addElement("behavior-id").addText(model.getBehaviorId());
+ validator.addElement("behavior-id").addText(model.getId().toString());
addTagHandler(validator, model.getTag());
appendAttributs(tag, model);
}
- private String getTagName(ModelElementBase model) {
- return getTagName(model, getTagName(model.getId()));
- }
-
public void visitFacet(FacetModel model) {
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -26,6 +26,7 @@
import org.richfaces.cdk.util.ComparatorUtils;
+
/**
* This is the base class for all Java Bean-like JSF objects in the model.
* @author akolonitsky
@@ -52,14 +53,9 @@
* @param name
* @return
*/
- public Property getAttribute(String name) {
+ public Property getAttribute(final String name) {
// OPTIMIZATION keep HashMap for name-property pair for fast lookup.
- for (Property property : attributes) {
- if(ComparatorUtils.nullSafeEquals(property.getName(), name)){
- return property;
- }
- }
- return null;
+ return attributes.find(new Named.NamedPredicate(name));
}
public Property getOrCreateAttribute(String attributeName) {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -39,18 +39,11 @@
public BehaviorModel() {
}
- public BehaviorModel(String behaviorId) {
+ public BehaviorModel(FacesId behaviorId) {
setId(behaviorId);
}
- public String getBehaviorId() {
- return getId();
- }
- public ClassName getBehaviorClass() {
- return getGeneratedClass();
- }
-
@Override
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws
CdkException {
return visitor.visit(this, param);
@@ -68,6 +61,6 @@
@Override
public boolean same(BehaviorModel other) {
- return null != getBehaviorId() &&
getBehaviorId().equals(other.getBehaviorId());
+ return null != getId() && getId().equals(other.getId());
}
}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescriptor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescriptor.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescriptor.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.cdk.model;
-
-import java.io.Serializable;
-
-/**
- * @author akolonitsky
- * @since Feb 22, 2010
- */
-public class ClassDescriptor implements Serializable {
-
- private final ClassName name;
-
- private ClassName parent;
-
- private boolean generate = false;
-
- public ClassDescriptor(String name) {
- this(name, null);
- }
-
- public ClassDescriptor(String name, String parent) {
- this(ClassName.get(name), ClassName.get(parent));
- }
-
- public ClassDescriptor(Class name) {
- this(name, null);
- }
-
- public ClassDescriptor(Class name, Class parent) {
- this(ClassName.get(name), ClassName.get(parent));
- }
-
- public ClassDescriptor(String name, boolean generate) {
- this(new ClassName(name), generate);
- }
-
- public ClassDescriptor(String name, String parent, boolean generate) {
- this(ClassName.get(name), ClassName.get(parent), generate);
- }
-
- public ClassDescriptor(Class name, boolean generate) {
- this(ClassName.get(name), null, generate);
- }
-
- public ClassDescriptor(Class name, Class parent, boolean generate) {
- this(ClassName.get(name), ClassName.get(parent), generate);
- }
-
- public ClassDescriptor(ClassName name, boolean generate) {
- this(name, null, generate);
- }
-
- public ClassDescriptor(ClassName name, ClassName parent, boolean generate) {
- this.name = name;
- this.parent = parent;
- this.generate = generate;
- }
-
- public ClassDescriptor(ClassName name) {
- this(name, null, false);
- }
-
- public ClassDescriptor(ClassName name, ClassName parent) {
- this(name, parent, false);
- }
-
- public String getPackage() {
- return name.getPackage();
- }
-
- public String getSimpleName() {
- return name.getSimpleName();
- }
-
- @Override
- public String toString() {
- return name.toString();
- }
-
- public ClassName getName() {
- return name;
- }
-
- public ClassName getParent() {
- return parent;
- }
-
- public boolean isGenerate() {
- return generate;
- }
-
- public void setGenerate(boolean generate) {
- this.generate = generate;
- }
-}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassName.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassName.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassName.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -25,6 +25,8 @@
import java.io.Serializable;
+import org.richfaces.cdk.util.Strings;
+
import com.google.common.collect.ImmutableMap;
/**
@@ -66,6 +68,14 @@
private String typeParameters;
/**
+ * <p class="changed_added_4_0">Factory method to create class names.
For empty or null name, returns null</p>
+ * @param name fully-cvalified class name
+ * @return new class name instance or null.
+ */
+ public static ClassName parseName(String name){
+ return Strings.isEmpty(name)?null:new ClassName(name);
+ }
+ /**
* <p class="changed_added_4_0"></p>
*
* @param cl
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -1,7 +1,6 @@
package org.richfaces.cdk.model;
import java.util.Collection;
-import java.util.Map;
import org.richfaces.cdk.CdkException;
@@ -20,7 +19,7 @@
* Facets recognised by the component
* </p>
*/
- private final ModelMap<String, FacetModel> facets = ModelMap.<String,
FacetModel>create();
+ private final ModelCollection<FacetModel> facets =
ModelCollection.<FacetModel>create();
/**
* <p class="changed_added_4_0">
@@ -39,15 +38,8 @@
private String family;
- /**
- * <p class="changed_added_4_0">
- * Component type
- * </p>
- */
- private Type type;
-
- public ComponentModel(Type key) {
- this.type = key;
+ public ComponentModel(FacesId key) {
+ this.setId(key);
}
public ComponentModel() {
@@ -71,9 +63,9 @@
public void merge(ComponentModel otherComponent) {
//merge facets, renderers, events ...
ComponentLibrary.merge(getAttributes(),otherComponent.getAttributes());
- facets.putAll(otherComponent.getFacets());
- ComponentLibrary.merge(events, otherComponent.getEvents());
- ComponentLibrary.merge(renderers, otherComponent.getRenderers());
+ ComponentLibrary.merge(getFacets(),otherComponent.getFacets());
+ ComponentLibrary.merge(getEvents(), otherComponent.getEvents());
+ ComponentLibrary.merge(getRenderers(), otherComponent.getRenderers());
ComponentLibrary.merge(this, otherComponent);
this.setGenerate(this.isGenerate() || otherComponent.isGenerate());
}
@@ -92,18 +84,14 @@
* <p class="changed_added_4_0"></p>
* @param type the type to set
*/
- public void setType(Type type) {
- this.type = type;
+ public void setType(FacesId type) {
+ setId(type);
}
- public Type getType() {
- return type;
+ public FacesId getType() {
+ return getId();
}
- @Override
- public String getId() {
- return type.getType();
- }
/**
* <p class="changed_added_4_0">
@@ -130,29 +118,44 @@
}
/**
- * <p class="changed_added_4_0">
+ * <p class="changed_added_4_0">Alias for TargetClass.
* </p>
*
* @return the componentClass
+ * @deprecated
*/
@Merge
public ClassName getComponentClass() {
- return getGeneratedClass();
+ return getTargetClass();
}
/**
* <p class="changed_added_4_0"></p>
+ * @param name
+ * @deprecated
+ */
+ public void setComponentClass(ClassName name) {
+ setTargetClass(name);
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
* @return the facets
*/
- public Map<String, FacetModel> getFacets() {
+ public Collection<FacetModel> getFacets() {
return facets;
}
- public FacetModel addFacet(String name) {
- FacetModel facet = facets.get(name);
+ public FacetModel getFacet(final String name) {
+ return facets.find(new Named.NamedPredicate(name));
+ }
+
+ public FacetModel getOrCreateFacet(String name) {
+ FacetModel facet = getFacet(name);
if(null == facet){
facet = new FacetModel();
- facets.put(name, facet);
+ facet.setName(name);
+ facets.add(facet);
}
return facet;
}
@@ -182,12 +185,4 @@
public Collection<RendererModel> getRenderers() {
return renderers;
}
-
- public static class Type extends FacesId {
- private static final long serialVersionUID = -6968199073379187423L;
-
- public Type(String type) {
- super(type);
- }
- }
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -39,18 +39,11 @@
public ConverterModel() {
}
- public ConverterModel(String converterId) {
+ public ConverterModel(FacesId converterId) {
setId(converterId);
}
- public String getConverterId() {
- return getId();
- }
- public void setConverterId(String converterId) {
- setId(converterId);
- }
-
@Merge(false)
public ClassName getConverterForClass() {
return converterForClass;
@@ -60,10 +53,6 @@
this.converterForClass = converterForClass;
}
- @Merge(false)
- public ClassName getConverterClass() {
- return getGeneratedClass();
- }
@Override
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws
CdkException {
@@ -82,6 +71,6 @@
@Override
public boolean same(ConverterModel other) {
- return null != getConverterId() &&
getConverterId().equals(other.getConverterId());
+ return null != getId() && getId().equals(other.getId());
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -25,6 +25,8 @@
import java.io.Serializable;
+import org.richfaces.cdk.util.Strings;
+
/**
* <p class="changed_added_4_0">This is a FacesId class that should be
used to find JSF elements in {@link ComponentLibrary}</p>
*
@@ -35,6 +37,9 @@
private final String type;
+ public static FacesId parseId(String id){
+ return Strings.isEmpty(id)?null:new FacesId(id);
+ }
/**
* <p class="changed_added_4_0"></p>
*
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -26,18 +26,38 @@
package org.richfaces.cdk.model;
import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.util.ComparatorUtils;
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public class FacetModel extends DescriptionGroupBase implements
ModelElement<FacetModel> {
+public class FacetModel extends DescriptionGroupBase implements
ModelElement<FacetModel>, Named {
+
private static final long serialVersionUID = 7723771279129598243L;
+
+ private String name;
public FacetModel() {
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
@Override
public void merge(FacetModel other) {
ComponentLibrary.merge(this, other);
@@ -54,6 +74,6 @@
@Override
public boolean same(FacetModel other) {
- return equals(other);
+ return ComparatorUtils.nullSafeEquals(this.getName(), other.getName());
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -51,10 +51,8 @@
return new ModelCollection<T>();
}
- // TODO -provide factory methods.
- // private final Method factoryMethod;
- public E find(final Predicate<E> predicate) {
+ public E find(final Predicate<? super E> predicate) {
try {
return Iterables.find(elements, predicate);
} catch (NoSuchElementException e) {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -8,9 +8,11 @@
*/
public class ModelElementBase extends BeanModelBase {
- private String id;
+ private FacesId id;
+
+ private ClassName targetClass;
- private ClassDescriptor generatedClass;
+ private ClassName baseClass;
private TagModel tag;
@@ -22,48 +24,43 @@
this.tag = tag;
}
- public String getId() {
+ public FacesId getId() {
return id;
}
- public void setId(String id) {
+ public void setId(FacesId id) {
this.id = id;
}
- public void setGeneratedClass(String generatedClass) {
- setGeneratedClass(new ClassDescriptor(generatedClass));
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param targetClass the targetClass to set
+ */
+ public void setTargetClass(ClassName targetClass) {
+ this.targetClass = targetClass;
}
- public void setGeneratedClass(Class generatedClass) {
- setGeneratedClass(new ClassDescriptor(generatedClass));
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the targetClass
+ */
+ public ClassName getTargetClass() {
+ return targetClass;
}
- public void setGeneratedClass(ClassName generatedClass) {
- setGeneratedClass(new ClassDescriptor(generatedClass));
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param baseClass the baseClass to set
+ */
+ public void setBaseClass(ClassName baseClass) {
+ this.baseClass = baseClass;
}
- public void setGeneratedClass(ClassDescriptor generatedClass) {
- this.generatedClass = generatedClass;
- }
-
- public ClassName getGeneratedClass() {
- if (this.generatedClass == null) {
- return null;
- }
-
- return this.generatedClass.getName();
- }
-
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the baseClass
+ */
public ClassName getBaseClass() {
- if (this.generatedClass == null) {
- return null;
- }
-
- return this.generatedClass.getParent();
+ return baseClass;
}
-
- public void setClassNames(String className, String parentClassName) {
- setGenerate(parentClassName != null);
- this.generatedClass = new ClassDescriptor(className, parentClassName);
- }
}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Named.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Named.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Named.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -0,0 +1,64 @@
+/*
+ * $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 org.richfaces.cdk.util.ComparatorUtils;
+
+import com.google.common.base.Predicate;
+
+/**
+ * <p class="changed_added_4_0">This interface represents all models for
"named" JSF objects ( attributes, properties, facets )</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface Named {
+
+ public static final class NamedPredicate implements Predicate<Named> {
+
+ private final String _name;
+
+ public NamedPredicate(String name) {
+ this._name = name;
+ }
+
+ @Override
+ public boolean apply(Named input) {
+ return ComparatorUtils.nullSafeEquals(input.getName(), this._name);
+ }
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ // TODO - change to class corresponding with Java identifier type from
faces-config.xsd
+ * @return the name
+ */
+ public String getName();
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param name the name to set
+ */
+ public void setName(String name);
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Named.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -37,7 +37,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class Property extends DescriptionGroupBase implements
ModelElement<Property> {
+public class Property extends DescriptionGroupBase implements
ModelElement<Property> , Named {
private static final long serialVersionUID = 3483864006602184580L;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -27,12 +27,14 @@
import java.io.Serializable;
+import org.richfaces.cdk.annotations.TagType;
+
/**
* <p class="changed_added_4_0">That bean represents VDL tag</p>
* @author asmirnov(a)exadel.com
*
*/
-public class TagModel implements Serializable {
+public class TagModel implements Named , Serializable {
private static final long serialVersionUID = 3875718626199223087L;
@@ -40,94 +42,109 @@
* <p class="changed_added_4_0">Component that the tag creates. This
in bidirectional one to one relation.</p>
* TODO - tag should also works with {@code Validator}, {@code Converter}, {@code
Behavior}, {@code FacesListener}
*/
- private final ModelElementBase model;
+ private ModelElementBase model;
+ private ClassName targetClass;
+
+ private ClassName baseClass;
+
+ private TagType type;
+
+ private boolean generate = false;
/**
- * <p class="changed_added_4_0">Jsp tag class</p>
+ * <p class="changed_added_4_0">Tag name</p>
*/
- private String jspClass;
+ private String name;
+
+ public ModelElementBase getModel() {
+ return model;
+ }
+
+ public void setModel(ModelElementBase model) {
+ this.model = model;
+ }
+
+ public String getName() {
+ return name;
+ }
+
/**
- * <p class="changed_added_4_0">Tag library for which that tag is
belong.
- * This is bidirectional many to one relation.</p>
+ * <p class="changed_added_4_0"></p>
+ * @param name the name to set
*/
- private TagLibrary library;
+ public void setName(String name) {
+ this.name = name;
+ }
+
/**
- * <p class="changed_added_4_0">Tag name</p>
+ * <p class="changed_added_4_0"></p>
+ * @return the type
*/
- private final String name;
+ public TagType getType() {
+ return this.type;
+ }
/**
- * <p class="changed_added_4_0">Facelets VDL tag handler
class.</p>
+ * <p class="changed_added_4_0"></p>
+ * @param type the type to set
*/
- private ClassDescriptor handler;
-
- public TagModel(ModelElementBase model, String name, String tagHandlerClass) {
- this(model, name, tagHandlerClass, null);
+ public void setType(TagType type) {
+ this.type = type;
}
- public TagModel(ModelElementBase model, String name, String tagHandlerClass, String
tagHandlerParentClass) {
- this.model = model;
- this.name = name;
-
- if (tagHandlerClass != null) {
- this.handler = new ClassDescriptor(tagHandlerClass, tagHandlerParentClass);
- }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the targetClass
+ */
+ public ClassName getTargetClass() {
+ return this.targetClass;
}
- public TagModel(ModelElementBase model, String name, ClassDescriptor tagHandlerClass)
{
- this.model = model;
- this.name = name;
- this.handler = tagHandlerClass;
- }
-
- public ModelElementBase getModel() {
- return model;
- }
- public String getJspClass() {
- return jspClass;
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param targetClass the targetClass to set
+ */
+ public void setTargetClass(ClassName targetClass) {
+ this.targetClass = targetClass;
}
- public void setJspClass(String jspClass) {
- this.jspClass = jspClass;
- }
- public TagLibrary getLibrary() {
- return library;
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the baseClass
+ */
+ public ClassName getBaseClass() {
+ return this.baseClass;
}
- public void setLibrary(TagLibrary library) {
- this.library = library;
- }
- public String getName() {
- return name;
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param baseClass the baseClass to set
+ */
+ public void setBaseClass(ClassName baseClass) {
+ this.baseClass = baseClass;
}
- public ClassDescriptor getHandler() {
- return handler;
- }
- public void setHandler(ClassDescriptor handler) {
- this.handler = handler;
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the generate
+ */
+ public boolean isGenerate() {
+ return this.generate;
}
- public String getTagHandlerClass() {
- if (handler != null) {
- return handler.getName().getName();
- }
- return null;
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param generate the generate to set
+ */
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
}
-
- public String getTagHandlerSuperClass() {
- if (handler != null) {
- return handler.getParent().getName();
- }
- return null;
- }
-
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -36,22 +36,10 @@
public ValidatorModel() {
}
- public ValidatorModel(String validatorId) {
- setValidatorId(validatorId);
- }
-
- public String getValidatorId() {
- return getId();
- }
-
- public void setValidatorId(String validatorId) {
+ public ValidatorModel(FacesId validatorId) {
setId(validatorId);
}
- @Merge(false)
- public ClassName getValidatorClass() {
- return getGeneratedClass();
- }
@Override
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws
CdkException {
@@ -70,6 +58,6 @@
@Override
public boolean same(ValidatorModel other) {
- return null != getValidatorId() &&
getValidatorId().equals(other.getValidatorId());
+ return null != getId() && getId().equals(other.getId());
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -34,9 +34,12 @@
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
+import org.richfaces.cdk.util.Strings;
import com.google.inject.Inject;
@@ -121,11 +124,11 @@
log.error("Base class for generated component is not set :" +
component.getType());
// return;
} else if (null == component.getComponentClass()) {
-
component.setGeneratedClass(namingConventions.inferUIComponentClass(component.getType()));
+
component.setTargetClass(namingConventions.inferUIComponentClass(component.getType()));
}
} else if (null == component.getComponentClass()){
if (null != component.getBaseClass()) {
- component.setGeneratedClass(component.getBaseClass());
+ component.setTargetClass(component.getBaseClass());
} else {
log.error("No class information available for component: " +
component);
// return;
@@ -135,20 +138,56 @@
if(null == component.getFamily()){
component.setFamily(namingConventions.inferUIComponentFamily(component.getType()));
}
+ // TODO Propagate attributes from parent component.
// Check attributes.
for (Property attribute : component.getAttributes()) {
- verifyAttribute(attribute);
+ verifyAttribute(attribute,component.isGenerate());
}
- // compact(component.getAttributes());
+ // compact(component.getAttributes());
// Check renderers.
// Check Tag
+ verifyDescription(component);
+ for (FacetModel facet : component.getFacets()) {
+ verifyDescription(facet);
+ }
}
- protected void verifyAttribute(Property attribute) {
+ protected void verifyAttribute(Property attribute, boolean generatedComponent) {
// Check name.
+ if(Strings.isEmpty(attribute.getName())){
+ log.error("No name for attribute "+attribute);
+ return;
+ }
+ if(attribute.getName().contains(".") ||
Character.isDigit(attribute.getName().charAt(0)) || attribute.getName().contains("
") ){
+ log.error("Invalid attribute name
["+attribute.getName()+"]");
+ return;
+ }
+ // Check type
+ if(null == attribute.getType()){
+ log.error("Unknown type of attribute
["+attribute.getName()+"]");
+ return;
+ }
// Check binding properties.
+
if("javax.faces.el.MethodBinding".equals(attribute.getType().getName())){
+ attribute.setBinding(true);
+ attribute.setBindingAttribute(true);
+ } else
if("javax.el.MethodExpression".equals(attribute.getType().getName())){
+ attribute.setBindingAttribute(true);
+ }
+ // Check "generate" flag.
+ if(generatedComponent){
+ // TODO Attribute should be only generated if it does not exist or abstract in
the base class.
+ // Step one - check base class
+ } else {
+ attribute.setGenerate(false);
+ }
+ verifyDescription(attribute);
+ }
+
+ protected void verifyDescription(DescriptionGroup element){
}
+
protected void compact(Collection<?> collection) {
// if (collection instanceof ModelCollection) {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -31,6 +31,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.FacesId;
import com.google.common.collect.Lists;
@@ -39,23 +40,24 @@
* @since Jan 21, 2010
*/
@XmlType(name = "faces-config-behaviorType", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder={"behaviorId", "behaviorClass", "attributes",
"extension"})
+ propOrder={"id", "behaviorClass", "attributes",
"extension"})
@XmlJavaTypeAdapter(BehaviorAdapter.class)
public class BehaviorBean extends ExtensibleBean<BehaviorBean.BehaviorExtension> {
- private String behaviorId;
private String behaviorClass;
private List<PropertyBase> attributes = Lists.newArrayList();
+ private FacesId id;
+
@XmlElement(name = "behavior-id", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getBehaviorId() {
- return behaviorId;
+ public FacesId getId() {
+ return id;
}
- public void setBehaviorId(String behaviorId) {
- this.behaviorId = behaviorId;
+ public void setId(FacesId id) {
+ this.id = id;
}
@XmlElement(name = "behavior-class", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
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 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -24,12 +24,12 @@
package org.richfaces.cdk.xmlconfig.model;
-import org.richfaces.cdk.model.*;
-
import java.util.Collection;
-import org.richfaces.cdk.model.ComponentModel.Type;
+import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.RendererModel;
+
/**
* <p class="changed_added_4_0"></p>
*
@@ -51,24 +51,10 @@
return ComponentModel.class;
}
- @Override
- protected void postMarshal(ComponentModel model, ComponentBean bean) {
- // Copy properties/attributes
- bean.setFacets(marshalMap(model.getFacets(), FACET_ADAPTER));
- }
@Override
protected void postUnmarshal(ComponentBean bean, ComponentModel model) {
- model.setGenerate(false);
- model.setGeneratedClass(bean.getComponentClass());
-
- // Copy type.
- String type = bean.getType();
- if (null != type) {
- model.setType(new Type(type.trim()));
- }
// Copy properties/attributes
- model.getFacets().putAll(this.<String, FacetBean,
FacetModel>unmarshalMap(bean.getFacets(), FACET_ADAPTER));
Collection<RendererModel> renderers = model.getRenderers();
ComponentBean.ComponentExtension extension = bean.getExtension();
if (renderers != null && extension != null) {
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 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -30,11 +30,12 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.richfaces.cdk.model.AttributeModel;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
import org.richfaces.cdk.model.EventModel;
+import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.model.Property;
import com.google.common.collect.Lists;
@@ -52,9 +53,9 @@
private boolean generate = false;
private List<Property> attributes = Lists.newArrayList();
- private List<FacetBean> facets = Lists.newArrayList();
+ private List<FacetModel> facets = Lists.newArrayList();
private ClassName componentClass;
- private String type;
+ private FacesId type;
/**
* <p class="changed_added_4_0"></p>
@@ -62,7 +63,7 @@
* @return the type
*/
@XmlElement(name = "component-type", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE,required=true)
- public String getType() {
+ public FacesId getType() {
return type;
}
@@ -71,7 +72,7 @@
*
* @param type the type to set
*/
- public void setType(String type) {
+ public void setType(FacesId type) {
this.type = type;
}
@@ -130,7 +131,8 @@
* @return the facets
*/
@XmlElement(name = "facet", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public List<FacetBean> getFacets() {
+ @XmlJavaTypeAdapter(FacetAdapter.class)
+ public List<FacetModel> getFacets() {
return facets;
}
@@ -139,7 +141,7 @@
*
* @param facets the facets to set
*/
- public void setFacets(List<FacetBean> facets) {
+ public void setFacets(List<FacetModel> facets) {
this.facets = facets;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -30,6 +30,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.FacesId;
import com.google.common.collect.Lists;
@@ -38,12 +39,11 @@
* @since Jan 6, 2010
*/
@XmlType(name = "faces-config-converterType", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder={"converterId", "converterForClass",
"converterClass",
+ propOrder={"id", "converterForClass", "converterClass",
"attributes", "extension"})
@XmlJavaTypeAdapter(ConverterAdapter.class)
public class ConverterBean extends ExtensibleBean<ConverterBean.ConverterExtension>
{
- private String converterId;
private String converterForClass;
@@ -51,13 +51,15 @@
private List<PropertyBase> attributes = Lists.newArrayList();
+ private FacesId id;
+
@XmlElement(name = "converter-id", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getConverterId() {
- return converterId;
+ public FacesId getId() {
+ return id;
}
- public void setConverterId(String converterId) {
- this.converterId = converterId;
+ public void setId(FacesId id) {
+ this.id = id;
}
@XmlElement(name = "converter-for-class", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -0,0 +1,46 @@
+/*
+ * $Id: ClassAdapter.java 16509 2010-03-01 13:40:54Z Alex.Kolonitsky $
+ *
+ * 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.FacesId;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @author asmirnov(a)exadel.com
+ */
+public class FacesIdAdapter extends XmlAdapter<String, FacesId> {
+ @Override
+ public String marshal(FacesId v) throws Exception {
+
+ return v.toString();
+ }
+
+ @Override
+ public FacesId unmarshal(String v) throws Exception {
+ return new FacesId(v);
+ }
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
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 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacetBean.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -33,7 +33,9 @@
*
* @author asmirnov(a)exadel.com
*/
-public class FacetBean extends ExtensibleBean<FacetBean.FacetExtension> implements
MapEntry<String>{
+public class FacetBean extends ExtensibleBean<FacetBean.FacetExtension> {
+
+
private String name;
/**
@@ -42,7 +44,7 @@
* @return the name
*/
@XmlElement(name = "facet-name", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getKey() {
+ public String getName() {
return name;
}
@@ -51,7 +53,7 @@
*
* @param name the name to set
*/
- public void setKey(String name) {
+ public void setName(String name) {
this.name = name;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -30,6 +30,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.FacesId;
import com.google.common.collect.Lists;
@@ -38,23 +39,24 @@
* @since Jan 13, 2010
*/
@XmlType(name = "faces-config-validatorType", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder={"validatorId", "validatorClass",
"attributes", "extension"})
+ propOrder={"id", "validatorClass", "attributes",
"extension"})
@XmlJavaTypeAdapter(ValidatorAdapter.class)
public class ValidatorBean extends ExtensibleBean<ValidatorBean.ValidatorExtension>
{
- private String validatorId;
private String validatorClass;
private List<PropertyBase> attributes = Lists.newArrayList();
+ private FacesId id;
+
@XmlElement(name = "validator-id", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getValidatorId() {
- return validatorId;
+ public FacesId getId() {
+ return id;
}
- public void setValidatorId(String validatorId) {
- this.validatorId = validatorId;
+ public void setId(FacesId id) {
+ this.id = id;
}
@XmlElement(name = "validator-class", namespace =
ComponentLibrary.FACES_CONFIG_NAMESPACE)
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/package-info.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/package-info.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/package-info.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -17,6 +17,7 @@
@XmlJavaTypeAdapter(type = ClassName.class, value = ClassAdapter.class),
@XmlJavaTypeAdapter(type = AttributeModel.class, value = AttributeAdapter.class),
@XmlJavaTypeAdapter(type = Property.class, value = PropertyAdapter.class),
+ @XmlJavaTypeAdapter(type = FacesId.class, value = FacesIdAdapter.class),
@XmlJavaTypeAdapter(type = ComponentLibrary.class, value = FacesConfigAdapter.class)
})
package org.richfaces.cdk.xmlconfig.model;
@@ -28,5 +29,6 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.AttributeModel;
import org.richfaces.cdk.model.Property;
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/NamingConventionsTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/NamingConventionsTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/NamingConventionsTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -30,7 +30,7 @@
import org.junit.Test;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentModel;
-import org.richfaces.cdk.model.ComponentModel.Type;
+import org.richfaces.cdk.model.FacesId;
/**
* <p class="changed_added_4_0">
@@ -40,7 +40,7 @@
*
*/
public class NamingConventionsTest {
- private static final Type COMPONENT_TYPE = new
ComponentModel.Type("foo.bar.Test");
+ private static final FacesId COMPONENT_TYPE =
FacesId.parseId("foo.bar.Test");
private static final String BASE = "foo.bar";
private RichFacesConventions conventions;
@@ -78,7 +78,7 @@
@Test
public void testInferComponentTypeFromMarkupClass() throws Exception {
- assertEquals(new ComponentModel.Type("foo.bar.HtmlTest"),
conventions.inferComponentType(new
ClassName("foo.bar.component.html.HtmlTest")));
+ assertEquals(FacesId.parseId("foo.bar.HtmlTest"),
conventions.inferComponentType(new
ClassName("foo.bar.component.html.HtmlTest")));
}
@Test
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -33,6 +33,7 @@
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.model.BehaviorModel;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
import com.google.inject.Inject;
@@ -55,9 +56,9 @@
assertEquals(2, behaviors.size());
for (BehaviorModel model : behaviors) {
- String id = model.getBehaviorId();
- if (id != null && !id.isEmpty()) {
- assertEquals("my_behavior", id);
+ FacesId id = model.getId();
+ if (id != null ) {
+ assertEquals("my_behavior", id.toString());
}
}
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -40,6 +40,7 @@
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.annotations.JsfValidator;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.ValidatorModel;
import com.google.inject.Inject;
@@ -67,9 +68,9 @@
assertEquals(2, validators.size());
for (ValidatorModel model : validators) {
- String id = model.getValidatorId();
- if (id != null && !id.isEmpty()) {
- assertEquals("my_validator", id);
+ FacesId id = model.getId();
+ if (id != null ) {
+ assertEquals("my_validator", id.toString());
}
}
}
@@ -128,9 +129,9 @@
}
if (validatorClass != null) {
- assertEquals(model.getValidatorClass().toString(), validatorClass);
+ assertEquals(model.getTargetClass().toString(), validatorClass);
} else {
- assertNull(model.getValidatorClass());
+ assertNull(model.getTargetClass());
}
assertEquals(generate, model.isGenerate());
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/FreeMarkerRendererTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/FreeMarkerRendererTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/FreeMarkerRendererTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -8,6 +8,7 @@
import org.junit.Test;
import org.richfaces.cdk.CdkTestBase;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.FacesId;
public class FreeMarkerRendererTest extends CdkTestBase {
@Test
@@ -20,7 +21,7 @@
@Ignore
public void testProcessComponent() throws Exception {
final StringWriter output = new StringWriter();
- ComponentModel component = new ComponentModel(new
ComponentModel.Type("foo.Bar"));
+ ComponentModel component = new
ComponentModel(FacesId.parseId("foo.Bar"));
assertEquals("foo.Bar", output.toString());
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -31,8 +31,10 @@
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.model.BehaviorModel;
+import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.Property;
import com.google.inject.Inject;
@@ -53,8 +55,9 @@
expect(output.createOutput((String) anyObject(),
anyInt())).andReturn(outputWriter);
replay(output);
- BehaviorModel behavior = new BehaviorModel("foo.bar");
-
behavior.setClassNames("org.richfaces.cdk.generate.java.GeneratedBehavior",
"Object");
+ BehaviorModel behavior = new
BehaviorModel(FacesId.parseId("foo.bar"));
+
behavior.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedBehavior"));
+ behavior.setBaseClass(ClassName.parseName("Object"));
// TODO add test with types boolean, int, Integer, String, Object
addAttribute(behavior, "testValue", Object.class, true);
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -40,6 +40,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.Property;
import com.google.inject.Inject;
@@ -83,9 +84,10 @@
}
public static ComponentModel createComponent() {
- ComponentModel component = new ComponentModel(new
ComponentModel.Type("foo.bar"));
+ ComponentModel component = new
ComponentModel(FacesId.parseId("foo.bar"));
component.setGenerate(true);
-
component.setClassNames("org.richfaces.cdk.generate.java.GeneratedComponent",
UIOutput.class.getName());
+
component.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedComponent"));
+ component.setBaseClass(ClassName.parseName(UIOutput.class.getName()));
Property attribute = component.getOrCreateAttribute("testValue");
attribute.setType(new ClassName(Object.class));
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -31,9 +31,11 @@
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.freemarker.PropertyModel;
+import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.FacesId;
import com.google.inject.Inject;
@@ -54,8 +56,9 @@
replay(output);
ConverterModel converter = new ConverterModel();
- converter.setConverterId("foo.bar");
-
converter.setClassNames("org.richfaces.cdk.generate.java.GeneratedConverter",
"Object");
+ converter.setId(FacesId.parseId("foo.bar"));
+
converter.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedConverter"));
+ converter.setBaseClass(ClassName.parseName("Object"));
addAttribute(converter, "myClass", PropertyModel.class, true);
addAttribute(converter, "testObject", Object.class, true);
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -53,10 +53,12 @@
ComponentModel model = ComponentClassGeneratorTest.createComponent();
library.getComponents().add(model);
- ClassDescriptor handler = new
ClassDescriptor("org.richfaces.cdk.generate.java.GeneratedTagHandler",
- ComponentHandler.class.getName());
- TagModel tagModel = new TagModel(model, "mytag", handler);
+ TagModel tagModel = new TagModel();
+ tagModel.setName("mytag");
+ tagModel.setModel(model);
+
tagModel.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedTagHandler"));
+ tagModel.setTargetClass(ClassName.parseName(ComponentHandler.class.getName()));
generator.process(tagModel);
// System.out.println(outputWriter);
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -30,8 +30,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
+import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.model.ValidatorModel;
@@ -54,8 +56,9 @@
replay(output);
ValidatorModel validator = new ValidatorModel();
- validator.setValidatorId("foo.bar");
-
validator.setClassNames("org.richfaces.cdk.generate.java.GeneratedValidator",
"Object");
+ validator.setId(FacesId.parseId("foo.bar"));
+
validator.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedValidator"));
+ validator.setBaseClass(ClassName.parseName("Object"));
addAttribute(validator, "testValue", Object.class, true);
// TODO test with primitiv type 'boolean'
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/ValidatorTagGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/ValidatorTagGeneratorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/ValidatorTagGeneratorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -35,6 +35,7 @@
import org.richfaces.cdk.generate.taglib.ValidatorTagGenerator;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.model.ValidatorModel;
@@ -64,8 +65,8 @@
public void testGetOutputFileComponent() throws Exception {
final StringWriter outputWriter = new StringWriter();
- ValidatorModel validator = new ValidatorModel("foo.bar");
- validator.setGeneratedClass(UIOutput.class);
+ ValidatorModel validator = new
ValidatorModel(FacesId.parseId("foo.bar"));
+ validator.setTargetClass(ClassName.parseName(UIOutput.class.getName()));
validator.setGenerate(true);
Property attribute1 = createAttribute( "testValue", Object.class,
true);
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -51,7 +51,7 @@
@Test
public void testAcceptLibraryVisitorOfRPP() throws Exception {
ComponentLibrary lib = new ComponentLibrary();
- final ComponentModel component = new ComponentModel(new
ComponentModel.Type("foo.Bar"));
+ final ComponentModel component = new
ComponentModel(FacesId.parseId("foo.Bar"));
lib.getComponents().add(component);
LibraryVisitor<Boolean, Boolean> visitor = new LibraryVisitor<Boolean,
Boolean>() {
@Override
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -37,6 +37,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.FacesId;
import com.google.inject.Inject;
import org.richfaces.cdk.CdkTestRunner;
@@ -80,8 +81,8 @@
public void testVerifyNoTypeComponent() {
ComponentModel component = new ComponentModel();
ClassName className = new ClassName("foo.component.UIBar");
- ComponentModel.Type type = new ComponentModel.Type("foo.Bar");
- component.setGeneratedClass(className);
+ FacesId type = FacesId.parseId("foo.Bar");
+ component.setTargetClass(className);
expect(namiingConventions.inferComponentType(className)).andReturn(type);
expect(namiingConventions.inferUIComponentFamily(type)).andReturn("foo.baz");
replay(log,utils,namiingConventions);
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 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -106,9 +106,8 @@
assertEquals("Panel", component.getDisplayname());
assertFalse(component.isGenerate());
- FacetModel facet = Iterables.getOnlyElement(component.getFacets().values());
- String key = Iterables.getOnlyElement(component.getFacets().keySet());
- assertEquals("header", key);
+ FacetModel facet = Iterables.getOnlyElement(component.getFacets());
+ assertEquals("header", facet.getName());
assertEquals("Header facet", facet.getDescription());
assertTrue(facet.isGenerate());
Modified:
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 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -9,6 +9,7 @@
import org.junit.Ignore;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.xmlconfig.model.ComponentBean;
import org.richfaces.cdk.xmlconfig.model.PropertyBase;
@@ -24,10 +25,10 @@
@Test
@Ignore
public void testCreateAdapter() throws Exception {
- ComponentModel component = new ComponentModel(new ComponentModel.Type(FOO_BAR));
+ ComponentModel component = new ComponentModel(FacesId.parseId(FOO_BAR));
component.setDescription(FOO_DESCTIPTION);
- component.setGeneratedClass(FOO_UI_BAR);
+ component.setTargetClass(ClassName.parseName(FOO_UI_BAR));
component.getOrCreateAttribute(BAZ);
component.setFamily(FOO_FAMILY);
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -10,6 +10,7 @@
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
@@ -27,7 +28,7 @@
@Test
public void testMarshalResultStringT() throws Exception {
- ComponentModel component = new ComponentModel(new
ComponentModel.Type("foo.bar"));
+ ComponentModel component = new
ComponentModel(FacesId.parseId("foo.bar"));
library.getComponents().add(component);
RenderKitModel renderKit = library.addRenderKit("HTML");
RendererModel renderer = new RendererModel(new
RendererModel.Type("foo.Renderer"));
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/TaglibGeneratorVisitorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/TaglibGeneratorVisitorTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/TaglibGeneratorVisitorTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -37,8 +37,8 @@
@Test
public void generationTest() throws Exception {
- ValidatorModel validator = new ValidatorModel("foo.bar");
- validator.setGeneratedClass(UIOutput.class);
+ ValidatorModel validator = new
ValidatorModel(FacesId.parseId("foo.bar"));
+ validator.setTargetClass(ClassName.parseName(Object.class.getName()));
validator.setGenerate(true);
addAttribute(validator, "testValue", Object.class, true);
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -28,6 +28,7 @@
import org.richfaces.cdk.model.BehaviorModel;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.xmlconfig.XmlTest;
/**
@@ -40,8 +41,8 @@
public void testMarshal() throws Exception {
ComponentLibrary library = new ComponentLibrary();
- BehaviorModel behaviorModel = new BehaviorModel("my_behavior");
- behaviorModel.setGeneratedClass(Object.class);
+ BehaviorModel behaviorModel = new
BehaviorModel(FacesId.parseId("my_behavior"));
+ behaviorModel.setTargetClass(ClassName.parseName(Object.class.getName()));
library.getBehaviors().add(behaviorModel);
// Jaxb marshaling
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -25,6 +25,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConverterModel;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.xmlconfig.XmlTest;
import java.io.StringWriter;
@@ -39,8 +40,8 @@
public void testMarshal() throws Exception {
ComponentLibrary library = new ComponentLibrary();
- ConverterModel converterModel = new ConverterModel("my_converter");
- converterModel.setGeneratedClass(Object.class);
+ ConverterModel converterModel = new
ConverterModel(FacesId.parseId("my_converter"));
+ converterModel.setTargetClass(ClassName.parseName(Object.class.getName()));
library.getConverters().add(converterModel);
// Jaxb marshaling
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java 2010-03-08
16:19:26 UTC (rev 16536)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java 2010-03-09
01:17:56 UTC (rev 16537)
@@ -26,6 +26,7 @@
import org.junit.Test;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.ValidatorModel;
import org.richfaces.cdk.xmlconfig.XmlTest;
@@ -39,8 +40,8 @@
public void testMarshal() throws Exception {
ComponentLibrary library = new ComponentLibrary();
- ValidatorModel validatorModel = new ValidatorModel("my_validator");
- validatorModel.setGeneratedClass(Object.class);
+ ValidatorModel validatorModel = new
ValidatorModel(FacesId.parseId("my_validator"));
+ validatorModel.setTargetClass(ClassName.parseName(Object.class.getName()));
library.getValidators().add(validatorModel);
// Jaxb marshaling