Author: Alex.Kolonitsky
Date: 2010-04-21 08:21:21 -0400 (Wed, 21 Apr 2010)
New Revision: 16789
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.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/FacesId.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.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/ValidatorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/XmlTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java
Log:
RF-7826 Migrate A1 components to new CDK
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -78,15 +78,8 @@
descriptionProcessor.processDescription(attribute,
attributeAnnotarion.description(), beanProperty.getDocComment());
- String defaultValue = attributeAnnotarion.defaultValue();
- if (!Strings.isEmpty(defaultValue)) {
- if (STRING_NAME.equals(attribute.getType().toString())) {
- defaultValue = "\"" + defaultValue +
"\"";
- }
- attribute.setDefaultValue(defaultValue);
- }
+ setDefaultValue(attribute, attributeAnnotarion);
-
String suggestedValue = attributeAnnotarion.suggestedValue();
if (!Strings.isEmpty(suggestedValue)) {
attribute.setSuggestedValue(suggestedValue);
@@ -114,6 +107,42 @@
}
}
+ private void setDefaultValue(PropertyBase attribute, Attribute attributeAnnotarion)
{
+ String defaultValue = attributeAnnotarion.defaultValue();
+ if (Strings.isEmpty(defaultValue)) {
+ if (attribute.getType().isPrimitive()) {
+ if (isInstace(attribute, byte.class)) {
+ defaultValue = String.valueOf(false);
+ } else if (isInstace(attribute, int.class)) {
+ defaultValue = String.valueOf(Integer.MIN_VALUE);
+ } else if (isInstace(attribute, long.class)) {
+ defaultValue = String.valueOf(Long.MIN_VALUE);
+ } else if (isInstace(attribute, byte.class)) {
+ defaultValue = String.valueOf(Byte.MIN_VALUE);
+ } else if (isInstace(attribute, short.class)) {
+ defaultValue = String.valueOf(Short.MIN_VALUE);
+ } else if (isInstace(attribute, float.class)) {
+ defaultValue = String.valueOf(Float.MIN_VALUE);
+ } else if (isInstace(attribute, double.class)) {
+ defaultValue = String.valueOf(Double.MIN_VALUE);
+ } else if (isInstace(attribute, char.class)) {
+ defaultValue = String.valueOf(Character.MIN_VALUE);
+ }
+
+ attribute.setDefaultValue(defaultValue);
+ }
+ } else {
+ if (STRING_NAME.equals(attribute.getType().toString())) {
+ defaultValue = "\"" + defaultValue + "\"";
+ }
+ attribute.setDefaultValue(defaultValue);
+ }
+ }
+
+ private boolean isInstace(PropertyBase attribute, Class<?> byteClass) {
+ return byteClass.getSimpleName().equals(attribute.getType().getName());
+ }
+
private List<ClassName> getSignature(Signature signature, AnnotationValue
signatureMirror) {
if (signature == null) {
return null;
@@ -148,7 +177,6 @@
AnnotationValue params = signatureMirror.accept(new
EmptyAnnotationValueVisitor<AnnotationValue>() {
@Override
public AnnotationValue visitAnnotation(AnnotationMirror a, Object o) {
- log.debug("-14- AttributeProcessor.visit(" + a + ",
" + o + ")");
for (Map.Entry<? extends ExecutableElement, ? extends
AnnotationValue> entry : a.getElementValues().entrySet()) {
if
("parameters".equals(entry.getKey().getSimpleName().toString())) {
return entry.getValue();
@@ -161,7 +189,6 @@
List<? extends AnnotationValue> o = params.accept(new
EmptyAnnotationValueVisitor<List<? extends AnnotationValue>>(){
@Override
public List<? extends AnnotationValue> visitArray(List<? extends
AnnotationValue> vals, Object o) {
- log.debug("-15- AttributeProcessor.visit(" + vals + ",
" + o + ")");
return vals;
}
}, null);
@@ -170,7 +197,6 @@
parameters.add(annotationValue.accept(new
EmptyAnnotationValueVisitor<ClassName>() {
@Override
public ClassName visitType(TypeMirror t, Object o) {
- log.debug("-12- AttributeProcessor.visit(" + t +
", " + o + ")");
return new ClassName(t.toString());
}
}, null));
@@ -202,7 +228,7 @@
public void processType(final BeanModelBase component, TypeElement element) throws
CdkException {
log.debug("AttributesProcessorImpl.processType");
log.debug(" -> component = " + component);
- log.debug(" -> typeElement = " + element.getQualifiedName());
+ log.debug(" -> typeElement = " + element);
log.debug(" -- Process XML files with standard attributes
definitions.");
log.debug(" -> sourceUtils.visitSupertypes...");
@@ -213,7 +239,7 @@
public void visit(TypeMirror type) {
try {
log.debug(" -> visit - " + type.toString());
- component.getAttributes().addAll(
+ component.addAttributes(
parseProperties(CdkEntityResolver.URN_ATTRIBUTES +
type.toString() + ".xml"));
} catch (CdkException e) {
// TODO - log errors ?
@@ -247,8 +273,7 @@
// Process all files from @Jsf.. attributes property.
for (String attributes : attributesConfig) {
try {
- component.getAttributes().addAll(parseProperties(
- CdkEntityResolver.URN_ATTRIBUTES + attributes));
+ component.addAttributes(parseProperties(CdkEntityResolver.URN_ATTRIBUTES
+ attributes));
} catch (CdkException e) {
// TODO - log errors ?
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -23,17 +23,7 @@
package org.richfaces.cdk.apt.processors;
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.MirroredTypeException;
-import javax.lang.model.type.MirroredTypesException;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
-
+import com.google.inject.Inject;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.annotations.Event;
import org.richfaces.cdk.annotations.Facet;
@@ -51,7 +41,15 @@
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.util.Strings;
-import com.google.inject.Inject;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.MirroredTypeException;
+import javax.lang.model.type.MirroredTypesException;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
/**
* <p class="changed_added_4_0">
@@ -79,17 +77,20 @@
// Process class-level annotations.
ComponentModel component = new ComponentModel();
+
// Should that component be generated ?
setClassNames(componentElement, component, annotation.generate());
- setComponentProperties(componentElement, component, annotation, library);
+ setComponentProperties(componentElement, component, annotation);
+
// Process the second level annotations.
for (final SubComponent subcomponent : annotation.components()) {
JsfComponent subAnnotation = new JsfSubComponent(subcomponent, annotation);
ComponentModel subcomponentModel = new ComponentModel();
subcomponentModel.setBaseClass(component.getTargetClass());
subcomponentModel.setTargetClass(ClassName.parseName(subcomponent.generate()));
- setComponentProperties(null, subcomponentModel, subAnnotation, library);
+ setComponentProperties(null, subcomponentModel, subAnnotation);
}
+
library.getComponents().add(component);
}
@@ -98,25 +99,43 @@
* @param componentElement
* @param component
* @param annotation
- * @param library
* @throws CdkException
*/
void setComponentProperties(TypeElement componentElement, ComponentModel component,
- JsfComponent annotation, ComponentLibrary library) throws CdkException {
+ JsfComponent annotation) throws CdkException {
setComponentType(componentElement, component, annotation.type());
setComponeneFamily(componentElement, component, annotation.family());
setDescription(component, annotation.description(),
getDocComment(componentElement));
+ setRendererType(component, annotation.renderer());
processFacets(componentElement, component, annotation);
- processEvents(componentElement, component, annotation);
+ processAttributes(componentElement, component, annotation);
+ for (Tag tag : annotation.tag()) {
+ setTagInfo(tag, component);
+ }
+
+ // TODO - process @Test annotations.
+ }
+
+ private void setRendererType(ComponentModel component, JsfRenderer jsfRenderer) {
+ // TODO if jsfRenderer.empty set by naming convention
+
+ if (jsfRenderer != null && !Strings.isEmpty(jsfRenderer.type())) {
+ component.setRendererType(new RendererModel.Type(jsfRenderer.type()));
+ }
+ }
+
+ private void processAttributes(TypeElement componentElement, ComponentModel
component, JsfComponent annotation) {
AttributesProcessor attributesProcessor = getAttributeProcessor();
attributesProcessor.processXmlFragment(component, annotation.attributes());
- if(null != componentElement){
- attributesProcessor.processType(component,componentElement);
+
+ if (componentElement != null) {
+ attributesProcessor.processType(component, componentElement);
}
- Collection<ClassName> interfaceNames = component.getInterfaces();
+
+ Collection<ClassName> interfaceNames = component.getInterfaces();
try {
Class<?>[] interfaces = annotation.interfaces();
for (Class<?> clazz : interfaces) {
@@ -130,20 +149,11 @@
} catch (MirroredTypeException e) {
processInterface(component, attributesProcessor, e.getTypeMirror());
}
- for (Tag tag : annotation.tag()) {
- setTagInfo(tag, component);
- }
-
- JsfRenderer jsfRenderer = annotation.renderer();
- if(!Strings.isEmpty(jsfRenderer.type())){
- component.setRendererType(new RendererModel.Type(jsfRenderer.type()));
- }
- // TODO - process @Test annotations.
}
private void processInterface(ComponentModel component, AttributesProcessor
attributesProcessor, TypeMirror mirror) {
component.getInterfaces().add(ClassName.parseName(mirror.toString()));
- if(TypeKind.DECLARED.equals(mirror.getKind())){
+ if (TypeKind.DECLARED.equals(mirror.getKind())) {
attributesProcessor.processType(component,
getSourceUtils().asTypeElement(mirror));
} else {
// TODO - record warning.
@@ -154,6 +164,7 @@
if (!Strings.isEmpty(type)) {
component.setType(FacesId.parseId(type));
} else if (null != componentElement) {
+
// static final String COMPONENT_FAMILY = "...";
Object value = getSourceUtils().getConstant(componentElement,
COMPONENT_TYPE);
if (value != null) {
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-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -33,7 +33,7 @@
*/
public class BeanModelBase extends DescriptionGroupBase {
- private final ModelCollection<PropertyBase> attributes =
ModelCollection.<PropertyBase>create();
+ private final ModelMap<String, PropertyBase> attributes = ModelMap.<String,
PropertyBase>create();
/**
* <p class="changed_added_4_0">
@@ -43,17 +43,34 @@
* @return the attributes
*/
public Collection<PropertyBase> getAttributes() {
- return attributes;
+ return attributes.values();
}
+ public void addAttribute(PropertyBase attribute) {
+ if (attributes != null) {
+ this.attributes.put(attribute.getName(), attribute);
+ }
+ }
+
+ public void addAttributes(Iterable<? extends PropertyBase> attributes) {
+ if (attributes != null) {
+ for (PropertyBase attribute : attributes) {
+ addAttribute(attribute);
+ }
+ }
+ }
+
+ public int getAttributesCount() {
+ return this.attributes.size();
+ }
+
/**
* <p class="changed_added_4_0">Return bean attribute for given
name.</p>
* @param name
* @return
*/
public PropertyBase getAttribute(final String name) {
- // OPTIMIZATION keep HashMap for name-property pair for fast lookup.
- return attributes.find(new Named.NamedPredicate(name));
+ return attributes.get(name);
}
public PropertyBase getOrCreateAttribute(String attributeName) {
@@ -61,7 +78,7 @@
if (null == attribute) {
attribute = new PropertyModel();
attribute.setName(attributeName);
- attributes.add(attribute);
+ attributes.put(attributeName, attribute);
}
return attribute;
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-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -32,7 +32,7 @@
*
* @author asmirnov(a)exadel.com
*/
-public class FacesId implements Serializable {
+public class FacesId implements Serializable, Comparable<FacesId> {
private static final long serialVersionUID = -8199984910177820771L;
private final String type;
@@ -108,4 +108,9 @@
return true;
}
+
+ @Override
+ public int compareTo(FacesId o) {
+ return type.compareTo(o.getType());
+ }
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -23,14 +23,14 @@
package org.richfaces.cdk.model;
-import java.util.LinkedHashMap;
+import java.util.TreeMap;
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public class ModelMap<K, E extends ModelElement<? super E>> extends
LinkedHashMap<K, E> {
+public class ModelMap<K, E extends ModelElement<? super E>> extends
TreeMap<K, E> {
public static <I, T extends ModelElement<? super T>> ModelMap<I, T>
create() {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -205,15 +205,13 @@
renderer.setRendersChildren(rendersChildren);
}
- Collection<PropertyBase> rendererAttributes = renderer.getAttributes();
-
List<ImportAttributes> attributesImports =
compositeInterface.getAttributesImports();
if (attributesImports != null) {
for (ImportAttributes attributesImport : attributesImports) {
String importURI = attributesImport.getSource();
Collection<PropertyBase> properties =
fragmentParser.parseProperties(importURI);
if (properties != null) {
- rendererAttributes.addAll(properties);
+ renderer.addAttributes(properties);
}
}
}
@@ -221,7 +219,7 @@
List<Attribute> templateAttributes = compositeInterface.getAttributes();
if (templateAttributes != null) {
for (Attribute templateAttribute : templateAttributes) {
- rendererAttributes.add(buildProperty(templateAttribute));
+ renderer.addAttribute(buildProperty(templateAttribute));
}
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -35,7 +35,7 @@
@Override
protected void postUnmarshal(Bean bean, Model model) {
- model.getAttributes().addAll(bean.getAllProperties());
+ model.addAttributes(bean.getAllProperties());
}
@Override
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -54,6 +54,16 @@
return this.attributes;
}
+ public void addAttributes(List<AttributeModel> attributes) {
+ if (attributes == null) {
+ return;
+ }
+
+ for (AttributeModel attribute : attributes) {
+// this.attributes.
+ }
+ }
+
public void setAttributes(List<AttributeModel> attributes) {
this.attributes = attributes;
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -45,6 +45,7 @@
import org.richfaces.cdk.Output;
import org.richfaces.cdk.Outputs;
import org.richfaces.cdk.Stub;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.apt.processors.CdkAnnotationProcessor;
import org.richfaces.cdk.apt.processors.AnnotationProcessorTest;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -97,6 +98,9 @@
@Mock
private ModelValidator validator;
+ @Mock
+ private Logger log;
+
@Override
public void configure(Binder binder) {
super.configure(binder);
@@ -138,7 +142,9 @@
builder.generate();
expectLastCall();
replay(log, element, roundEnv, builder, validator, cdkProcessor);
+
processor.process(Collections.singleton(element), roundEnv);
+
verify(log, element, roundEnv, builder, validator, cdkProcessor);
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -90,10 +90,12 @@
@Test
public void testGetTask() throws AptException, Exception {
expect(output.getFolders()).andReturn(null);
- replay(log, processor, output);
+ replay(processor, output);
+
CompilationTask task = factory.get();
+
assertNotNull(task);
- verify(log, processor, output);
+ verify(processor, output);
}
@Test
@@ -109,14 +111,14 @@
expect(processor.process(capture(capturedTypes),
EasyMock.<RoundEnvironment> anyObject())).andReturn(true)
.times(2);
- replay(log, processor, output);
+ replay(processor, output);
CompilationTask task = factory.get();
assertTrue(task.call());
Set<? extends TypeElement> elements = capturedTypes.getValue();
assertFalse(elements.isEmpty());
assertEquals("TestAnnotation2",
elements.iterator().next().getSimpleName().toString());
- verify(log, processor, output);
+ verify(processor, output);
}
@Override
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -94,7 +94,7 @@
@Source(Sources.JAVA_SOURCES)
protected FileManager sources;
- @Mock
+ @Inject
protected Logger log;
@Inject
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.MockController;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
@@ -66,15 +67,16 @@
@Inject
private AttributesProcessorImpl processor;
-
+
@Mock
private DescriptionProcessor descriptionProcessor;
-
+
@Mock
private JAXB xmlProcessor;
-
+
@Mock
private SourceUtils utils;
+
/**
* Test method for {@link
org.richfaces.cdk.apt.processors.AttributesProcessorImpl#processType(org.richfaces.cdk.model.BeanModelBase,
javax.lang.model.element.TypeElement)}.
*/
@@ -92,7 +94,7 @@
mockController.replay();replay(element,beanProperty);
processor.processType(bean, element);
mockController.verify();verify(element,beanProperty);
- assertEquals(1, bean.getAttributes().size());
+ assertEquals(1, bean.getAttributesCount());
}
/**
@@ -109,7 +111,7 @@
mockController.replay();
processor.processXmlFragment(bean, FOO_XML);
mockController.verify();
- assertEquals(1, bean.getAttributes().size());
+ assertEquals(1, bean.getAttributesCount());
}
@Override
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -23,14 +23,18 @@
package org.richfaces.cdk.apt.processors;
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.TypeElement;
-
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.same;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
@@ -45,14 +49,14 @@
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
-import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.xmlconfig.JAXB;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
+import java.util.Collections;
/**
* <p class="changed_added_4_0">
@@ -119,9 +123,9 @@
public void testSetClassNames() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier>emptySet());
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
processor.setClassNames(componentElement, model,"");
- verify(log, utils, componentElement, jaxb,annotation );
+ verify(utils, componentElement, jaxb,annotation );
assertFalse(model.isGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
@@ -137,9 +141,11 @@
public void testSetClassNames1() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier>singleton(Modifier.ABSTRACT));
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setClassNames(componentElement, model,"");
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertTrue(model.isGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
@@ -154,9 +160,11 @@
public void testSetClassNames2() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier>emptySet());
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setClassNames(componentElement, model,FOO_HTML_BAR);
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertTrue(model.isGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertEquals(FOO_HTML_BAR,model.getTargetClass().toString());
@@ -164,29 +172,33 @@
@Test
public void testSetFamily() throws Exception {
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setComponeneFamily(componentElement, model,FOO_HTML_BAR);
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertEquals(FOO_HTML_BAR, model.getFamily());
}
@Test
public void testSetFamily1() throws Exception {
- TestName fooBar = new TestName(FOO_BAR);
expect(utils.getConstant(same(componentElement),
eq(ComponentProcessor.COMPONENT_FAMILY))).andReturn(FOO_HTML_BAR);
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setComponeneFamily(componentElement, model,"");
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertEquals(FOO_HTML_BAR, model.getFamily());
}
@Test
public void testSetFamily2() throws Exception {
- TestName fooBar = new TestName(FOO_BAR);
expect(utils.getConstant(same(componentElement),
eq(ComponentProcessor.COMPONENT_FAMILY))).andReturn(null);
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setComponeneFamily(componentElement, model,"");
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertNull( model.getFamily());
}
@@ -207,9 +219,11 @@
// expect(this.description.largeIcon()).andReturn("");
//
expect(this.description.displayName()).andReturn("fooFacet").times(2);
// expect(this.description.value()).andReturn("");
- replay(log, utils, componentElement, jaxb,
annotation,property,facet,description);
+ replay(utils, componentElement, jaxb, annotation,property,facet,description);
+
processor.processFacets(componentElement, model, annotation);
- verify(log, utils, componentElement,
jaxb,annotation,property,facet,description);
+
+ verify(utils, componentElement, jaxb,annotation,property,facet,description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
assertTrue(facetModel.isGenerate());
@@ -230,9 +244,11 @@
// expect(this.description.largeIcon()).andReturn("");
//
expect(this.description.displayName()).andReturn("fooFacet").times(2);
// expect(this.description.value()).andReturn("");
- replay(log, utils, componentElement, jaxb,
annotation,property,facet,description);
+ replay(utils, componentElement, jaxb, annotation,property,facet,description);
+
processor.processFacets(componentElement, model, annotation);
- verify(log, utils, componentElement,
jaxb,annotation,property,facet,description);
+
+ verify(utils, componentElement, jaxb,annotation,property,facet,description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
assertTrue(facetModel.isGenerate());
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -32,6 +32,7 @@
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.Output;
import org.richfaces.cdk.Outputs;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.generate.freemarker.CdkConfiguration;
import org.richfaces.cdk.generate.freemarker.LibraryModelWrapper;
import org.richfaces.cdk.model.ClassName;
@@ -69,6 +70,9 @@
@Output(Outputs.RESOURCES)
protected FileManager output;
+ @Inject
+ protected Logger log;
+
protected static PropertyBase addAttribute(ModelElementBase model, String
attributeName, Class<?> type, boolean generate) {
PropertyBase attribute = model.getOrCreateAttribute(attributeName);
attribute.setType(new ClassName(type));
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-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -73,9 +73,10 @@
ComponentLibrary library = new ComponentLibrary();
library.getBehaviors().add(behavior);
+
generator.generate(behavior);
+ log.debug(outputWriter.toString());
-// System.out.println(outputWriter);
verify(output);
compare(outputWriter, "GeneratedBehavior.java");
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -32,7 +32,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.EventName;
@@ -60,9 +59,6 @@
@Inject
private ComponentClassGenerator generator;
- @Inject
- private Logger log;
-
@Test
public void testGetOutputFileComponent() throws Exception {
final StringWriter outputWriter = new StringWriter();
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-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -31,7 +31,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.generate.freemarker.PropertyModel;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -52,9 +51,6 @@
@Inject
private ConverterClassGenerator generator;
- @Inject
- private Logger log;
-
@Test
public void testGetOutputFileValidator() throws Exception {
final StringWriter outputWriter = new StringWriter();
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-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -73,9 +73,10 @@
ComponentLibrary library = new ComponentLibrary();
library.getValidators().add(validator);
+
generator.generate(validator);
+ log.debug(outputWriter.toString());
-// System.out.println(outputWriter);
verify(output);
compare(outputWriter, "GeneratedValidator.java");
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/XmlTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/XmlTest.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/XmlTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -25,23 +25,33 @@
import org.custommonkey.xmlunit.Validator;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Assert;
+import org.junit.runner.RunWith;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.CdkTestRunner;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
+import com.google.inject.Inject;
+
/**
* @author akolonitsky
* @since Jan 13, 2010
*/
+(a)RunWith(CdkTestRunner.class)
public abstract class XmlTest extends JaxbTestBase {
+
static {
XMLUnit.setControlEntityResolver(new CdkEntityResolver());
}
+ @Inject
+ protected Logger log;
+
protected void validateXml(StringWriter facesConfig, String schemaLocation) throws
SAXException, IOException {
InputSource is = new InputSource(new StringReader(facesConfig.toString()));
Validator validator = new Validator(is);
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-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -51,13 +51,13 @@
AttributeModel attributeModel = new AttributeModel();
attributeModel.setName("attr2");
attributeModel.setType(new ClassName(String.class));
- behaviorModel.getAttributes().add(attributeModel);
+ behaviorModel.addAttribute(attributeModel);
library.getBehaviors().add(behaviorModel);
// Jaxb marshaling
StringWriter facesConfig = generateFacesConfig(library);
-// System.out.println(facesConfig.toString());
+ log.debug(facesConfig.toString());
// Checks
checkXmlStructure(facesConfig);
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -39,13 +39,29 @@
}
+ private Boolean testFlag;
+
+
private Object testValue;
- private Boolean testFlag;
+ public void setTestFlag(Boolean testFlag) {
+ this.testFlag = testFlag;
+ }
+ public Boolean isTestFlag() {
+ if (testFlag != null) {
+ return testFlag;
+ }
+ ValueBinding vb = getValueBinding("testFlag");
+ if (null != vb) {
+ return (Boolean) vb.getValue(getFacesContext());
+ }
+
+ return testFlag;
+ }
public void setTestValue(Object testValue) {
this.testValue = testValue;
}
@@ -62,22 +78,6 @@
return testValue;
}
- public void setTestFlag(Boolean testFlag) {
- this.testFlag = testFlag;
- }
-
- public Boolean isTestFlag() {
- if (testFlag != null) {
- return testFlag;
- }
-
- ValueBinding vb = getValueBinding("testFlag");
- if (null != vb) {
- return (Boolean) vb.getValue(getFacesContext());
- }
-
- return testFlag;
- }
private static FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
@@ -94,8 +94,8 @@
}
if (!initialStateMarked()) {
Object values[] = new Object[1];
- values[0] = this.getTestValue();
- values[1] = this.isTestFlag();
+ values[0] = this.isTestFlag();
+ values[1] = this.getTestValue();
return values;
}
@@ -112,8 +112,8 @@
}
Object values[] = (Object[]) state;
- setTestValue((Object) values[0]);
- setTestFlag((Boolean) values[1]);
+ setTestFlag((Boolean) values[0]);
+ setTestValue((Object) values[1]);
}
private boolean transientValue = false;
@@ -145,4 +145,4 @@
public void clearInitialState() {
initialState = false;
}
-}
+}
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -68,33 +68,41 @@
}
protected static enum Properties {
- testValue,
- testFlag,
+ list,
+ listInteger,
+ listStrings,
testBinding,
testExpr,
- listStrings,
- listInteger,
- list
+ testFlag,
+ testValue
}
- public Object getTestValue() {
- return (Object) getStateHelper().eval(Properties.testValue);
+ public ArrayList getList() {
+ return (ArrayList) getStateHelper().eval(Properties.list);
}
- public void setTestValue(Object testValue) {
- getStateHelper().put(Properties.testValue, testValue);
+ public void setList(ArrayList list) {
+ getStateHelper().put(Properties.list, list);
}
- public Boolean isTestFlag() {
- return Boolean.valueOf(getStateHelper().eval(Properties.testFlag).toString());
+ public ArrayList getListInteger() {
+ return (ArrayList) getStateHelper().eval(Properties.listInteger);
}
- public void setTestFlag(Boolean testFlag) {
- getStateHelper().put(Properties.testFlag, testFlag);
+ public void setListInteger(ArrayList listInteger) {
+ getStateHelper().put(Properties.listInteger, listInteger);
}
+ public ArrayList getListStrings() {
+ return (ArrayList) getStateHelper().eval(Properties.listStrings);
+ }
+
+ public void setListStrings(ArrayList listStrings) {
+ getStateHelper().put(Properties.listStrings, listStrings);
+ }
+
public MethodBinding getTestBinding() {
return (MethodBinding) getStateHelper().get(Properties.testBinding);
}
@@ -111,27 +119,19 @@
getStateHelper().put(Properties.testExpr, testExpr);
}
- public ArrayList getListStrings() {
- return (ArrayList) getStateHelper().eval(Properties.listStrings);
+ public Boolean isTestFlag() {
+ return Boolean.valueOf(getStateHelper().eval(Properties.testFlag).toString());
}
- public void setListStrings(ArrayList listStrings) {
- getStateHelper().put(Properties.listStrings, listStrings);
+ public void setTestFlag(Boolean testFlag) {
+ getStateHelper().put(Properties.testFlag, testFlag);
}
- public ArrayList getListInteger() {
- return (ArrayList) getStateHelper().eval(Properties.listInteger);
+ public Object getTestValue() {
+ return (Object) getStateHelper().eval(Properties.testValue);
}
- public void setListInteger(ArrayList listInteger) {
- getStateHelper().put(Properties.listInteger, listInteger);
+ public void setTestValue(Object testValue) {
+ getStateHelper().put(Properties.testValue, testValue);
}
-
- public ArrayList getList() {
- return (ArrayList) getStateHelper().eval(Properties.list);
- }
-
- public void setList(ArrayList list) {
- getStateHelper().put(Properties.list, list);
- }
}
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -48,9 +48,9 @@
protected enum Properties {
myClass,
- testObject,
testBoolean,
testInteger,
+ testObject,
visible
}
@@ -63,14 +63,6 @@
getStateHelper().put(Properties.myClass, myClass);
}
- public Object getTestObject() {
- return (Object) getStateHelper().eval(Properties.testObject);
- }
-
- public void setTestObject(Object testObject) {
- getStateHelper().put(Properties.testObject, testObject);
- }
-
public Boolean isTestBoolean() {
return
Boolean.valueOf(getStateHelper().eval(Properties.testBoolean).toString());
}
@@ -87,6 +79,14 @@
getStateHelper().put(Properties.testInteger, testInteger);
}
+ public Object getTestObject() {
+ return (Object) getStateHelper().eval(Properties.testObject);
+ }
+
+ public void setTestObject(Object testObject) {
+ getStateHelper().put(Properties.testObject, testObject);
+ }
+
public boolean isVisible() {
return Boolean.valueOf(getStateHelper().eval(Properties.visible).toString());
}
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java 2010-04-21
07:36:09 UTC (rev 16788)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java 2010-04-21
12:21:21 UTC (rev 16789)
@@ -41,13 +41,29 @@
}
+ private Boolean testFlag;
+
+
private Object testValue;
- private Boolean testFlag;
+ public void setTestFlag(Boolean testFlag) {
+ this.testFlag = testFlag;
+ }
+ public Boolean isTestFlag() {
+ if (testFlag != null) {
+ return testFlag;
+ }
+ ValueBinding vb = getValueBinding("testFlag");
+ if (null != vb) {
+ return (Boolean) vb.getValue(getFacesContext());
+ }
+
+ return testFlag;
+ }
public void setTestValue(Object testValue) {
this.testValue = testValue;
}
@@ -64,22 +80,6 @@
return testValue;
}
- public void setTestFlag(Boolean testFlag) {
- this.testFlag = testFlag;
- }
-
- public Boolean isTestFlag() {
- if (testFlag != null) {
- return testFlag;
- }
-
- ValueBinding vb = getValueBinding("testFlag");
- if (null != vb) {
- return (Boolean) vb.getValue(getFacesContext());
- }
-
- return testFlag;
- }
private static FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
@@ -96,8 +96,8 @@
}
if (!initialStateMarked()) {
Object values[] = new Object[1];
- values[0] = this.getTestValue();
- values[1] = this.isTestFlag();
+ values[0] = this.isTestFlag();
+ values[1] = this.getTestValue();
return values;
}
@@ -114,8 +114,8 @@
}
Object values[] = (Object[]) state;
- setTestValue((Object) values[0]);
- setTestFlag((Boolean) values[1]);
+ setTestFlag((Boolean) values[0]);
+ setTestValue((Object) values[1]);
}
private boolean transientValue = false;
@@ -147,4 +147,4 @@
public void clearInitialState() {
initialState = false;
}
-}
+}
\ No newline at end of file