JBoss Rich Faces SVN: r20903 - trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2011-01-06 06:50:02 -0500 (Thu, 06 Jan 2011)
New Revision: 20903
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java
Log:
https://issues.jboss.org/browse/RF-10133
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java 2011-01-06 10:27:53 UTC (rev 20902)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java 2011-01-06 11:50:02 UTC (rev 20903)
@@ -20,7 +20,6 @@
public class FileUploadBean implements Serializable {
private ArrayList<UploadedFile> files = new ArrayList<UploadedFile>();
- private int uploadsAvailable = 5;
public void paint(OutputStream stream, Object object) throws IOException {
stream.write(getFiles().get((Integer) object).getData());
@@ -29,12 +28,10 @@
public void listener(FileUploadEvent event) throws Exception {
files.add(event.getUploadedFile());
- uploadsAvailable--;
}
public String clearUploadData() {
files.clear();
- setUploadsAvailable(5);
return null;
}
@@ -58,12 +55,4 @@
return System.currentTimeMillis();
}
- public int getUploadsAvailable() {
- return uploadsAvailable;
- }
-
- public void setUploadsAvailable(int uploadsAvailable) {
- this.uploadsAvailable = uploadsAvailable;
- }
-
}
13 years, 11 months
JBoss Rich Faces SVN: r20902 - modules/tests/archetypes/richfaces-simpleapp-ftest/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-06 05:27:53 -0500 (Thu, 06 Jan 2011)
New Revision: 20902
Modified:
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/pom.xml
Log:
suppressed stopping of jboss as it fails in jboss6x profile
Modified: modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/pom.xml
===================================================================
--- modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/pom.xml 2011-01-06 00:59:41 UTC (rev 20901)
+++ modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/pom.xml 2011-01-06 10:27:53 UTC (rev 20902)
@@ -101,6 +101,16 @@
<branchBase>https://svn.jboss.org/repos/richfaces/modules/tests/archetypes/richfaces-...</branchBase>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>stop-container</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
13 years, 11 months
JBoss Rich Faces SVN: r20901 - in trunk/cdk: generator/src/main/java/org/richfaces/cdk/generate/freemarker and 14 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-05 19:59:41 -0500 (Wed, 05 Jan 2011)
New Revision: 20901
Added:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java
trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java
trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ClassName.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java
trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml
trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/pom.xml
trunk/cdk/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
Log:
RESOLVED - issue RF-10105: CDK: impossible to import configuration files from project
https://issues.jboss.org/browse/RF-10105
RESOLVED - issue RF-9323
https://issues.jboss.org/browse/RF-9323
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -2,15 +2,12 @@
import java.beans.PropertyDescriptor;
import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.Map.Entry;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
@@ -28,18 +25,39 @@
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.InvalidNameException;
import org.richfaces.cdk.util.PropertyUtils;
import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import com.google.inject.Inject;
+/**
+ * <p class="changed_added_4_0">
+ * Implementation to use in annotation processor.
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
public class AptSourceUtils implements SourceUtils {
- private static final Set<String> PROPERTIES =
- new HashSet<String>(Arrays.asList("getEventNames", "getDefaultEventName", "getClientBehaviors", "getFamily"));
+ private static final String IS = "is";
+ private static final int IS_LENGTH = IS.length();
+
+ private static final String GET = "get";
+
+ private static final String SET = "set";
+
+ private static final int SET_LENGTH = SET.length();
+
+ private static final int GET_LENGTH = GET.length();
+
+ private static final ImmutableSet<String> HIDDEN_PROPERTIES = ImmutableSet.of("eventNames", "defaultEventName",
+ "clientBehaviors", "family", "class");
+
private final ProcessingEnvironment processingEnv;
@Inject
@@ -66,153 +84,144 @@
*/
public Set<BeanProperty> getBeanPropertiesAnnotatedWith(Class<? extends Annotation> annotation, TypeElement type) {
Set<BeanProperty> properties = new HashSet<BeanProperty>();
- List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
-
- // Get all methods and fields annotated by annotation.
- for (Element childElement : members) {
- boolean annotated = null != childElement.getAnnotation(annotation);
- if (!annotated) {
- continue;
+ Map<String, AptBeanProperty> beanProperties = getBeanProperties(type);
+ for (BeanProperty beanProperty : beanProperties.values()) {
+ if (beanProperty.isAnnotationPresent(annotation)) {
+ properties.add(beanProperty);
}
-
- // Have an annotation, infer property name.
- if (ElementKind.METHOD.equals(childElement.getKind())) {
- processMethod(properties, childElement, annotated);
- } else if (ElementKind.FIELD.equals(childElement.getKind())) {
- processFiled(properties, childElement);
- }
-
- // TODO - merge properties with same name ?
}
-
return properties;
}
public Set<BeanProperty> getAbstractBeanProperties(TypeElement type) {
- log.debug("AptSourceUtils.getAbstractBeanProperties");
- log.debug(" - type = " + type);
-
Set<BeanProperty> properties = new HashSet<BeanProperty>();
- List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
-
- Map<String, List<ExecutableElement>> props = groupMethodsBySignature(members);
- removeNotAbstractGroups(props);
-
- for (List<ExecutableElement> methods : props.values()) {
- ExecutableElement method = methods.get(0);
-
- if (ElementKind.METHOD.equals(method.getKind()) && !PROPERTIES.contains(method.getSimpleName().toString())) {
- processMethod(properties, method, false);
+ Map<String, AptBeanProperty> beanProperties = getBeanProperties(type);
+ for (BeanProperty beanProperty : beanProperties.values()) {
+ if (!beanProperty.isExists()) {
+ properties.add(beanProperty);
}
-
- // TODO - merge properties with same name ?
}
-
return properties;
}
- private void removeNotAbstractGroups(Map<String, List<ExecutableElement>> props) {
- List<String> removeKeys = new ArrayList<String>();
- for (Map.Entry<String, List<ExecutableElement>> entry : props.entrySet()) {
- List<ExecutableElement> value = entry.getValue();
- for (ExecutableElement element : value) {
- if (!isAbstract(element)) {
- removeKeys.add(entry.getKey());
- }
- }
- }
+ @Override
+ public BeanProperty getBeanProperty(ClassName type, final String name) {
+ return getBeanProperty(asTypeElement(type), name);
+ }
- for (String removeKey : removeKeys) {
- props.remove(removeKey);
+ @Override
+ public BeanProperty getBeanProperty(TypeElement type, final String name) {
+ Map<String, AptBeanProperty> beanProperties = getBeanProperties(type);
+ if (beanProperties.containsKey(name)) {
+ return beanProperties.get(name);
+ } else {
+ return new PropertyImpl(name);
}
}
- private Map<String, List<ExecutableElement>> groupMethodsBySignature(List<? extends Element> members) {
- Map<String, List<ExecutableElement>> props = new HashMap<String, List<ExecutableElement>>();
+ /**
+ * <p class="changed_added_4_0">
+ * Utility method to get all bean properties, similar to Introspector
+ * </p>
+ *
+ * @param type
+ * @return
+ */
+ Map<String, AptBeanProperty> getBeanProperties(TypeElement type) {
+ List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
+ // extract all getters/setters.
+ Map<String, AptBeanProperty> result = Maps.newHashMap();
for (Element element : members) {
- if (ElementKind.METHOD.equals(element.getKind())
- && !PROPERTIES.contains(element.getSimpleName().toString())) {
-
+ if (ElementKind.METHOD.equals(element.getKind())) {
ExecutableElement method = (ExecutableElement) element;
-
- String signature = getSignature(method);
-
- List<ExecutableElement> methods = props.get(signature);
- if (methods == null) {
- methods = new ArrayList<ExecutableElement>(5);
- props.put(signature, methods);
- }
-
- methods.add(method);
+ processMethod(type, result, method);
}
}
- return props;
+ return result;
}
- private String getSignature(ExecutableElement method) {
- String name = method.getSimpleName().toString();
- List<? extends VariableElement> methodParams = method.getParameters();
- StringBuilder builder = new StringBuilder(name);
- for (VariableElement methodParam : methodParams) {
- builder.append(":").append(methodParam.getKind().name());
+ private void processMethod(TypeElement type, Map<String, AptBeanProperty> result, ExecutableElement method) {
+ if (isPublicNonStatic(method)) {
+ if (isGetter(method)) {
+ processBeanPropertyAccessor(type, result, method, false);
+ } else if (isSetter(method)) {
+ processBeanPropertyAccessor(type, result, method, true);
+ }
}
- return builder.toString();
}
- private void processFiled(Set<BeanProperty> properties, Element childElement) {
- AptBeanProperty property = new AptBeanProperty(childElement.getSimpleName().toString());
+ private void processBeanPropertyAccessor(TypeElement type, Map<String, AptBeanProperty> result,
+ ExecutableElement method, boolean setter) {
+ String propertyName = getPropertyName(method);
+ if (!HIDDEN_PROPERTIES.contains(propertyName)) {
+ ClassName propertyType = asClassDescription(setter?method.getParameters().get(0).asType():method.getReturnType());
+ if (result.containsKey(propertyName)) {
+ // Merge property with existed one.
+ AptBeanProperty beanProperty = result.get(propertyName);
+ checkPropertyType(type, propertyName, propertyType, beanProperty);
+ if (null != (setter?beanProperty.setter:beanProperty.getter)) {
+ log.warn("Two " + (setter ? "setter" : "getter") + " methods for the same bean property "
+ + propertyName + " in the class " + type.getQualifiedName());
+ if(!method.getModifiers().contains(Modifier.ABSTRACT)){
+ beanProperty.setAccessMethod(method, setter);
+ }
+ } else {
+ beanProperty.setAccessMethod(method, setter);
+ }
+ } else {
+ AptBeanProperty beanProperty = new AptBeanProperty(propertyName);
+ beanProperty.setAccessMethod(method, setter);
+ beanProperty.type = propertyType;
+ result.put(propertyName, beanProperty);
+ }
- property.type = asClassDescription(childElement.asType());
- property.element = childElement;
+ }
+ }
- // TODO - find getter/setter, check them for abstract.
- property.exists = true;
-
- properties.add(property);
+ private String getPropertyName(ExecutableElement method) {
+ return PropertyUtils.methodToName(method.getSimpleName().toString());
}
- private void processMethod(Set<BeanProperty> properties, Element childElement, boolean annotated) {
- ExecutableElement method = (ExecutableElement) childElement;
- boolean exists = !isAbstract(method);
- if (!annotated && exists) {
- log.debug(" - " + childElement.getSimpleName() + " : didn't annotated and didn't abstract.");
- return;
+ private void checkPropertyType(TypeElement type, String propertyName, ClassName propertyType,
+ AptBeanProperty beanProperty) {
+ if (!propertyType.equals(beanProperty.type)) {
+ log.warn("Unambiguious type for bean property " + propertyName + " in the class " + type.getQualifiedName());
}
+ }
- TypeMirror propertyType = method.getReturnType();
- List<? extends VariableElement> parameters = method.getParameters();
- if (TypeKind.VOID.equals(propertyType.getKind()) && 1 == parameters.size()) {
+ private boolean isAbstract(ExecutableElement method) {
+ return method.getModifiers().contains(Modifier.ABSTRACT);
+ }
- // That is setter method, get type from parameter.
- propertyType = parameters.get(0).asType();
- } else if (!parameters.isEmpty()) {
- // TODO Invalid method signature for a bean property,
- // throw exception ?
- log.debug(" - " + childElement.getSimpleName() + " : Invalid method signature for a bean property.");
- return;
- }
+ private boolean isPublicNonStatic(ExecutableElement method) {
+ Set<Modifier> modifiers = method.getModifiers();
+ return modifiers.contains(Modifier.PUBLIC) && !modifiers.contains(Modifier.STATIC);
+ }
- try {
- String name = PropertyUtils.methodToName(childElement.getSimpleName().toString());
- AptBeanProperty property = new AptBeanProperty(name);
+ private boolean isGetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return (isGetterName(methodName) || isBooleanGetterName(methodName)) && 0 == e.getParameters().size();
+ }
- property.type = asClassDescription(propertyType);
- property.element = childElement;
- property.exists = exists;
+ private boolean isGetterName(String methodName) {
+ return methodName.startsWith(GET) && methodName.length() > GET_LENGTH
+ && Character.isUpperCase(methodName.charAt(GET_LENGTH));
+ }
- properties.add(property);
- log.debug(" - " + childElement.getSimpleName() + " : was added.");
+ private boolean isBooleanGetterName(String methodName) {
+ return methodName.startsWith(IS) && methodName.length() > IS_LENGTH
+ && Character.isUpperCase(methodName.charAt(IS_LENGTH));
+ }
- } catch (InvalidNameException e) {
- log.debug(" - " + childElement.getSimpleName() + " : Invalid method name for a bean property, throw.");
-
- // TODO Invalid method name for a bean property, throw
- // exception ?
- }
+ private boolean isSetter(ExecutableElement e) {
+ String methodName = e.getSimpleName().toString();
+ return isSetterName(methodName) && 1 == e.getParameters().size() && !e.isVarArgs()
+ && TypeKind.VOID.equals(e.getReturnType().getKind());
}
- private boolean isAbstract(ExecutableElement method) {
- return method.getModifiers().contains(Modifier.ABSTRACT);
+ private boolean isSetterName(String methodName) {
+ return methodName.startsWith(SET) && methodName.length() > SET_LENGTH
+ && Character.isUpperCase(methodName.charAt(SET_LENGTH));
}
private ClassName asClassDescription(TypeMirror type) {
@@ -242,12 +251,12 @@
return null != element.getAnnotation(annotationType);
}
-
@Override
- public boolean isAnnotationPropertyPresent(AnnotationMirror annotation, final String propertyName){
- return Iterables.any(getAnnotationValuesMap(annotation).entrySet(), new AnnotationAttributePredicate(propertyName));
+ public boolean isAnnotationPropertyPresent(AnnotationMirror annotation, final String propertyName) {
+ return Iterables.any(getAnnotationValuesMap(annotation).entrySet(), new AnnotationAttributePredicate(
+ propertyName));
}
-
+
@Override
public boolean isDefaultValue(AnnotationMirror annotation, String propertyName) {
Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> attributeEntry =
@@ -255,7 +264,6 @@
return !annotation.getElementValues().containsKey(attributeEntry.getKey());
}
- @SuppressWarnings("unchecked")
@Override
public <T> T getAnnotationValue(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> attributeEntry =
@@ -264,6 +272,7 @@
return convertAnnotationValue(expectedType, annotationValue);
}
+ @SuppressWarnings("unchecked")
private <T> T convertAnnotationValue(Class<T> expectedType, AnnotationValue annotationValue) {
if (Enum.class.isAssignableFrom(expectedType)) {
VariableElement variable = (VariableElement) annotationValue.getValue();
@@ -275,7 +284,6 @@
AnnotationMirror value = (AnnotationMirror) annotationValue.getValue();
return (T) value;
} else {
- // TODO - check value for expected type.
return (T) annotationValue.getValue();
}
}
@@ -285,7 +293,8 @@
public <T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> attributeEntry =
findAnnotationProperty(annotation, propertyName);
- List<? extends AnnotationValue>annotationValues = (List<? extends AnnotationValue>) attributeEntry.getValue().getValue();
+ List<? extends AnnotationValue> annotationValues =
+ (List<? extends AnnotationValue>) attributeEntry.getValue().getValue();
List<T> values = Lists.newArrayList();
for (AnnotationValue annotationValue : annotationValues) {
values.add(convertAnnotationValue(expectedType, annotationValue));
@@ -296,43 +305,57 @@
private Entry<? extends ExecutableElement, ? extends AnnotationValue> findAnnotationProperty(
AnnotationMirror annotation, final String propertyName) {
try {
- return Iterables.find(getAnnotationValuesMap(annotation).entrySet(),
- new AnnotationAttributePredicate(propertyName));
+ return Iterables.find(getAnnotationValuesMap(annotation).entrySet(), new AnnotationAttributePredicate(
+ propertyName));
} catch (NoSuchElementException e) {
throw new CdkException("Attribute " + propertyName + " not found for annotation "
+ annotation.getAnnotationType().toString());
}
}
- private Map<? extends ExecutableElement, ? extends AnnotationValue> getAnnotationValuesMap(AnnotationMirror annotation) {
+ private Map<? extends ExecutableElement, ? extends AnnotationValue> getAnnotationValuesMap(
+ AnnotationMirror annotation) {
return processingEnv.getElementUtils().getElementValuesWithDefaults(annotation);
}
/**
- * <p class="changed_added_4_0">Set model property to the corresponding annotation attribute, if annotation attribute set to non-default value.</p>
- * @param model Model object.
- * @param annotation annotation to copy property from.
- * @param modelProperty bean attribute name in the model and annotation.
+ * <p class="changed_added_4_0">
+ * Set model property to the corresponding annotation attribute, if annotation attribute set to non-default value.
+ * </p>
+ *
+ * @param model
+ * Model object.
+ * @param annotation
+ * annotation to copy property from.
+ * @param modelProperty
+ * bean attribute name in the model and annotation.
*/
@Override
public void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty) {
- setModelProperty(model, annotation, modelProperty, modelProperty);
+ setModelProperty(model, annotation, modelProperty, modelProperty);
}
/**
- * <p class="changed_added_4_0">Set model property to the corresponding annotation attribute, if annotation attribute set to non-default value.</p>
- * @param model Model object.
- * @param annotation annotation to copy property from.
- * @param modelProperty bean attribute name in model.
- * @param annotationAttribute annotation attribute name.
+ * <p class="changed_added_4_0">
+ * Set model property to the corresponding annotation attribute, if annotation attribute set to non-default value.
+ * </p>
+ *
+ * @param model
+ * Model object.
+ * @param annotation
+ * annotation to copy property from.
+ * @param modelProperty
+ * bean attribute name in model.
+ * @param annotationAttribute
+ * annotation attribute name.
*/
@Override
- public void setModelProperty(Object model, AnnotationMirror annotation,
- String modelProperty, String annotationAttribute) {
+ public void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty,
+ String annotationAttribute) {
if (!isDefaultValue(annotation, annotationAttribute)) {
PropertyDescriptor propertyDescriptor = PropertyUtils.getPropertyDescriptor(model, modelProperty);
- PropertyUtils.setPropertyValue(model, modelProperty, getAnnotationValue(annotation,
- annotationAttribute, propertyDescriptor.getPropertyType()));
+ PropertyUtils.setPropertyValue(model, modelProperty,
+ getAnnotationValue(annotation, annotationAttribute, propertyDescriptor.getPropertyType()));
}
}
@@ -364,11 +387,14 @@
visitor.visit(type);
}
- @Override
- public TypeElement asTypeElement(ClassName type) {
+ private TypeElement asTypeElement(ClassName type) {
return processingEnv.getElementUtils().getTypeElement(type.toString());
}
+ public boolean isClassExists(ClassName type){
+ return null != asTypeElement(type);
+ }
+
@Override
public TypeElement asTypeElement(TypeMirror mirror) {
if (TypeKind.DECLARED.equals(mirror.getKind())) {
@@ -378,6 +404,13 @@
}
}
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
private static final class AnnotationAttributePredicate implements
Predicate<Map.Entry<? extends ExecutableElement, ? extends AnnotationValue>> {
private final String propertyName;
@@ -401,8 +434,8 @@
*
*/
protected final class AptBeanProperty implements BeanProperty {
- private Element element;
- private boolean exists;
+ private ExecutableElement getter;
+ private ExecutableElement setter;
private final String name;
private ClassName type;
@@ -416,6 +449,103 @@
this.name = name;
}
+ void setAccessMethod(ExecutableElement method, boolean setter) {
+ if (setter) {
+ this.setter = method;
+ } else {
+ this.getter = method;
+ }
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * Get JavaDoc comment of appropriate bean property element.
+ * </p>
+ *
+ * @return
+ */
+ public String getDocComment() {
+ String comment = getMethodComment(getter);
+ if (null == comment) {
+ comment = getMethodComment(setter);
+ }
+ return comment;
+ }
+
+ private String getMethodComment(ExecutableElement method) {
+ if (null != method) {
+ return processingEnv.getElementUtils().getDocComment(method);
+ } else {
+ return null;
+ }
+ }
+
+ public ClassName getType() {
+ return type;
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @return the exists
+ */
+ public boolean isExists() {
+ return !(isAbstract(getter) || isAbstract(setter));
+ }
+
+ private boolean isAbstract(ExecutableElement method) {
+ return null != method && method.getModifiers().contains(Modifier.ABSTRACT);
+ }
+
+ public AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType) {
+ if (isAnnotationPresent(getter, annotationType)) {
+ return AptSourceUtils.this.getAnnotationMirror(getter, annotationType);
+ } else if (isAnnotationPresent(setter, annotationType)) {
+ return AptSourceUtils.this.getAnnotationMirror(setter, annotationType);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
+ return isAnnotationPresent(getter, annotationType) || isAnnotationPresent(setter, annotationType);
+ }
+
+ @Override
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+ if (isAnnotationPresent(getter, annotationType)) {
+ return getter.getAnnotation(annotationType);
+ } else if (isAnnotationPresent(setter, annotationType)) {
+ return setter.getAnnotation(annotationType);
+ }
+ return null;
+ }
+
+ private <T extends Annotation> boolean isAnnotationPresent(ExecutableElement method, Class<T> annotationType) {
+ return null != method && null != method.getAnnotation(annotationType);
+ }
+
+ @Override
+ public ACCESS_TYPE getAccessType() {
+ if (null != getter && null != setter) {
+ return ACCESS_TYPE.readWrite;
+ } else if (null == setter) {
+ return ACCESS_TYPE.readOnly;
+ }
+ return ACCESS_TYPE.writeOnly;
+ }
+
/*
* (non-Javadoc)
*
@@ -463,48 +593,10 @@
return true;
}
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @return the name
- */
- public String getName() {
- return name;
+ @Override
+ public String toString() {
+ return name + "[" + getType() + "]";
}
-
- /**
- * <p class="changed_added_4_0">
- * Get JavaDoc comment of appropriate bean property element.
- * </p>
- *
- * @return
- */
- public String getDocComment() {
- return processingEnv.getElementUtils().getDocComment(element);
- }
-
- public ClassName getType() {
- return type;
- }
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @return the exists
- */
- public boolean isExists() {
- return exists;
- }
-
- public AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType) {
- return AptSourceUtils.this.getAnnotationMirror(element, annotationType);
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
- return element.getAnnotation(annotationType);
- }
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -36,8 +36,8 @@
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
-import javax.tools.Diagnostic.Kind;
+import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.LibraryBuilder;
import org.richfaces.cdk.Logger;
@@ -96,52 +96,65 @@
for (CdkAnnotationProcessor process : processors) {
processAnnotation(process, roundEnv);
}
- } else {
+ } else {
// parse non-java sources
processNonJavaSources();
+ verify();
+ if (0 == log.getErrorCount()) {
+ generate();
+ }
}
return false;
}
- /* (non-Javadoc)
+ private void generate() {
+ log.debug("Generate output files");
+ builder.generate(library);
+ }
+
+ private void verify() {
+ try {
+ log.debug("Validate model");
+ validator.verify(library);
+
+ } catch (CdkException e) {
+ sendError(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.apt.CdkProcessor#processNonJavaSources()
*/
public void processNonJavaSources() {
for (ModelBuilder builder : builders) {
- log.debug("Run builder "+builder.getClass().getName());
- builder.build();
+ log.debug("Run builder " + builder.getClass().getName());
+ try {
+ builder.build();
+
+ } catch (CdkException e) {
+ sendError(e);
+ }
}
- // validator should be called even if previvous phases finish with errors, to collect all possible problems.
- log.debug("Validate model");
- validator.verify(library);
- if(0 == log.getErrorCount()) {
- // processing over, generate files.
- log.debug("Generate output files");
- builder.generate(library);
- }
}
protected void processAnnotation(CdkAnnotationProcessor processor, RoundEnvironment environment) {
Class<? extends Annotation> processedAnnotation = processor.getProcessedAnnotation();
- log.debug("Process all elements annotated with "+processedAnnotation.getName());
+ log.debug("Process all elements annotated with " + processedAnnotation.getName());
Target target = processedAnnotation.getAnnotation(Target.class);
- try {
- Set<? extends Element> rootElements = environment.getRootElements();
- for (Element element : rootElements) {
- if (isAppropriateTarget(element, target)){
- processElement(processor, processedAnnotation, element);
- } else {
- for (Element enclosedElement : element.getEnclosedElements()) {
- if (isAppropriateTarget(enclosedElement, target)){
- processElement(processor, processedAnnotation, enclosedElement);
- }
+ Set<? extends Element> rootElements = environment.getRootElements();
+ for (Element element : rootElements) {
+ if (isAppropriateTarget(element, target)) {
+ processElement(processor, processedAnnotation, element);
+ } else {
+ for (Element enclosedElement : element.getEnclosedElements()) {
+ if (isAppropriateTarget(enclosedElement, target)) {
+ processElement(processor, processedAnnotation, enclosedElement);
}
}
}
- } catch (Exception e) {
- processingEnv.getMessager().printMessage(Kind.ERROR,
- "Errorr processing annotation " + processedAnnotation + ": " + e);
}
}
@@ -149,22 +162,23 @@
Element element) {
if (null != element.getAnnotation(processedAnnotation)) {
try {
- log.debug("Process "+element.getSimpleName()+" annotated with "+processedAnnotation.getName());
+ log.debug("Process " + element.getSimpleName() + " annotated with " + processedAnnotation.getName());
processor.process(element, library);
} catch (CdkProcessingException e) {
sendError(element, e);
}
}
}
-
- private boolean isAppropriateTarget(Element element,Target target){
+
+ private boolean isAppropriateTarget(Element element, Target target) {
boolean match = false;
ElementKind kind = element.getKind();
- if(null != target){
- for(ElementType targetType : target.value()){
+ if (null != target) {
+ for (ElementType targetType : target.value()) {
switch (targetType) {
case TYPE:
- match |= ElementKind.CLASS.equals(kind)||ElementKind.INTERFACE.equals(kind)||ElementKind.ENUM.equals(kind);
+ match |= ElementKind.CLASS.equals(kind) || ElementKind.INTERFACE.equals(kind)
+ || ElementKind.ENUM.equals(kind);
break;
case PACKAGE:
match |= ElementKind.PACKAGE.equals(kind);
@@ -181,19 +195,22 @@
}
} else {
// Annotation without @Target match any element.
- match =
- ElementKind.CLASS.equals(kind) || ElementKind.INTERFACE.equals(kind) || ElementKind.ENUM.equals(kind)
- || ElementKind.PACKAGE.equals(kind) || ElementKind.METHOD.equals(kind)
- || ElementKind.FIELD.equals(kind);
+ match = ElementKind.CLASS.equals(kind) || ElementKind.INTERFACE.equals(kind)
+ || ElementKind.ENUM.equals(kind) || ElementKind.PACKAGE.equals(kind) || ElementKind.METHOD.equals(kind)
+ || ElementKind.FIELD.equals(kind);
}
return match;
}
- protected void sendError(Element componentElement, CdkProcessingException e) {
+ protected void sendError(Element componentElement, Exception e) {
// rise error and continue.
processingEnv.getMessager().printMessage(javax.tools.Diagnostic.Kind.ERROR, e.getMessage(), componentElement);
}
+ protected void sendError(CdkException e) {
+ processingEnv.getMessager().printMessage(javax.tools.Diagnostic.Kind.ERROR, e.getMessage());
+ }
+
@Override
public Set<String> getSupportedAnnotationTypes() {
return PROCESSED_ANNOTATION;
Added: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java (rev 0)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -0,0 +1,57 @@
+package org.richfaces.cdk.apt;
+
+import java.lang.annotation.Annotation;
+
+import javax.lang.model.element.AnnotationMirror;
+
+import org.richfaces.cdk.apt.SourceUtils.ACCESS_TYPE;
+import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
+import org.richfaces.cdk.model.ClassName;
+
+public final class PropertyImpl implements BeanProperty {
+ private final String name;
+
+ public PropertyImpl(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean isExists() {
+ return false;
+ }
+
+ @Override
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
+ return false;
+ }
+
+ @Override
+ public ClassName getType() {
+ return ClassName.get(Object.class);
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String getDocComment() {
+ return null;
+ }
+
+ @Override
+ public AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType) {
+ return null;
+ }
+
+ @Override
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+ return null;
+ }
+
+ @Override
+ public ACCESS_TYPE getAccessType() {
+ return ACCESS_TYPE.readWrite;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -49,9 +49,8 @@
}
@Override
- public TypeElement asTypeElement(ClassName type) {
- // TODO Auto-generated method stub
- return null;
+ public boolean isClassExists(ClassName type) {
+ return true;
}
@Override
@@ -67,6 +66,17 @@
}
@Override
+ public BeanProperty getBeanProperty(TypeElement type, String name) {
+ return getBeanProperty(type, name);
+ }
+
+ @Override
+ public BeanProperty getBeanProperty(ClassName type, String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
public Object getConstant(TypeElement element, String name) {
// TODO Auto-generated method stub
return null;
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -59,6 +59,11 @@
void visit(TypeMirror type);
}
+ enum ACCESS_TYPE {
+ readOnly,
+ writeOnly,
+ readWrite
+ }
/**
* <p class="changed_added_4_0">
* </p>
@@ -85,19 +90,28 @@
*/
String getDocComment();
+ /**
+ * <p class="changed_added_4_0">Bean property type</p>
+ * @return
+ */
ClassName getType();
/**
- * <p class="changed_added_4_0">
+ * <p class="changed_added_4_0">Is this property implementted by component
* </p>
*
* @return the exists
*/
boolean isExists();
+
+ boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType);
<T extends Annotation> T getAnnotation(Class<T> annotationType);
+
+ ACCESS_TYPE getAccessType();
+
}
/**
@@ -119,8 +133,25 @@
* @return
*/
Set<BeanProperty> getAbstractBeanProperties(TypeElement type);
+
+
+ /**
+ * <p class="changed_added_4_0">Get bean property descriptor for particular type.</p>
+ * @param type
+ * @param name
+ * @return
+ */
+ BeanProperty getBeanProperty(TypeElement type, String name);
/**
+ * <p class="changed_added_4_0">Get bean property descriptor for particular type.</p>
+ * @param type
+ * @param name
+ * @return
+ */
+ BeanProperty getBeanProperty(ClassName type, String name);
+
+ /**
* <p class="changed_added_4_0">
* Get JavaDoc comments associated with given element.
* </p>
@@ -172,6 +203,14 @@
<T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType);
/**
+ * <p class="changed_added_4_0"></p>
+ * @param annotation
+ * @param propertyName
+ * @return
+ */
+ public abstract boolean isAnnotationPropertyPresent(AnnotationMirror annotation, final String propertyName);
+
+ /**
* <p class="changed_added_4_0">Check annotation proprrty for default value.</p>
* @param annotation
* @param propertyName
@@ -179,6 +218,23 @@
*/
boolean isDefaultValue(AnnotationMirror annotation, String propertyName);
/**
+ * <p class="changed_added_4_0"></p>
+ * @param model
+ * @param annotation
+ * @param modelProperty
+ * @param annotationAttribute
+ */
+ public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty, String annotationAttribute);
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param model
+ * @param annotation
+ * @param modelProperty
+ */
+ public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty);
+
+ /**
* <p class="changed_added_4_0">
* </p>
*
@@ -203,7 +259,7 @@
* </p>
*
* @param mirror
- * @return
+ * @return The Element for given type
*/
TypeElement asTypeElement(TypeMirror mirror);
@@ -212,14 +268,8 @@
* </p>
*
* @param type
- * @return
+ * @return true if class already exist in project source or dependent libraries.
*/
- TypeElement asTypeElement(ClassName type);
+ boolean isClassExists(ClassName type);
- public abstract boolean isAnnotationPropertyPresent(AnnotationMirror annotation, final String propertyName);
-
- public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty, String annotationAttribute);
-
- public abstract void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty);
-
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -124,7 +124,7 @@
Set<ClassName> result = Sets.newTreeSet();
for (PropertyBase entry : model.getAttributes()) {
- if (entry.isGenerate() && !isPredefined(entry)) {
+ if (entry.getGenerate() && !isPredefined(entry)) {
result.add(entry.getType());
}
}
@@ -244,7 +244,7 @@
@Override
public boolean apply(PropertyBase input) {
- return input.isGenerate();
+ return input.getGenerate();
}
}));
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -52,7 +52,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<BehaviorModel> models = library.getBehaviors();
for (BehaviorModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -55,7 +55,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ComponentModel> models = library.getComponents();
for (ComponentModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -52,7 +52,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ConverterModel> models = library.getConverters();
for (ConverterModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -51,7 +51,7 @@
public void render(ComponentLibrary library) throws CdkException {
Collection<ValidatorModel> models = library.getValidators();
for (ValidatorModel model : models) {
- if (model.isGenerate()) {
+ if (model.getGenerate()) {
this.generate(library, model);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -99,7 +99,7 @@
* <p class="changed_added_4_0"></p>
* @return the generate
*/
- public boolean isGenerate() {
+ public Boolean getGenerate() {
return this.generate;
}
@@ -107,7 +107,7 @@
* <p class="changed_added_4_0"></p>
* @param generate the generate to set
*/
- public void setGenerate(boolean generate) {
+ public void setGenerate(Boolean generate) {
this.generate = generate;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ClassName.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ClassName.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ClassName.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -52,6 +52,18 @@
.put(double.class.getName(), Double.class.getName())
.build();
+ private static final ImmutableMap<String, String> DEFAULT_VALUES =
+ ImmutableMap.<String, String>builder()
+ .put(boolean.class.getName(), "Boolean.FALSE")
+ .put(byte.class.getName(), "Byte.MIN_VALUE")
+ .put(char.class.getName(), "Character.MIN_VALUE")
+ .put(short.class.getName(), "Short.MIN_VALUE")
+ .put(int.class.getName(), "Integer.MIN_VALUE")
+ .put(long.class.getName(), "Long.MIN_VALUE")
+ .put(float.class.getName(), "Float.MIN_VALUE")
+ .put(double.class.getName(), "Double.MIN_VALUE")
+ .build();
+
private final String boxingClassName;
private final String fullName;
@@ -196,6 +208,9 @@
return primitive;
}
+ public String getDefaultValue(){
+ return DEFAULT_VALUES.get(name);
+ }
/**
* <p class="changed_added_4_0">
* </p>
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -61,7 +61,6 @@
ComponentLibrary.merge(getFacets(), otherComponent.getFacets());
ComponentLibrary.merge(getEvents(), otherComponent.getEvents());
ComponentLibrary.merge(this, otherComponent);
- this.setGenerate(this.isGenerate() || otherComponent.isGenerate());
}
@Override
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -31,7 +31,7 @@
/**
* <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
*/
- private boolean generate = false;
+ private Boolean generate ;
/**
* <p class="changed_added_4_0">
@@ -83,11 +83,11 @@
}
@Merge
- public boolean isGenerate() {
+ public Boolean getGenerate() {
return generate;
}
- public void setGenerate(boolean generate) {
+ public void setGenerate(Boolean generate) {
this.generate = generate;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -91,12 +91,12 @@
* <p class="changed_added_4_0"></p>
* @return
*/
- public boolean isGenerate();
+ public Boolean getGenerate();
/**
* <p class="changed_added_4_0"></p>
* @param generate
*/
- public void setGenerate(boolean generate);
+ public void setGenerate(Boolean generate);
}
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -293,9 +293,7 @@
@Override
public void merge(PropertyBase other) {
- boolean generate = isGenerate();
ComponentLibrary.merge(this, other);
- setGenerate(generate || other.isGenerate());
}
public <R,D> R accept(Visitor<R,D> visitor, D data) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -44,8 +44,6 @@
private FacesId id;
- private boolean generate;
-
public RenderKitModel() {
}
@@ -100,22 +98,6 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the generate
- */
- public boolean isGenerate() {
- return this.generate;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param generate the generate to set
- */
- public void setGenerate(boolean generate) {
- this.generate = generate;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
* @return the renderers
*/
public ModelCollection<RendererModel> getRenderers() {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -45,6 +45,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.model.EventModel;
import org.richfaces.cdk.model.FacesComponent;
@@ -56,9 +57,11 @@
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.model.TagModel;
import org.richfaces.cdk.model.Taglib;
+import org.richfaces.cdk.model.ValidatorModel;
import org.richfaces.cdk.util.Strings;
import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
@@ -132,7 +135,78 @@
throw new CallbackException("Cannot infer Java class name for behavior " + this.behavior);
}
}
+
+ private final class ConverterTypeCallback implements NamingConventionsCallback {
+ private final ConverterModel converter;
+
+ public ConverterTypeCallback(ConverterModel converter) {
+ this.converter = converter;
+ }
+ @Override
+ public FacesId inferType(ClassName targetClass) throws CallbackException {
+ // TODO use actual methods
+ return namingConventions.inferComponentType(targetClass);
+ }
+
+ @Override
+ public FacesId inferType() throws CallbackException {
+ throw new CallbackException("Cannot infer type for converter " + this.converter);
+ }
+
+ @Override
+ public ClassName inferClass(FacesId id) throws CallbackException {
+ throw new CallbackException("Cannot infer target Java class name for converter " + this.converter);
+ }
+
+ @Override
+ public ClassName getDefaultBaseClass() throws CallbackException {
+ throw new CallbackException("Cannot infer base Java class name for converter " + this.converter);
+ }
+
+ @Override
+ public ClassName getDefaultClass() throws CallbackException {
+ return ClassName.get(Object.class);
+ }
+
+ }
+
+ private final class ValidatorTypeCallback implements NamingConventionsCallback {
+
+ private final ValidatorModel validator;
+
+ public ValidatorTypeCallback(ValidatorModel validator) {
+ this.validator = validator;
+ }
+
+ @Override
+ public FacesId inferType(ClassName targetClass) throws CallbackException {
+ // TODO use actual methods
+ return namingConventions.inferComponentType(targetClass);
+ }
+
+ @Override
+ public FacesId inferType() throws CallbackException {
+ throw new CallbackException("Cannot infer type for validator " + this.validator);
+ }
+
+ @Override
+ public ClassName inferClass(FacesId id) throws CallbackException {
+ throw new CallbackException("Cannot infer target Java class name for validator " + this.validator);
+ }
+
+ @Override
+ public ClassName getDefaultBaseClass() throws CallbackException {
+ throw new CallbackException("Cannot infer default Java class name for validator " + this.validator);
+ }
+
+ @Override
+ public ClassName getDefaultClass() throws CallbackException {
+ return ClassName.get(Object.class);
+ }
+
+ }
+
private final class RendererTypeCallback implements NamingConventionsCallback {
private final ComponentLibrary library;
private final RendererModel renderer;
@@ -197,6 +271,8 @@
public static final ClassName DEFAULT_VALIDATOR_HANDLER = new ClassName(ValidatorHandler.class);
public static final ClassName DEFAULT_CONVERTER_HANDLER = new ClassName(ConverterHandler.class);
public static final ClassName DEFAULT_BEHAVIOR_HANDLER = new ClassName(BehaviorHandler.class);
+ public static final ImmutableSet<String> SPECIAL_PROPERTIES = ImmutableSet.of("eventNames", "defaultEventName",
+ "clientBehaviors", "family");
@Inject
private Logger log;
@@ -223,8 +299,23 @@
verifyBehaviors(library);
verifyRenderers(library);
verifyTaglib(library);
+ verifyConverters(library);
+ verifyValidators(library);
}
+ private void verifyValidators(ComponentLibrary library) {
+ for (ValidatorModel validator : library.getValidators()) {
+ verifyTypes(validator, new ValidatorTypeCallback(validator));
+ }
+
+ }
+
+ protected void verifyConverters(ComponentLibrary library) {
+ for (ConverterModel converter : library.getConverters()) {
+ verifyTypes(converter, new ConverterTypeCallback(converter));
+ }
+ }
+
protected void verifyEvents(ComponentLibrary library) {
for (EventModel event : library.getEvents()) {
ClassName listenerInterface = event.getListenerInterface();
@@ -232,7 +323,7 @@
// TODO - infer listener interface name.
}
SourceUtils sourceUtils = sourceUtilsProvider.get();
- event.setGenerateListener(null == sourceUtils.asTypeElement(listenerInterface));
+ event.setGenerateListener(!sourceUtils.isClassExists(listenerInterface));
String methodName = event.getListenerMethod();
if (null == methodName) {
// TODO infer listener method name.
@@ -243,7 +334,7 @@
if (null == sourceInterface) {
// TODO - infer source interface.
}
- event.setGenerateSource(null == sourceUtils.asTypeElement(sourceInterface));
+ event.setGenerateSource(!sourceUtils.isClassExists(sourceInterface));
// Propagate event to corresponding components.
for (ComponentModel component : library.getComponents()) {
for (EventModel componentEvent : component.getEvents()) {
@@ -278,7 +369,7 @@
}
// Verify tags. If we have renderer-specific component, it should have a tag ?
for (ComponentModel component : library.getComponents()) {
- if(null != component.getRendererType() && component.getTags().isEmpty()){
+ if (null != component.getRendererType() && component.getTags().isEmpty()) {
TagModel tag = new TagModel();
verifyTag(tag, component.getId(), DEFAULT_COMPONENT_HANDLER);
component.getTags().add(tag);
@@ -360,14 +451,7 @@
if (null != component.getBaseClass()) {
try {
// Step one, lookup for parent.
- ComponentModel parentComponent =
- Iterables.find(library.getComponents(), new Predicate<ComponentModel>() {
-
- @Override
- public boolean apply(ComponentModel input) {
- return component.getBaseClass().equals(input.getTargetClass());
- }
- });
+ ComponentModel parentComponent = findParent(library.getComponents(), component);
// To be sure what all properties for parent component were propagated.
verifyComponentAttributes(library, parentComponent, verified);
for (PropertyBase parentAttribute : parentComponent.getAttributes()) {
@@ -382,7 +466,7 @@
} // Check attributes.
for (PropertyBase attribute : component.getAttributes()) {
- verifyAttribute(attribute, component.isGenerate());
+ verifyAttribute(attribute, component);
}
// compact(component.getAttributes());
// Check renderers.
@@ -397,12 +481,23 @@
}
}
+ private <T extends FacesComponent> T findParent(Iterable<T> components, final T component)
+ throws NoSuchElementException {
+ return Iterables.find(components, new Predicate<T>() {
+
+ @Override
+ public boolean apply(T input) {
+ return component.getBaseClass().equals(input.getTargetClass());
+ }
+ });
+ }
+
protected void verifyTag(TagModel tag, FacesId id, ClassName handler) {
if (Strings.isEmpty(tag.getName())) {
String defaultTagName = namingConventions.inferTagName(id);
tag.setName(defaultTagName);
}
- if(null == tag.getType()){
+ if (null == tag.getType()) {
tag.setType(TagType.Facelets);
}
if (tag.isGenerate()) {
@@ -457,14 +552,14 @@
}
}
// Check classes.
- if (component.isGenerate()) {
- if (null == component.getBaseClass()) {
- component.setBaseClass(callback.getDefaultBaseClass());
- // return;
- }
+ if (null == component.getGenerate()) {
if (null == component.getTargetClass()) {
component.setTargetClass(callback.inferClass(component.getId()));
}
+ component.setGenerate(!sourceUtilsProvider.get().isClassExists(component.getTargetClass()));
+ }
+ if (component.getGenerate()) {
+ verifyGeneratedClasses(component, callback);
} else if (null == component.getTargetClass()) {
if (null == component.getBaseClass()) {
component.setBaseClass(callback.getDefaultClass());
@@ -478,7 +573,17 @@
return true;
}
- protected void verifyAttribute(PropertyBase attribute, boolean generatedComponent) {
+ private void verifyGeneratedClasses(FacesComponent component, NamingConventionsCallback callback) throws CallbackException {
+ if (null == component.getBaseClass()) {
+ component.setBaseClass(callback.getDefaultBaseClass());
+ // return;
+ }
+ if (null == component.getTargetClass()) {
+ component.setTargetClass(callback.inferClass(component.getId()));
+ }
+ }
+
+ protected void verifyAttribute(PropertyBase attribute, FacesComponent component) {
// Check name.
if (Strings.isEmpty(attribute.getName())) {
log.error("No name for attribute " + attribute);
@@ -493,6 +598,10 @@
if (null == attribute.getType()) {
log.error("Unknown type of attribute [" + attribute.getName() + "]");
return;
+ }
+ if(attribute.getType().isPrimitive() && null == attribute.getDefaultValue()){
+ // Set default value for primitive
+ attribute.setDefaultValue(attribute.getType().getDefaultValue());
}
// Check binding properties.
if ("javax.faces.el.MethodBinding".equals(attribute.getType().getName())) {
@@ -505,9 +614,20 @@
// log.error("Signature for method expression attribute "+attribute.getName()+" has not been set");
// }
// Check "generate" flag.
- if (generatedComponent) {
+ if (Boolean.TRUE.equals(component.getGenerate())) {
// TODO Attribute should be only generated if it does not exist or abstract in the base class.
// Step one - check base class
+ SourceUtils sourceUtils = sourceUtilsProvider.get();
+ if (SPECIAL_PROPERTIES.contains(attribute.getName())) {
+ attribute.setGenerate(false);
+ } else if (null == attribute.getGenerate()) {
+ if (sourceUtils.isClassExists(component.getBaseClass())) {
+ attribute.setGenerate(!sourceUtils.getBeanProperty(component.getBaseClass(), attribute.getName())
+ .isExists());
+ } else {
+ attribute.setGenerate(true);
+ }
+ }
} else {
attribute.setGenerate(false);
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -74,8 +74,8 @@
addImport(new JavaImportImpl(name));
}
- public void addImport(String name, boolean _static) {
- addImport(new JavaImportImpl(name, _static));
+ public void addImport(String name, boolean staticImport) {
+ addImport(new JavaImportImpl(name, staticImport));
}
public void addImport(Class<?> claz) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaImportImpl.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -33,7 +33,7 @@
private String name;
- private boolean _static;
+ private boolean staticImport;
public JavaImportImpl(String name) {
this(name, false);
@@ -43,14 +43,14 @@
this(clazz.getName());
}
- public JavaImportImpl(String name, boolean _static) {
+ public JavaImportImpl(String name, boolean staticImport) {
super();
this.name = name;
- this._static = _static;
+ this.staticImport = staticImport;
}
- public JavaImportImpl(Class<?> clazz, boolean _static) {
- this(clazz.getName(), _static);
+ public JavaImportImpl(Class<?> clazz, boolean staticImport) {
+ this(clazz.getName(), staticImport);
}
public String getName() {
@@ -58,7 +58,7 @@
}
public boolean isStatic() {
- return _static;
+ return staticImport;
}
public boolean isDefault() {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClassImport.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -32,47 +32,47 @@
*/
public class ClassImport {
- @XmlAttribute(required = true)
- @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
- private String _package;
+ private String packageName;
- @XmlAttribute
- private boolean _static;
+ private boolean staticImport;
- @XmlAttribute
private List<String> names;
/**
* @return the package_
*/
+ @XmlAttribute(required = true)
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
public String getPackage() {
- return _package;
+ return packageName;
}
/**
- * @param _package the package_ to set
+ * @param packageName the package_ to set
*/
- public void setPackage(String _package) {
- this._package = _package;
+ public void setPackage(String packageName) {
+ this.packageName = packageName;
}
/**
* @return the static_
*/
+ @XmlAttribute
public boolean isStatic() {
- return _static;
+ return staticImport;
}
/**
* @param static_ the static_ to set
*/
- public void setStatic(boolean _static) {
- this._static = _static;
+ public void setStatic(boolean staticImport) {
+ this.staticImport = staticImport;
}
/**
* @return the classes
*/
+ @XmlAttribute
public List<String> getNames() {
return names;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -80,11 +80,6 @@
}
}
- private static String[] transformClassesToClassNames(Class<?>[] s) {
- Iterator<String> transformed = transform(forArray(s), CLASS_TO_CLASS_NAME);
- return toArray(transformed, String.class);
- }
-
private HelperMethod(String name, String returnType, String... argumentTypes) {
this.name = name;
this.returnType = returnType;
@@ -95,6 +90,11 @@
this(name, CLASS_TO_CLASS_NAME.apply(returnType), transformClassesToClassNames(argumentTypes));
}
+ private static String[] transformClassesToClassNames(Class<?>[] s) {
+ Iterator<String> transformed = transform(forArray(s), CLASS_TO_CLASS_NAME);
+ return toArray(transformed, String.class);
+ }
+
public String getName() {
return name;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/ScriptOptionStatement.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -79,11 +79,12 @@
}
/**
- * @param value the value to set
+ * @param value
+ * the value to set
*/
public void setValueExpression(String valueExpression) {
try {
- this.value = parser.parse(valueExpression, this, TypesFactory.OBJECT_TYPE);
+ this.value = parser.parse(valueExpression, this, TypesFactory.OBJECT_TYPE);
} catch (ParsingException e) {
logger.error("Error parse scriptOption value expression: " + valueExpression, e);
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -27,7 +27,6 @@
import org.richfaces.cdk.generate.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.templatecompiler.TemplateModel;
-import com.google.common.collect.Sets;
import com.google.inject.Inject;
/**
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -3,7 +3,6 @@
import static org.junit.Assert.*;
import java.util.List;
-import java.util.Set;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.AnnotationMirror;
@@ -13,9 +12,7 @@
import org.richfaces.cdk.apt.TestAnnotation.TestEnum;
import org.richfaces.cdk.model.ClassName;
-import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
public class AptSourceUtilsAnnotationsTest extends SourceUtilsTestBase {
@@ -163,15 +160,4 @@
protected Iterable<String> sources() {
return ImmutableList.of(CLASS_JAVA, SUB_CLASS_JAVA);
}
-
- private Element findElement(RoundEnvironment roundEnvironment, final String name){
- Set<? extends Element> elements = roundEnvironment.getRootElements();
- return Iterables.find(elements, new Predicate<Element>() {
-
- @Override
- public boolean apply(Element input) {
- return name.equals(input.getSimpleName().toString());
- }
- });
- }
}
Added: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java (rev 0)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -0,0 +1,178 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.cdk.apt;
+
+import static org.junit.Assert.*;
+
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementVisitor;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.TypeParameterElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.util.AbstractElementVisitor6;
+import javax.lang.model.util.ElementKindVisitor6;
+import javax.lang.model.util.ElementScanner6;
+
+import org.junit.Test;
+import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class AptSourceUtilsPropertiesTest extends SourceUtilsTestBase {
+
+ private static final String TEST_SUB_CLASS = "PropertyTestClass";
+ private static final String TEST_CLASS = "TestClass";
+ private static final String TEST_INTERFACE = "TestInterface";
+ private static final String PROPERTY_TEST_INTERFACE = "TestInterface";
+ private static final String PACKAGE_PATH = "org/richfaces/cdk/apt/";
+ private static final String CLASS_JAVA = PACKAGE_PATH + TEST_CLASS + ".java";
+ private static final String SUB_CLASS_JAVA = PACKAGE_PATH + TEST_SUB_CLASS + ".java";
+ private static final String INTERFACE_JAVA = PACKAGE_PATH + TEST_INTERFACE + ".java";
+ private static final String PROPERTY_INTERFACE_JAVA = PACKAGE_PATH + PROPERTY_TEST_INTERFACE + ".java";
+
+ @Test
+ public void testGetConcreteProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "concreteValue");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetAbstractProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "value");
+ assertFalse(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetNotExistedProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "notExistedValue");
+ assertFalse(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetInheritedProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "inheritedValue");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetReadOnlyProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "readOnly");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetWriteOnlyProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "writeOnly");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetWrongProperty() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ BeanProperty beanProperty = utils.getBeanProperty(subClassType, "wrongValue");
+ assertTrue(beanProperty.isExists());
+ }
+ });
+ }
+
+ @Test
+ public void testGetBeanProperties() throws Exception {
+ execute(new SourceUtilsCallback() {
+
+ @Override
+ public void process(SourceUtils utils, RoundEnvironment roundEnv) {
+ AptSourceUtils aptUtils = (AptSourceUtils) utils;
+ TypeElement subClassType = (TypeElement) findElement(roundEnv, TEST_SUB_CLASS);
+ assertEquals(6, aptUtils.getBeanProperties(subClassType).size());
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.apt.AnnotationProcessorTestBase#sources()
+ */
+ @Override
+ protected Iterable<String> sources() {
+ return ImmutableList.of(CLASS_JAVA, SUB_CLASS_JAVA, INTERFACE_JAVA,PROPERTY_INTERFACE_JAVA);
+ }
+
+}
Property changes on: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsPropertiesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/SourceUtilsTestBase.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -33,6 +33,7 @@
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import org.junit.runner.RunWith;
@@ -42,6 +43,8 @@
import org.richfaces.cdk.Outputs;
import org.richfaces.cdk.Stub;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -77,6 +80,17 @@
assertTrue("Compilation error",factory.get().call());
}
+ protected Element findElement(RoundEnvironment roundEnvironment, final String name) {
+ Set<? extends Element> elements = roundEnvironment.getRootElements();
+ return Iterables.find(elements, new Predicate<Element>() {
+
+ @Override
+ public boolean apply(Element input) {
+ return name.equals(input.getSimpleName().toString());
+ }
+ });
+ }
+
/**
* <p class="changed_added_4_0">Interface to call back test method from APT</p>
* @author asmirnov(a)exadel.com
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -130,7 +130,7 @@
verify(utils, componentElement, jaxb, annotation, property, facet, description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
- assertTrue(facetModel.isGenerate());
+ assertTrue(facetModel.getGenerate());
assertEquals("foo", facetModel.getName());
// assertEquals("my comment", facetModel.getDescription());
// assertEquals("fooFacet", facetModel.getDisplayname());
@@ -160,7 +160,7 @@
verify(utils, componentElement, jaxb, annotation, property, facet, description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
- assertTrue(facetModel.isGenerate());
+ assertTrue(facetModel.getGenerate());
assertEquals("foo", facetModel.getName());
// assertEquals("my comment", facetModel.getDescription());
// assertEquals("fooFacet", facetModel.getDisplayname());
@@ -180,7 +180,7 @@
replay(utils, componentElement, jaxb, annotation);
processor.setClassNames(componentElement, model, "");
verify(utils, componentElement, jaxb, annotation);
- assertFalse(model.isGenerate());
+ assertFalse(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
}
@@ -200,7 +200,7 @@
processor.setClassNames(componentElement, model, "");
verify(utils, componentElement, jaxb, annotation);
- assertTrue(model.isGenerate());
+ assertTrue(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
}
@@ -220,7 +220,7 @@
processor.setClassNames(componentElement, model, FOO_HTML_BAR);
verify(utils, componentElement, jaxb, annotation);
- assertTrue(model.isGenerate());
+ assertTrue(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertEquals(FOO_HTML_BAR, model.getTargetClass().toString());
}
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -87,6 +87,7 @@
component.setTargetClass(className);
expect(namiingConventions.inferComponentType(className)).andReturn(type);
expect(namiingConventions.inferUIComponentFamily(type)).andReturn(FOO_BAZ);
+ expect(utils.isClassExists(className)).andReturn(true);
replay(log, utils, namiingConventions);
// Validator should set component type from base class.
validator.verifyComponentType(component);
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -104,12 +104,12 @@
assertEquals("panel-large.gif", component.getIcon().getLargeIcon());
assertEquals("Panel component", component.getDescription());
assertEquals("Panel", component.getDisplayname());
- assertTrue(component.isGenerate());
+ assertTrue(component.getGenerate());
FacetModel facet = Iterables.getOnlyElement(component.getFacets());
assertEquals("header", facet.getName());
assertEquals("Header facet", facet.getDescription());
- assertTrue(facet.isGenerate());
+ assertTrue(facet.getGenerate());
Collection<PropertyBase> attributes = component.getAttributes();
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -118,7 +118,7 @@
assertEquals("15", property.getSuggestedValue());
// CDK extensions.
- assertTrue(property.isGenerate());
+ assertTrue(property.getGenerate());
assertTrue(property.isHidden());
assertTrue(property.isLiteral());
assertTrue(property.isPassThrough());
Added: trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java (rev 0)
+++ trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -0,0 +1,77 @@
+/*
+ * $Id: TestSubClass.java 18741 2010-08-18 03:07:27Z alexsmirnov $
+ *
+ * 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.apt;
+
+import org.richfaces.cdk.apt.TestMethodAnnotation;
+
+/**
+ * <p class="changed_added_4_0">Java Bean to test bean properties processor.
+ * that class contains next properties:
+ * <ol>
+ * <li>r/w concreteValue, type String, annotated with {@link TestMethodAnnotation} "setter"</li>
+ * <li> r/w inheritedValue, type String, inherited from {@link PropertyTestInterface}, annotated {@link TestMethodAnnotation} "inherited" </li>
+ * <li> abstract r/w value, inherited from {@link TestInterface},{@link TestMethodAnnotation} "baz"</li>
+ * <li> r readOnly, type Integer, inherited from {@link TestClass}</li>
+ * <li> w writeOnly, type Integer, inherited from {@link TestClass}</li>
+ * <li> wrongValue that should be ignored with warning message.</li>
+ * </ol>
+ * </p>
+ * @author asmirnov(a)exadel.com
+ */
+public class PropertyTestClass extends TestClass implements TestInterface, PropertyTestInterface {
+ private String concreteValue;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param value the value to set
+ */
+ @TestMethodAnnotation("setter")
+ public void setConcreteValue(String value) {
+ this.value = concreteValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the value
+ */
+ public String getConcreteValue() {
+ return concreteValue;
+ }
+
+
+ public void setInheritedValue(String value) {
+ this.value = concreteValue;
+ }
+
+ public String getInheritedValue() {
+ return concreteValue;
+ }
+
+ public void setWrongValue(Integer value) {
+
+ }
+
+}
Property changes on: trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestClass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java (rev 0)
+++ trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -0,0 +1,44 @@
+/*
+ * $Id: TestInterface.java 18741 2010-08-18 03:07:27Z alexsmirnov $
+ *
+ * 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.apt;
+
+import org.richfaces.cdk.apt.TestMethodAnnotation;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface PropertyTestInterface {
+
+ @TestMethodAnnotation("inherited")
+ public String getInheritedValue();
+
+ public void setInheritedValue(String value);
+
+ public void setWrongValue(String value);
+
+}
Property changes on: trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/PropertyTestInterface.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/resources/org/richfaces/cdk/apt/TestClass.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -31,4 +31,13 @@
*
*/
//@TestAnnotation("foo")
-public class TestClass {}
+public class TestClass {
+
+ public Integer getReadOnly(){
+ return null;
+ }
+
+ public void setWriteOnly(Boolean value){
+
+ }
+}
Modified: trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2011-01-06 00:59:41 UTC (rev 20901)
@@ -7,7 +7,6 @@
<attribute-name>attr2</attribute-name>
<attribute-class>java.lang.String</attribute-class>
<attribute-extension>
- <cdk:generate>false</cdk:generate>
<cdk:hidden>false</cdk:hidden>
<cdk:literal>false</cdk:literal>
<cdk:pass-through>false</cdk:pass-through>
@@ -19,7 +18,6 @@
<property-name>attr1</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
- <cdk:generate>false</cdk:generate>
<cdk:hidden>false</cdk:hidden>
<cdk:literal>false</cdk:literal>
<cdk:pass-through>false</cdk:pass-through>
@@ -27,9 +25,7 @@
<cdk:required>false</cdk:required>
</property-extension>
</property>
- <behavior-extension>
- <cdk:generate>false</cdk:generate>
- </behavior-extension>
+ <behavior-extension/>
</behavior>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
Modified: trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml 2011-01-06 00:59:41 UTC (rev 20901)
@@ -3,9 +3,7 @@
<converter>
<converter-id>my_converter</converter-id>
<converter-class>java.lang.Object</converter-class>
- <converter-extension>
- <cdk:generate>false</cdk:generate>
- </converter-extension>
+ <converter-extension/>
</converter>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
Modified: trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml
===================================================================
--- trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml 2011-01-06 00:59:41 UTC (rev 20901)
@@ -3,9 +3,7 @@
<validator>
<validator-id>my_validator</validator-id>
<validator-class>java.lang.Object</validator-class>
- <validator-extension>
- <cdk:generate>false</cdk:generate>
- </validator-extension>
+ <validator-extension/>
</validator>
<faces-config-extension/>
</faces-config>
\ No newline at end of file
Modified: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/pom.xml
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/pom.xml 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/pom.xml 2011-01-06 00:59:41 UTC (rev 20901)
@@ -31,6 +31,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
<configuration>
<!-- http://maven.apache.org/plugins/maven-compiler-plugin/ -->
<source>1.6</source>
Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2011-01-05 23:40:33 UTC (rev 20900)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2011-01-06 00:59:41 UTC (rev 20901)
@@ -360,10 +360,14 @@
CdkClassLoader classLoader = null;
try {
- String outputDirectory = project.getBuild().getOutputDirectory();
- List<File> urls = new ArrayList<File>(classpathElements.size() + 1);
- urls.add(new File(outputDirectory));
-
+ // This Mojo executed befor process-resources phase, therefore we have to use original resource folders.
+ List<Resource> resources = project.getResources();
+ List<File> urls = new ArrayList<File>(classpathElements.size() + resources.size());
+ for (Resource resource : resources) {
+ String directory = resource.getDirectory();
+ // TODO - use includes/excludes and target path.
+ urls.add(resolveRelativePath(new File(directory)));
+ }
for (Iterator<String> iter = classpathElements.iterator(); iter.hasNext();) {
String element = iter.next();
13 years, 11 months
JBoss Rich Faces SVN: r20900 - in branches/RF-9323: archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-05 18:40:33 -0500 (Wed, 05 Jan 2011)
New Revision: 20900
Added:
branches/RF-9323/ui/common/api/src/main/java/org/richfaces/renderkit/util/PanelIcons.java
branches/RF-9323/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/icons.ecss
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupHeaderRenderer.java
branches/RF-9323/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xhtml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xmlunit.xml
Removed:
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java
Modified:
branches/RF-9323/
branches/RF-9323/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml
branches/RF-9323/examples/output-demo/src/main/webapp/templates/template.xhtml
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordion.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TableIconsRendererHelper.java
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordionItem.js
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanelItem.js
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
branches/RF-9323/ui/output/ui/src/test/java/org/richfaces/renderkit/html/CollapsiblePanelRendererTest.java
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-item.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-itemDis.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topItem.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topItemDis.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
Log:
Merged revisions 20889,20891 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r20889 | ilya_shaikovsky | 2011-01-05 01:55:08 -0800 (Wed, 05 Jan 2011) | 1 line
https://issues.jboss.org/browse/RF-10121
.......
r20891 | Alex.Kolonitsky | 2011-01-05 04:19:36 -0800 (Wed, 05 Jan 2011) | 1 line
RF-9435, RF-9862
.......
Property changes on: branches/RF-9323
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-20882
+ /trunk:1-20899
Modified: branches/RF-9323/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml
===================================================================
--- branches/RF-9323/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -145,8 +145,11 @@
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
-
<dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
</dependency>
Modified: branches/RF-9323/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- branches/RF-9323/examples/output-demo/src/main/webapp/templates/template.xhtml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/examples/output-demo/src/main/webapp/templates/template.xhtml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -11,8 +11,22 @@
<meta http-equiv="content-type" content="text/xhtml; charset=UTF-8" />
<h:outputScript library="javax.faces" name="jsf.js" target="head" />
+
+ <style type="text/css">
+ .collapsed { display: none; }
+ .menu {
+ background-color:#7fffd4;
+ }
+
+ .selected {
+ background-color:blue;
+ color:white;
+ }
+ </style>
</h:head>
+
+
<h:body>
<ui:insert name="scripts" ></ui:insert>
@@ -41,8 +55,8 @@
<tr valign="top">
<td>
<h:form id="nav">
- <p>Toggle Panel</p>
- <ul>
+ <p class="menu">Toggle Panel</p>
+ <ul class="collapsed" >
<li>
<p>Examples</p>
<ul>
@@ -61,8 +75,8 @@
</ul>
- <p>Accordion</p>
- <ul>
+ <p class="menu">Accordion</p>
+ <ul class="collapsed" >
<li>
<p>Examples</p>
<ul>
@@ -85,8 +99,8 @@
</li>
</ul>
- <p>Collapsible Panel</p>
- <ul>
+ <p class="menu">Collapsible Panel</p>
+ <ul class="collapsed">
<li>
<p>Examples</p>
<ul>
@@ -99,8 +113,8 @@
</li>
</ul>
- <p>Tab Panel</p>
- <ul>
+ <p class="menu">Tab Panel</p>
+ <ul class="collapsed">
<li>
<p>Examples</p>
<ul>
@@ -113,8 +127,8 @@
</li>
</ul>
- <p>Panel Menu</p>
- <ul>
+ <p class="menu">Panel Menu</p>
+ <ul class="collapsed">
<li>
<p>Examples</p>
<ul>
@@ -127,8 +141,8 @@
</li>
</ul>
- <p>Tooltip</p>
- <ul>
+ <p class="menu">Tooltip</p>
+ <ul class="collapsed">
<li>
<p>Examples</p>
<ul>
@@ -145,8 +159,8 @@
</li>
</ul>
- <p>Toolbar</p>
- <ul>
+ <p class="menu">Toolbar</p>
+ <ul class="collapsed">
<li>
<p>Examples</p>
<ul>
@@ -156,9 +170,9 @@
</ul>
</li>
</ul>
-
- <p>DropDown Menu</p>
- <ul>
+
+ <p class="menu">DropDown Menu</p>
+ <ul class="collapsed">
<li>
<p>Examples</p>
<ul>
@@ -167,8 +181,14 @@
</li>
</ul>
</li>
- </ul>
+ </ul>
+ <script type="text/javascript">
+ $(".menu").click(function () {
+ $(this).toggleClass("selected");
+ $(this).next("ul").toggleClass("collapsed")
+ })
+ </script>
</h:form>
</td>
Copied: branches/RF-9323/ui/common/api/src/main/java/org/richfaces/renderkit/util/PanelIcons.java (from rev 20891, trunk/ui/common/api/src/main/java/org/richfaces/renderkit/util/PanelIcons.java)
===================================================================
--- branches/RF-9323/ui/common/api/src/main/java/org/richfaces/renderkit/util/PanelIcons.java (rev 0)
+++ branches/RF-9323/ui/common/api/src/main/java/org/richfaces/renderkit/util/PanelIcons.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,37 @@
+package org.richfaces.renderkit.util;
+
+public enum PanelIcons {
+ none("rf-ico-none"),
+ disc("rf-ico-disc"),
+ grid("rf-ico-grid"),
+ chevron("rf-ico-chevron"),
+ chevronUp("rf-ico-chevron-up"),
+ chevronDown("rf-ico-chevron-down"),
+ triangle("rf-ico-triangle"),
+ triangleUp("rf-ico-triangle-up"),
+ triangleDown("rf-ico-triangle-down");
+
+ public static final PanelIcons DEFAULT = none;
+
+ private final String cssClass;
+
+ private PanelIcons(String cssClass) {
+ this.cssClass = cssClass;
+ }
+
+ public String cssClass() {
+ return cssClass;
+ }
+
+ public static PanelIcons getIcon(String attrIconCollapsedValue) {
+ if (attrIconCollapsedValue == null) {
+ return null;
+ }
+
+ try {
+ return PanelIcons.valueOf(attrIconCollapsedValue);
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
+}
Modified: branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -280,11 +280,11 @@
}
}
- public String concatClasses(Object... objects) {
+ public static String concatClasses(Object... objects) {
return HtmlUtil.concatClasses(objects);
}
- public String concatStyles(Object... objects) {
+ public static String concatStyles(Object... objects) {
return HtmlUtil.concatStyles(objects);
}
}
Copied: branches/RF-9323/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/icons.ecss (from rev 20891, trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/icons.ecss)
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/icons.ecss (rev 0)
+++ branches/RF-9323/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/icons.ecss 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,13 @@
+
+.rf-ico-none { width: 16px; height: 16px; }
+.rf-ico-chevron { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Chevron.png']})" }
+.rf-ico-chevron-down { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:ChevronDown.png']})" }
+.rf-ico-chevron-left { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:ChevronLeft.png']})" }
+.rf-ico-chevron-up { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:ChevronUp.png']})" }
+.rf-ico-disc { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Disc.png']})" }
+.rf-ico-grid { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Grid.png']})" }
+.rf-ico-spacer { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Spacer.png']})" }
+.rf-ico-triangle { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Triangle.png']})" }
+.rf-ico-triangle-down { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:TriangleDown.png']})" }
+.rf-ico-triangle-left { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:TriangleLeft.png']})" }
+.rf-ico-triangle-up { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:TriangleUp.png']})" }
\ No newline at end of file
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -28,6 +28,8 @@
import javax.faces.context.FacesContext;
import java.io.IOException;
+import static org.richfaces.renderkit.html.DivPanelRenderer.capitalize;
+
/**
* @author akolonitsky
* @since 2010-08-05
@@ -52,6 +54,10 @@
public String abbreviation() {
return abbreviation;
}
+
+ public String headerClass() {
+ return "headerClass" + capitalize(this.toString());
+ }
}
protected AbstractTogglePanelTitledItem() {
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordion.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordion.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordion.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -53,6 +53,13 @@
public enum PropertyKeys {
+ itemLeftIconActive,
+ itemLeftIconInactive,
+ itemLeftIconDisabled,
+ itemRightIconActive,
+ itemRightIconInactive,
+ itemRightIconDisabled,
+
itemHeaderClassActive,
itemHeaderClassDisabled,
itemHeaderClassInactive,
@@ -85,6 +92,54 @@
return COMPONENT_FAMILY;
}
+ public String getItemLeftIconActive() {
+ return (String) getStateHelper().eval(PropertyKeys.itemLeftIconActive);
+ }
+
+ public void setItemLeftIconActive(String itemLeftIconActive) {
+ getStateHelper().put(PropertyKeys.itemLeftIconActive, itemLeftIconActive);
+ }
+
+ public String getItemLeftIconInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.itemLeftIconInactive);
+ }
+
+ public void setItemLeftIconInactive(String itemLeftIconInactive) {
+ getStateHelper().put(PropertyKeys.itemLeftIconInactive, itemLeftIconInactive);
+ }
+
+ public String getItemLeftIconDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.itemLeftIconDisabled);
+ }
+
+ public void setItemLeftIconDisabled(String itemLeftIconDisabled) {
+ getStateHelper().put(PropertyKeys.itemLeftIconDisabled, itemLeftIconDisabled);
+ }
+
+ public String getItemRightIconActive() {
+ return (String) getStateHelper().eval(PropertyKeys.itemRightIconActive);
+ }
+
+ public void setItemRightIconActive(String itemRightIconActive) {
+ getStateHelper().put(PropertyKeys.itemRightIconActive, itemRightIconActive);
+ }
+
+ public String getItemRightIconInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.itemRightIconInactive);
+ }
+
+ public void setItemRightIconInactive(String itemRightIconInactive) {
+ getStateHelper().put(PropertyKeys.itemRightIconInactive, itemRightIconInactive);
+ }
+
+ public String getItemRightIconDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.itemRightIconDisabled);
+ }
+
+ public void setItemRightIconDisabled(String itemRightIconDisabled) {
+ getStateHelper().put(PropertyKeys.itemRightIconDisabled, itemRightIconDisabled);
+ }
+
public String getWidth() {
return (String) getStateHelper().eval(PropertyKeys.width);
}
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -60,6 +60,13 @@
public enum PropertyKeys {
+ leftIconActive,
+ leftIconInactive,
+ leftIconDisabled,
+ rightIconActive,
+ rightIconInactive,
+ rightIconDisabled,
+
headerClassActive,
headerClassDisabled,
headerClassInactive,
@@ -100,6 +107,54 @@
return (HtmlAccordion) ToggleControl.getEnclosedPanel(this);
}
+ public String getLeftIconActive() {
+ return (String) getStateHelper().eval(PropertyKeys.leftIconActive, getAccordion().getItemLeftIconActive());
+ }
+
+ public void setLeftIconActive(String leftIconActive) {
+ getStateHelper().put(PropertyKeys.leftIconActive, leftIconActive);
+ }
+
+ public String getLeftIconInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.leftIconInactive, getAccordion().getItemLeftIconInactive());
+ }
+
+ public void setLeftIconInactive(String leftIconInactive) {
+ getStateHelper().put(PropertyKeys.leftIconInactive, leftIconInactive);
+ }
+
+ public String getLeftIconDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.leftIconDisabled, getAccordion().getItemLeftIconDisabled());
+ }
+
+ public void setLeftIconDisabled(String leftIconDisabled) {
+ getStateHelper().put(PropertyKeys.leftIconDisabled, leftIconDisabled);
+ }
+
+ public String getRightIconActive() {
+ return (String) getStateHelper().eval(PropertyKeys.rightIconActive, getAccordion().getItemRightIconActive());
+ }
+
+ public void setRightIconActive(String rightIconActive) {
+ getStateHelper().put(PropertyKeys.rightIconActive, rightIconActive);
+ }
+
+ public String getRightIconInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.rightIconInactive, getAccordion().getItemRightIconInactive());
+ }
+
+ public void setRightIconInactive(String rightIconInactive) {
+ getStateHelper().put(PropertyKeys.rightIconInactive, rightIconInactive);
+ }
+
+ public String getRightIconDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.rightIconDisabled, getAccordion().getItemRightIconDisabled());
+ }
+
+ public void setRightIconDisabled(String rightIconDisabled) {
+ getStateHelper().put(PropertyKeys.rightIconDisabled, rightIconDisabled);
+ }
+
public String getHeaderClassActive() {
return (String) getStateHelper().eval(PropertyKeys.headerClassActive, getAccordion().getItemHeaderClassActive());
}
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -24,7 +24,7 @@
package org.richfaces.component.html;
import org.richfaces.component.UIPanelMenu;
-import org.richfaces.renderkit.html.PanelMenuIcons;
+import org.richfaces.renderkit.util.PanelIcons;
import javax.faces.component.behavior.ClientBehaviorHolder;
import java.util.Arrays;
@@ -143,7 +143,7 @@
}
public String getItemIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.itemIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemIconLeft, PanelIcons.DEFAULT.toString());
}
public void setItemIconLeft(String itemIconLeft) {
@@ -151,7 +151,7 @@
}
public String getItemIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.itemIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemIconRight, PanelIcons.DEFAULT.toString());
}
public void setItemIconRight(String itemIconRight) {
@@ -159,7 +159,7 @@
}
public String getItemDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.itemDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemDisableIconLeft, PanelIcons.DEFAULT.toString());
}
public void setItemDisableIconLeft(String itemDisableIconLeft) {
@@ -167,7 +167,7 @@
}
public String getItemDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.itemDisableIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemDisableIconRight, PanelIcons.DEFAULT.toString());
}
public void setItemDisableIconRight(String itemDisableIconRight) {
@@ -191,7 +191,7 @@
}
public String getTopItemIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topItemIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemIconLeft, PanelIcons.DEFAULT.toString());
}
public void setTopItemIconLeft(String topItemIconLeft) {
@@ -199,7 +199,7 @@
}
public String getTopItemIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topItemIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemIconRight, PanelIcons.DEFAULT.toString());
}
public void setTopItemIconRight(String topItemIconRight) {
@@ -207,7 +207,7 @@
}
public String getTopItemDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconLeft, PanelIcons.DEFAULT.toString());
}
public void setTopItemDisableIconLeft(String topItemDisableIconLeft) {
@@ -215,7 +215,7 @@
}
public String getTopItemDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconRight, PanelIcons.DEFAULT.toString());
}
public void setTopItemDisableIconRight(String topItemDisableIconRight) {
@@ -239,7 +239,7 @@
}
public String getGroupExpandIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupExpandIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupExpandIconLeft, PanelIcons.DEFAULT.toString());
}
public void setGroupExpandIconLeft(String groupExpandIconLeft) {
@@ -247,7 +247,7 @@
}
public String getGroupExpandIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupExpandIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupExpandIconRight, PanelIcons.DEFAULT.toString());
}
public void setGroupExpandIconRight(String groupExpandIconRight) {
@@ -255,7 +255,7 @@
}
public String getGroupCollapseIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconLeft, PanelIcons.DEFAULT.toString());
}
public void setGroupCollapseIconLeft(String groupCollapseIconLeft) {
@@ -263,7 +263,7 @@
}
public String getGroupCollapseIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconRight, PanelIcons.DEFAULT.toString());
}
public void setGroupCollapseIconRight(String groupCollapseIconRight) {
@@ -271,7 +271,7 @@
}
public String getGroupDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupDisableIconLeft, PanelIcons.DEFAULT.toString());
}
public void setGroupDisableIconLeft(String groupDisableIconLeft) {
@@ -279,7 +279,7 @@
}
public String getGroupDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupDisableIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupDisableIconRight, PanelIcons.DEFAULT.toString());
}
public void setGroupDisableIconRight(String groupDisableIconRight) {
@@ -303,7 +303,7 @@
}
public String getTopGroupExpandIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconLeft, PanelIcons.DEFAULT.toString());
}
public void setTopGroupExpandIconLeft(String topGroupExpandIconLeft) {
@@ -311,7 +311,7 @@
}
public String getTopGroupExpandIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconRight, PanelIcons.DEFAULT.toString());
}
public void setTopGroupExpandIconRight(String topGroupExpandIconRight) {
@@ -319,7 +319,7 @@
}
public String getTopGroupCollapseIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconLeft, PanelIcons.DEFAULT.toString());
}
public void setTopGroupCollapseIconLeft(String topGroupCollapseIconLeft) {
@@ -327,7 +327,7 @@
}
public String getTopGroupCollapseIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconRight, PanelIcons.DEFAULT.toString());
}
public void setTopGroupCollapseIconRight(String topGroupCollapseIconRight) {
@@ -335,7 +335,7 @@
}
public String getTopGroupDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconLeft, PanelIcons.DEFAULT.toString());
}
public void setTopGroupDisableIconLeft(String topGroupDisableIconLeft) {
@@ -343,7 +343,7 @@
}
public String getTopGroupDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconRight, PanelMenuIcons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconRight, PanelIcons.DEFAULT.toString());
}
public void setTopGroupDisableIconRight(String topGroupDisableIconRight) {
Copied: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.java (from rev 20891, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.java)
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.java (rev 0)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,65 @@
+package org.richfaces.renderkit.html;
+
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.component.html.HtmlAccordionItem;
+import org.richfaces.renderkit.RendererBase;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+
+import static org.richfaces.renderkit.HtmlConstants.*;
+import static org.richfaces.renderkit.html.DivPanelRenderer.attributeAsString;
+
+class AccordionItemHeaderRenderer extends TableIconsRendererHelper<HtmlAccordionItem> {
+
+ public AccordionItemHeaderRenderer() {
+ super("header", "rf-ac-itm");
+ }
+
+ protected void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context, HtmlAccordionItem panel) throws IOException {
+ String iconInactive = panel.isDisabled() ? panel.getLeftIconDisabled() : panel.getLeftIconInactive();
+ String iconActive = panel.isDisabled() ? panel.getLeftIconDisabled() : panel.getLeftIconActive();
+
+ encodeTdIcon(writer, context, cssClassPrefix + "-ico", iconInactive, iconActive);
+ }
+
+ protected void encodeHeaderIconRight(ResponseWriter writer, FacesContext context, HtmlAccordionItem panel) throws IOException {
+ String iconInactive = panel.isDisabled() ? panel.getRightIconDisabled() : panel.getRightIconInactive();
+ String iconActive = panel.isDisabled() ? panel.getRightIconDisabled() : panel.getRightIconActive();
+
+ //TODO nick - should this be "-ico-exp"? also why expanded icon state is connected with right icon alignment?
+ encodeTdIcon(writer, context, cssClassPrefix + "-exp-ico", iconInactive, iconActive);
+ }
+
+ @Override
+ protected void encodeTdIcon(ResponseWriter writer, FacesContext context, String cssClass, String attrIconCollapsedValue, String attrIconExpandedValue) throws IOException {
+ writer.startElement(TD_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, cssClass, null);
+
+ encodeIdIcon(writer, context, attrIconCollapsedValue, cssIconsClassPrefix + "-act");
+ encodeIdIcon(writer, context, attrIconExpandedValue, cssIconsClassPrefix + "-inact");
+
+ writer.endElement(TD_ELEM);
+ }
+
+ @Override
+ protected void encodeHeaderTextValue(ResponseWriter writer, FacesContext context, HtmlAccordionItem titledItem) throws IOException {
+ if (titledItem.isDisabled()) {
+ encodeHeader(writer, context, titledItem, AbstractTogglePanelTitledItem.HeaderStates.disabled);
+ } else {
+ encodeHeader(writer, context, titledItem, AbstractTogglePanelTitledItem.HeaderStates.active);
+ encodeHeader(writer, context, titledItem, AbstractTogglePanelTitledItem.HeaderStates.inactive);
+ }
+ }
+
+ private static void encodeHeader(ResponseWriter writer, FacesContext context, AbstractTogglePanelTitledItem component,
+ AbstractTogglePanelTitledItem.HeaderStates state) throws IOException {
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(CLASS_ATTRIBUTE, RendererBase.concatClasses("rf-ac-itm-lbl-" + state.abbreviation(), attributeAsString(component, state.headerClass())), null);
+
+ writeFacetOrAttr(writer, context, component, "header", component.getHeaderFacet(state));
+
+ writer.endElement(DIV_ELEM);
+ }
+}
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -36,24 +36,13 @@
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.component.AbstractTogglePanelTitledItem;
-import org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates;
+import org.richfaces.component.html.HtmlAccordionItem;
import org.richfaces.component.html.HtmlAccordionItem.PropertyKeys;
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.RenderKitUtils;
/**
*
- * <div id="clientId" class="rf-ac-itm">
- * <div id="clientId:header" class="rf-ac-itm-hdr">
- * <div class="rf-ac-itm-hdr-inact">Level 1</div>
- * <div class="rf-ac-itm-hdr-act" >Level 1</div>
- * <div class="rf-ac-itm-hdr-dis">Level 1</div>
- * </div>
- * <div id="clientId:content" class="rf-ac-itm-cnt">
- * Content will be here.
- * </div>
- * </div>
- *
* @author akolonitsky
* @since 2010-08-05
*/
@@ -76,11 +65,13 @@
.generic("onmousemove", PropertyKeys.onheadermousemove.toString(), "headermousemove")
.generic("onmouseup", PropertyKeys.onheadermouseup.toString(), "headermouseup");
+ private final TableIconsRendererHelper<HtmlAccordionItem> headerRenderer = new AccordionItemHeaderRenderer();
+
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
super.doEncodeBegin(writer, context, component);
- encodeHeader(context, component, writer);
+ encodeHeader(writer, context, (HtmlAccordionItem) component);
encodeContentBegin(component, writer);
}
@@ -92,7 +83,7 @@
@Override
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- encodeContentEnd(component, writer);
+ encodeContentEnd(writer, component);
super.doEncodeEnd(writer, context, component);
}
@@ -121,48 +112,20 @@
}
}
- private void encodeContentEnd(UIComponent component, ResponseWriter responseWriter) throws IOException {
- responseWriter.endElement(DIV_ELEM);
- }
-
- private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
-
- writer.startElement(DIV_ELEM, component);
- writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-hdr", attributeAsString(component, PropertyKeys.headerClass)), null);
- writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":header", null);
- renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
-
- AbstractTogglePanelTitledItem titledItem = (AbstractTogglePanelTitledItem) component;
- boolean isActive = titledItem.isActive();
- boolean isDisabled = titledItem.isDisabled();
- encodeHeader(context, titledItem, writer, HeaderStates.inactive, !isActive && !isDisabled);
- encodeHeader(context, titledItem, writer, HeaderStates.active, isActive && !isDisabled);
- encodeHeader(context, titledItem, writer, HeaderStates.disabled, isDisabled);
-
+ private void encodeContentEnd(ResponseWriter writer, UIComponent component) throws IOException {
writer.endElement(DIV_ELEM);
}
- private void encodeHeader(FacesContext facesContext, AbstractTogglePanelTitledItem component, ResponseWriter writer,
- HeaderStates state, Boolean isDisplay) throws IOException {
-
+ private void encodeHeader(ResponseWriter writer, FacesContext context, HtmlAccordionItem component) throws IOException {
writer.startElement(DIV_ELEM, component);
- if (!isDisplay) {
- writer.writeAttribute(STYLE_ATTRIBUTE, "display : none", null);
- }
+ String stateCssClass = "rf-ac-itm-hdr-" + (component.isDisabled() ? "dis" : (component.isActive() ? "act" : "inact"));
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-hdr", stateCssClass, attributeAsString(component, PropertyKeys.headerClass)), null);
- String name = "headerClass" + capitalize(state.toString());
- writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-hdr-" + state.abbreviation(), attributeAsString(component, name)), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":header", null);
+ renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
- UIComponent headerFacet = component.getHeaderFacet(state);
- if (headerFacet != null && headerFacet.isRendered()) {
- headerFacet.encodeAll(facesContext);
- } else {
- Object headerText = component.getAttributes().get("header");
- if (headerText != null && !headerText.equals("")) {
- writer.writeText(headerText, null);
- }
- }
+ headerRenderer.encodeHeader(writer, context, component);
writer.endElement(DIV_ELEM);
}
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -46,6 +46,7 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "accordion.ecss"),
+ @ResourceDependency(library = "org.richfaces", name = "icons.ecss"),
@ResourceDependency(library = "org.richfaces", name = "togglePanel.js"),
@ResourceDependency(library = "org.richfaces", name = "accordion.js") })
public class AccordionRenderer extends TogglePanelRenderer {
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -53,28 +53,38 @@
@ResourceDependency(library = "org.richfaces", name = "togglePanelItem.js"),
@ResourceDependency(library = "org.richfaces", name = "collapsiblePanel.js"),
@ResourceDependency(library = "org.richfaces", name = "collapsiblePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "icons.ecss"),
@ResourceDependency(library = "org.richfaces", name = "collapsiblePanel.ecss") })
public class CollapsiblePanelRenderer extends TogglePanelRenderer {
public static final String SWITCH = "switch";
public static final String BEFORE_SWITCH = "beforeswitch";
- private final TableIconsRendererHelper headerRenderer = new TableIconsRendererHelper("header", "rf-cp", "rf-cp-ico-") {
+ private final TableIconsRendererHelper<HtmlCollapsiblePanel> headerRenderer = new TableIconsRendererHelper<HtmlCollapsiblePanel>("header", "rf-cp") {
- protected void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- HtmlCollapsiblePanel panel = (HtmlCollapsiblePanel) component;
-
- encodeTdIcon(writer, context, cssClassPrefix + "-ico", panel.isExpanded(),
+ protected void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context, HtmlCollapsiblePanel panel) throws IOException {
+ encodeTdIcon(writer, context, cssClassPrefix + "-ico",
panel.getLeftCollapsedIcon(), panel.getLeftExpandedIcon());
}
- protected void encodeHeaderIconRight(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- HtmlCollapsiblePanel panel = (HtmlCollapsiblePanel) component;
-
+ protected void encodeHeaderIconRight(ResponseWriter writer, FacesContext context, HtmlCollapsiblePanel panel) throws IOException {
//TODO nick - should this be "-ico-exp"? also why expanded icon state is connected with right icon alignment?
- encodeTdIcon(writer, context, cssClassPrefix + "-exp-ico", panel.isExpanded(),
+ encodeTdIcon(writer, context, cssClassPrefix + "-exp-ico",
panel.getRightCollapsedIcon(), panel.getRightExpandedIcon());
}
+
+ @Override
+ protected void encodeHeaderTextValue(ResponseWriter writer, FacesContext context, HtmlCollapsiblePanel component) throws IOException {
+ writer.startElement(DIV_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, cssClassPrefix + "-lbl-exp", null);
+ writeFacetOrAttr(writer, context, component, text, text + "Expanded");
+ writer.endElement(DIV_ELEM);
+
+ writer.startElement(DIV_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, cssClassPrefix + "-lbl-colps", null);
+ writeFacetOrAttr(writer, context, component, text, text + "Collapsed");
+ writer.endElement(DIV_ELEM);
+ }
};
public TableIconsRendererHelper getHeaderRenderer() {
@@ -108,7 +118,7 @@
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent comp) throws IOException {
super.doEncodeBegin(writer, context, comp);
- encodeHeader(context, comp, writer);
+ encodeHeader(writer, context, (HtmlCollapsiblePanel) comp);
}
@Override
@@ -137,10 +147,12 @@
return options;
}
- private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement(DIV_ELEM, component);
+ private void encodeHeader(ResponseWriter writer, FacesContext context, HtmlCollapsiblePanel component) throws IOException {
+ writer.startElement(DIV_ELEM, null);
writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) + ":header", null);
- writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-cp-hdr", attributeAsString(component, "headerClass")), null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-cp-hdr",
+ "rf-cp-hdr-" + (component.isExpanded() ? "exp" : "colps"),
+ attributeAsString(component, "headerClass")), null);
headerRenderer.encodeHeader(writer, context, component);
@@ -204,7 +216,7 @@
}
private String getPlaceHolder(String id) {
- return "<div id=\"" + id + "\" style=\"display: none\" ></div>";
+ return "<div id=\"" + id + "\" style=\"display:none\" ></div>";
}
private void encodeContent(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
Copied: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupHeaderRenderer.java (from rev 20891, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupHeaderRenderer.java)
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupHeaderRenderer.java (rev 0)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupHeaderRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,29 @@
+package org.richfaces.renderkit.html;
+
+import org.richfaces.component.html.HtmlPanelMenuGroup;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+
+class PanelMenuGroupHeaderRenderer extends TableIconsRendererHelper<HtmlPanelMenuGroup> {
+
+ PanelMenuGroupHeaderRenderer(String cssClassPrefix) {
+ super("label", cssClassPrefix, "rf-pm-ico");
+ }
+
+ protected void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup group) throws IOException {
+ String iconCollapsed = group.isDisabled() ? group.getIconLeftDisabled() : group.getIconLeftCollapsed();
+ String iconExpanded = group.isDisabled() ? group.getIconLeftDisabled() : group.getIconLeftExpanded();
+
+ encodeTdIcon(writer, context, cssClassPrefix + "-ico", iconCollapsed, iconExpanded);
+ }
+
+ protected void encodeHeaderIconRight(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup group) throws IOException {
+ String iconCollapsed = group.isDisabled() ? group.getIconRightDisabled() : group.getIconRightCollapsed();
+ String iconExpanded = group.isDisabled() ? group.getIconRightDisabled() : group.getIconRightExpanded();
+
+ //TODO nick - should this be "-ico-exp"? also why expanded icon state is connected with right icon alignment?
+ encodeTdIcon(writer, context, cssClassPrefix + "-exp-ico", iconCollapsed, iconExpanded);
+ }
+}
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -56,36 +56,9 @@
//TODO nick - shouldn't this be rf-pm-gr-top?
private static final String TOP_CSS_CLASS_PREFIX = "rf-pm-top-gr";
- private static class HeaderRenderer extends TableIconsRendererHelper {
+ private final TableIconsRendererHelper<HtmlPanelMenuGroup> headerRenderer = new PanelMenuGroupHeaderRenderer(CSS_CLASS_PREFIX);
+ private final TableIconsRendererHelper<HtmlPanelMenuGroup> topHeaderRenderer = new PanelMenuGroupHeaderRenderer(TOP_CSS_CLASS_PREFIX);
- public HeaderRenderer(String cssClassPrefix) {
- super("label", cssClassPrefix, "rf-pm-ico-");
- }
-
- protected void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- HtmlPanelMenuGroup group = (HtmlPanelMenuGroup) component;
-
- String iconCollapsed = group.isDisabled() ? group.getIconLeftDisabled() : group.getIconLeftCollapsed();
- String iconExpanded = group.isDisabled() ? group.getIconLeftDisabled() : group.getIconLeftExpanded();
-
- encodeTdIcon(writer, context, cssClassPrefix + "-ico", group.isExpanded(), iconCollapsed, iconExpanded);
- }
-
- protected void encodeHeaderIconRight(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- HtmlPanelMenuGroup group = (HtmlPanelMenuGroup) component;
-
- String iconCollapsed = group.isDisabled() ? group.getIconRightDisabled() : group.getIconRightCollapsed();
- String iconExpanded = group.isDisabled() ? group.getIconRightDisabled() : group.getIconRightExpanded();
-
- //TODO nick - should this be "-ico-exp"? also why expanded icon state is connected with right icon alignment?
- encodeTdIcon(writer, context, cssClassPrefix + "-exp-ico", group.isExpanded(), iconCollapsed, iconExpanded);
- }
-
- }
-
- private final TableIconsRendererHelper headerRenderer = new HeaderRenderer(CSS_CLASS_PREFIX);
- private final TableIconsRendererHelper topHeaderRenderer = new HeaderRenderer(TOP_CSS_CLASS_PREFIX);
-
@Override
protected void doDecode(FacesContext context, UIComponent component) {
AbstractPanelMenuGroup menuGroup = (AbstractPanelMenuGroup) component;
@@ -132,7 +105,8 @@
private void encodeHeader(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
writer.startElement(DIV_ELEM, null);
writer.writeAttribute(ID_ATTRIBUTE, menuGroup.getClientId(context) + ":hdr", null);
- writer.writeAttribute(CLASS_ATTRIBUTE, getCssClass(menuGroup, "-hdr"), null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(getCssClass(menuGroup, "-hdr"),
+ getCssClass(menuGroup, "-hdr-" + (menuGroup.isExpanded() ? "exp" : "colps"))), null);
(menuGroup.isTopItem() ? topHeaderRenderer : headerRenderer).encodeHeader(writer, context, menuGroup);
Deleted: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,25 +0,0 @@
-package org.richfaces.renderkit.html;
-
-public enum PanelMenuIcons {
- none("rf-pm-none"),
- disc("rf-pm-disc"),
- grid("rf-pm-grid"),
- chevron("rf-pm-chevron"),
- chevronUp("rf-pm-chevron-up"),
- chevronDown("rf-pm-chevron-down"),
- triangle("rf-pm-triangle"),
- triangleUp("rf-pm-triangle-up"),
- triangleDown("rf-pm-triangle-down");
-
- public static final PanelMenuIcons DEFAULT = none;
-
- private final String cssClass;
-
- private PanelMenuIcons(String cssClass) {
- this.cssClass = cssClass;
- }
-
- public String cssClass() {
- return cssClass;
- }
-}
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -40,6 +40,7 @@
import org.richfaces.component.html.HtmlPanelMenuItem;
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.RenderKitUtils;
+import org.richfaces.renderkit.util.PanelIcons;
/**
* @author akolonitsky
@@ -107,7 +108,7 @@
public void encodeTdIcon(ResponseWriter writer, FacesContext context, String classPrefix, String attrIconValue) throws IOException {
writer.startElement(TD_ELEM, null);
try {
- PanelMenuIcons icon = PanelMenuIcons.valueOf(attrIconValue);
+ PanelIcons icon = PanelIcons.valueOf(attrIconValue);
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(classPrefix, icon.cssClass()), null);
} catch (IllegalArgumentException e) {
writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix, null);
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -55,6 +55,7 @@
@ResourceDependency(library = "org.richfaces", name = "panelMenu.js"),
@ResourceDependency(library = "org.richfaces", name = "panelMenuItem.js"),
@ResourceDependency(library = "org.richfaces", name = "panelMenuGroup.js"),
+ @ResourceDependency(library = "org.richfaces", name = "icons.ecss"),
@ResourceDependency(library = "org.richfaces", name = "panelMenu.ecss") })
public class PanelMenuRenderer extends DivPanelRenderer {
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -146,9 +146,8 @@
writer.startElement(TD_ELEM, tab);
writer.writeAttribute(ID_ATTRIBUTE, tab.getClientId() + ":header:" + state.toString(), null);
renderPassThroughAttributes(context, tab, HEADER_ATTRIBUTES);
- String name = "headerClass" + capitalize(state.toString());
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-tb-hdr rf-tb-hdr-" + state.abbreviation(),
- attributeAsString(tab, HtmlTab.PropertyKeys.headerClass), attributeAsString(tab, name)), null);
+ attributeAsString(tab, HtmlTab.PropertyKeys.headerClass), attributeAsString(tab, state.headerClass())), null);
writer.writeAttribute(STYLE_ATTRIBUTE, concatStyles(isDisplay ? "" : "display : none", attributeAsString(tab, HtmlTab.PropertyKeys.headerStyle.toString())), null);
writer.startElement("span", tab);
@@ -223,4 +222,3 @@
return AbstractTabPanel.class;
}
}
-
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TableIconsRendererHelper.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TableIconsRendererHelper.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TableIconsRendererHelper.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,6 +1,7 @@
package org.richfaces.renderkit.html;
import org.richfaces.renderkit.RenderKitUtils;
+import org.richfaces.renderkit.util.PanelIcons;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -9,21 +10,24 @@
import static org.richfaces.component.util.HtmlUtil.concatClasses;
import static org.richfaces.renderkit.HtmlConstants.*;
-import static org.richfaces.renderkit.html.DivPanelRenderer.styleElement;
-public abstract class TableIconsRendererHelper {
+public abstract class TableIconsRendererHelper<T extends UIComponent> {
protected final String text;
protected final String cssClassPrefix;
protected final String cssIconsClassPrefix;
- public TableIconsRendererHelper(String text, String cssClassPrefix, String cssIconsClassPrefix) {
+ protected TableIconsRendererHelper(String text, String cssClassPrefix, String cssIconsClassPrefix) {
this.text = text;
this.cssClassPrefix = cssClassPrefix;
this.cssIconsClassPrefix = cssIconsClassPrefix;
}
- public void encodeHeader(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ protected TableIconsRendererHelper(String text, String cssClassPrefix) {
+ this(text, cssClassPrefix, cssClassPrefix + "-ico");
+ }
+
+ public void encodeHeader(ResponseWriter writer, FacesContext context, T component) throws IOException {
writer.startElement(TABLE_ELEMENT, null);
writer.writeAttribute(CLASS_ATTRIBUTE, cssClassPrefix + "-gr", null);
writer.startElement(TBODY_ELEMENT, null);
@@ -38,68 +42,64 @@
writer.endElement(TABLE_ELEMENT);
}
- private void encodeHeaderText(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ protected void encodeHeaderText(ResponseWriter writer, FacesContext context, T component) throws IOException {
writer.startElement(TD_ELEM, null);
writer.writeAttribute(CLASS_ATTRIBUTE, cssClassPrefix + "-lbl", null);
+
encodeHeaderTextValue(writer, context, component);
+
writer.endElement(TD_ELEM);
}
- protected void encodeHeaderTextValue(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- UIComponent headerFacet = component.getFacet(text);
+ protected void encodeHeaderTextValue(ResponseWriter writer, FacesContext context, T component) throws IOException {
+ writeFacetOrAttr(writer, context, component, text, text);
+ }
+
+ public static void writeFacetOrAttr(ResponseWriter writer, FacesContext context, UIComponent component, String attr, String facetName) throws IOException {
+ writeFacetOrAttr(writer, context, component, attr, component.getFacet(facetName));
+ }
+
+ public static void writeFacetOrAttr(ResponseWriter writer, FacesContext context, UIComponent component, String attr, UIComponent headerFacet) throws IOException {
if (headerFacet != null && headerFacet.isRendered()) {
headerFacet.encodeAll(context);
} else {
- Object label = component.getAttributes().get(text);
+ Object label = component.getAttributes().get(attr);
if (label != null && !label.equals("")) {
writer.writeText(label, null);
}
}
}
- protected abstract void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException;
+ protected abstract void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context, T component) throws IOException;
- protected abstract void encodeHeaderIconRight(ResponseWriter writer, FacesContext context, UIComponent menuItem) throws IOException;
+ protected abstract void encodeHeaderIconRight(ResponseWriter writer, FacesContext context, T menuItem) throws IOException;
- protected void encodeTdIcon(ResponseWriter writer, FacesContext context, String cssClass, boolean isExpanded, String attrIconCollapsedValue, String attrIconExpandedValue) throws IOException {
+ protected void encodeTdIcon(ResponseWriter writer, FacesContext context, String cssClass, String attrIconCollapsedValue, String attrIconExpandedValue) throws IOException {
writer.startElement(TD_ELEM, null);
writer.writeAttribute(CLASS_ATTRIBUTE, cssClass, null);
- encodeIdIcon(writer, context, isExpanded, attrIconCollapsedValue, cssIconsClassPrefix + "colps");
- encodeIdIcon(writer, context, !isExpanded, attrIconExpandedValue, cssIconsClassPrefix + "exp");
+ encodeIdIcon(writer, context, attrIconCollapsedValue, cssIconsClassPrefix + "-colps");
+ encodeIdIcon(writer, context, attrIconExpandedValue, cssIconsClassPrefix + "-exp");
writer.endElement(TD_ELEM);
}
- protected void encodeIdIcon(ResponseWriter writer, FacesContext context, boolean isExpanded, String attrIconValue, String styleClass) throws IOException {
+ protected void encodeIdIcon(ResponseWriter writer, FacesContext context, String attrIconValue, String styleClass) throws IOException {
if (attrIconValue == null || attrIconValue.trim().length() <= 0) {
- encodeDivIcon(writer, isExpanded, PanelMenuIcons.none, styleClass);
+ encodeDivIcon(writer, PanelIcons.none, styleClass);
} else {
- PanelMenuIcons icon = getIcon(attrIconValue);
+ PanelIcons icon = PanelIcons.getIcon(attrIconValue);
if (icon != null) {
- encodeDivIcon(writer, isExpanded, icon, styleClass);
+ encodeDivIcon(writer, icon, styleClass);
} else {
encodeImage(writer, context, attrIconValue);
}
}
}
- protected PanelMenuIcons getIcon(String attrIconCollapsedValue) {
- if (attrIconCollapsedValue == null) {
- return null;
- }
-
- try {
- return PanelMenuIcons.valueOf(attrIconCollapsedValue);
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
-
- public static void encodeDivIcon(ResponseWriter writer, boolean isDisplay, PanelMenuIcons icon, String styleClass) throws IOException {
+ public static void encodeDivIcon(ResponseWriter writer, PanelIcons icon, String styleClass) throws IOException {
writer.startElement(DIV_ELEM, null);
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(styleClass, icon.cssClass()), null);
- writer.writeAttribute(STYLE_ATTRIBUTE, styleElement("display", isDisplay ? "none" : "block"), null);
writer.endElement(DIV_ELEM);
}
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2011-01-05 23:40:33 UTC (rev 20900)
@@ -26,10 +26,6 @@
min-height: 0px;
}
-.rf-ac-itm-hdr-act {}
-.rf-ac-itm-hdr-inact {}
-.rf-ac-itm-hdr-dis {}
-
.rf-ac-itm-cnt {
border-bottom-width: 1px;
border-bottom-style: solid;
@@ -40,3 +36,33 @@
padding: 10px;
}
+.rf-ac-itm-hdr-act {}
+.rf-ac-itm-hdr-inact {}
+.rf-ac-itm-hdr-dis {}
+
+
+.rf-ac-itm-gr { width: 100%}
+
+.rf-ac-itm-ico { width: 16px; height: 16px;}
+.rf-ac-itm-exp-ico { width: 16px; height: 16px;}
+.rf-ac-itm-ico-act {}
+.rf-ac-itm-ico-inact {}
+
+.rf-ac-itm-lbl {}
+.rf-ac-itm-lbl-act {}
+.rf-ac-itm-lbl-inact {}
+
+.rf-ac-itm-hdr-act .rf-ac-itm-ico-act { display: block; }
+.rf-ac-itm-hdr-act .rf-ac-itm-ico-inact { display: none; }
+.rf-ac-itm-hdr-act .rf-ac-itm-lbl-act { display: block; }
+.rf-ac-itm-hdr-act .rf-ac-itm-lbl-inact { display: none; }
+
+.rf-ac-itm-hdr-inact .rf-ac-itm-ico-act { display: none; }
+.rf-ac-itm-hdr-inact .rf-ac-itm-ico-inact { display: block; }
+.rf-ac-itm-hdr-inact .rf-ac-itm-lbl-act { display: none; }
+.rf-ac-itm-hdr-inact .rf-ac-itm-lbl-inact { display: block; }
+
+.rf-ac-itm-hdr-dis .rf-ac-itm-ico-act { display: none; }
+.rf-ac-itm-hdr-dis .rf-ac-itm-ico-inact { display: block; }
+.rf-ac-itm-hdr-dis .rf-ac-itm-lbl-act { display: none; }
+.rf-ac-itm-hdr-dis .rf-ac-itm-lbl-inact { display: block; }
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordionItem.js
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordionItem.js 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordionItem.js 2011-01-05 23:40:33 UTC (rev 20900)
@@ -66,12 +66,7 @@
* @return {jQuery Object}
* */
__header : function (state) {
- var res = $(rf.getDomElement(this.id + ":header"));
- if (state) {
- return res.find(".rf-ac-itm-hdr-" + state);
- }
-
- return res;
+ return $(rf.getDomElement(this.id + ":header"));
},
/**
@@ -97,8 +92,7 @@
}
this.__content().show();
- this.__header("inact").hide();
- this.__header("act").show();
+ this.__header().addClass("rf-ac-itm-hdr-act").removeClass("rf-ac-itm-hdr-inact");
return this.__fireEnter();
},
@@ -134,8 +128,7 @@
}
this.__content().hide();
- this.__header("act").hide();
- this.__header("inact").show();
+ this.__header().removeClass("rf-ac-itm-hdr-act").addClass("rf-ac-itm-hdr-inact");
return true;
},
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2011-01-05 23:40:33 UTC (rev 20900)
@@ -30,4 +30,25 @@
color:'#{richSkin.generalTextColor}';
font-family:'#{richSkin.generalFamilyFont}';
padding:10px;
-}
\ No newline at end of file
+}
+
+.rf-cp-gr { width: 100%}
+
+.rf-cp-ico { width: 16px; height: 16px;}
+.rf-cp-exp-ico { width: 16px; height: 16px;}
+.rf-cp-ico-colps {}
+.rf-cp-ico-exp {}
+
+.rf-cp-lbl {}
+.rf-cp-lbl-colps {}
+.rf-cp-lbl-exp {}
+
+.rf-cp-hdr-exp .rf-cp-ico-exp { display: block; }
+.rf-cp-hdr-exp .rf-cp-ico-colps { display: none; }
+.rf-cp-hdr-exp .rf-cp-lbl-exp { display: block; }
+.rf-cp-hdr-exp .rf-cp-lbl-colps { display: none; }
+
+.rf-cp-hdr-colps .rf-cp-ico-exp { display: none; }
+.rf-cp-hdr-colps .rf-cp-ico-colps { display: block; }
+.rf-cp-hdr-colps .rf-cp-lbl-exp { display: none; }
+.rf-cp-hdr-colps .rf-cp-lbl-colps { display: block; }
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanelItem.js
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanelItem.js 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanelItem.js 2011-01-05 23:40:33 UTC (rev 20900)
@@ -28,18 +28,20 @@
init : function (componentId, options) {
rf.ui.TogglePanelItem.call(this, componentId, options);
+
+ this.headerClass = "rf-cp-hdr-" + this.__state();
},
__enter : function () {
- rf.getDomElement(this.id).style.display = "block";
- this.__header(this.__state()).show();
+ this.__content().show();
+ this.__header().addClass(this.headerClass);
return true;
},
__leave : function () {
- rf.getDomElement(this.id).style.display = "none";
- this.__header(this.__state()).hide();
+ this.__content().hide();
+ this.__header().removeClass(this.headerClass);
return true;
},
@@ -48,13 +50,12 @@
return this.getName() === "true" ? "exp" : "colps";
},
- __header : function (state) {
- var res = $(rf.getDomElement(this.togglePanelId + ":header"));
- if (state) {
- return res.find(".rf-cp-hdr-" + state);
- }
+ __content : function () {
+ return $(rf.getDomElement(this.id));
+ },
- return res;
+ __header : function () {
+ return $(rf.getDomElement(this.togglePanelId + ":header"));
}
});
})(jQuery, RichFaces);
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2011-01-05 23:40:33 UTC (rev 20900)
@@ -270,18 +270,13 @@
.rf-pm-ico-colps {}
.rf-pm-ico-exp {}
+.rf-pm-ico {}
+.rf-pm-ico-colps {}
+.rf-pm-ico-exp {}
-/* Icons */
-.rf-pm-chevron { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Chevron.png']})" }
-.rf-pm-chevron-down { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:ChevronDown.png']})" }
-.rf-pm-chevron-left { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:ChevronLeft.png']})" }
-.rf-pm-chevron-up { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:ChevronUp.png']})" }
-.rf-pm-disc { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Disc.png']})" }
-.rf-pm-grid { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Grid.png']})" }
-.rf-pm-none { width: 16px; height: 16px; }
-.rf-pm-spacer { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Spacer.png']})" }
-.rf-pm-triangle { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Triangle.png']})" }
-.rf-pm-triangle-down { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:TriangleDown.png']})" }
-.rf-pm-triangle-left { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:TriangleLeft.png']})" }
-.rf-pm-triangle-up { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:TriangleUp.png']})" }
\ No newline at end of file
+.rf-pm-hdr-exp .rf-pm-ico-exp { display: block; }
+.rf-pm-hdr-exp .rf-pm-ico-colps { display: none; }
+
+.rf-pm-hdr-colps .rf-pm-ico-exp { display: none; }
+.rf-pm-hdr-colps .rf-pm-ico-colps { display: block; }
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-01-05 23:40:33 UTC (rev 20900)
@@ -196,10 +196,8 @@
__expand : function () {
this.__content().removeClass("rf-pm-colps").addClass("rf-pm-exp");
- var header = this.__header();
- header.find(".rf-pm-ico-colps").hide();
- header.find(".rf-pm-ico-exp").show();
-
+ this.__header().removeClass("rf-pm-gr-hdr-colps").addClass("rf-pm-hdr-exp");
+
this.__setExpandValue(true);
},
@@ -222,9 +220,7 @@
__collapse : function () {
this.__content().addClass("rf-pm-colps").removeClass("rf-pm-exp");
- var header = this.__header();
- header.find(".rf-pm-ico-exp").hide();
- header.find(".rf-pm-ico-colps").show();
+ this.__header().addClass("rf-pm-hdr-colps").removeClass("rf-pm-hdr-exp");
this.__setExpandValue(false);
},
Copied: branches/RF-9323/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java (from rev 20891, trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java)
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java (rev 0)
+++ branches/RF-9323/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,14 @@
+package org.richfaces.renderkit.html;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+public class AccordionRendererTest extends RendererTestBase {
+
+ @Test
+ public void testAccordionItem() throws IOException, SAXException {
+ doTest("accordionItem", "f:item");
+ }
+}
Modified: branches/RF-9323/ui/output/ui/src/test/java/org/richfaces/renderkit/html/CollapsiblePanelRendererTest.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/java/org/richfaces/renderkit/html/CollapsiblePanelRendererTest.java 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/java/org/richfaces/renderkit/html/CollapsiblePanelRendererTest.java 2011-01-05 23:40:33 UTC (rev 20900)
@@ -9,6 +9,6 @@
@Test
public void testEmpty() throws IOException, SAXException {
-// doTest("panelMenuGroup", "f:panelMenuGroup");
+ doTest("collapsiblePanel", "f:panel");
}
}
Copied: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml (from rev 20891, trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml)
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml (rev 0)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/pn"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:head>
+ <title>Richfaces MenuItem Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="f">
+ <pn:accordion>
+ <pn:accordionItem id="item"></pn:accordionItem>
+ </pn:accordion>
+ </h:form>
+</h:body>
+</html>
+
+
Copied: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml (from rev 20891, trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml)
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml (rev 0)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,26 @@
+<div class="rf-ac-itm" id="f:item">
+ <div id="f:item:header" class="rf-ac-itm-hdr rf-ac-itm-hdr-act">
+ <table class="rf-ac-itm-gr">
+ <tbody>
+ <tr>
+ <td class="rf-ac-itm-ico">
+ <div class="rf-ac-itm-ico-act rf-ico-none"></div>
+ <div class="rf-ac-itm-ico-inact rf-ico-none"></div>
+ </td>
+ <td class="rf-ac-itm-lbl">
+ <div class="rf-ac-itm-lbl-act">item</div>
+ <div class="rf-ac-itm-lbl-inact">item</div>
+ </td>
+ <td class="rf-ac-itm-exp-ico">
+ <div class="rf-ac-itm-ico-act rf-ico-none"></div>
+ <div class="rf-ac-itm-ico-inact rf-ico-none"></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div id="f:item:content" class="rf-ac-itm-cnt"></div>
+ <script type="text/javascript">new
+ Text
+ </script>
+</div>
\ No newline at end of file
Copied: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xhtml (from rev 20891, trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xhtml)
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xhtml (rev 0)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xhtml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,45 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/pn"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:head>
+ <title>Richfaces MenuItem Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel"></pn:collapsiblePanel>
+ </h:form>
+</h:body>
+</html>
+
+
Copied: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xmlunit.xml (from rev 20891, trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xmlunit.xml)
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xmlunit.xml (rev 0)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/collapsiblePanel.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -0,0 +1,28 @@
+<div class="rf-cp rf-tgp" id="f:panel">
+ <input type="hidden" name="f:panel-value" id="f:panel-value" value="true"></input>
+ <div class="rf-cp-hdr rf-cp-hdr-exp" id="f:panel:header">
+ <table class="rf-cp-gr">
+ <tbody>
+ <tr>
+ <td class="rf-cp-ico">
+ <div class="rf-cp-ico-colps rf-ico-none"></div>
+ <div class="rf-cp-ico-exp rf-ico-none"></div>
+ </td>
+ <td class="rf-cp-lbl">
+ <div class="rf-cp-lbl-exp"></div>
+ <div class="rf-cp-lbl-colps"></div>
+ </td>
+ <td class="rf-cp-exp-ico">
+ <div class="rf-cp-ico-colps rf-ico-none"></div>
+ <div class="rf-cp-ico-exp rf-ico-none"></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div id="f:panel:content" class="rf-cp-b" style="display:block"></div>
+ <div id="f:panel:empty" style="display:none"></div>
+ <script type="text/javascript">
+ Text
+ </script>
+</div>
\ No newline at end of file
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,17 +1,17 @@
<div id="f:panelMenuGroup" class="rf-pm-gr groupClass">
<input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="false"/>
- <div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr">
+ <div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr rf-pm-gr-hdr-colps">
<table class="rf-pm-gr-gr">
<tbody>
<tr>
<td class="rf-pm-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-triangle-down" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-triangle-down"></div>
+ <div class="rf-pm-ico-exp rf-ico-disc"></div>
</td>
<td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-triangle-up" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-triangle-up"></div>
+ <div class="rf-pm-ico-exp rf-ico-disc"></div>
</td>
</tr>
</tbody>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,17 +1,17 @@
<div id="f:panelMenuGroup-dis" class="rf-pm-gr groupClass rf-pm-gr-dis groupDisableClass">
<input id="f:panelMenuGroup-dis:expanded" name="f:panelMenuGroup-dis:expanded" type="hidden" value="false"/>
- <div id="f:panelMenuGroup-dis:hdr" class="rf-pm-gr-hdr">
+ <div id="f:panelMenuGroup-dis:hdr" class="rf-pm-gr-hdr rf-pm-gr-hdr-colps">
<table class="rf-pm-gr-gr">
<tbody>
<tr>
<td class="rf-pm-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-chevron-down" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-chevron-down" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-chevron-down"></div>
+ <div class="rf-pm-ico-exp rf-ico-chevron-down"></div>
</td>
<td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-chevron-up" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-chevron-up" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-chevron-up"></div>
+ <div class="rf-pm-ico-exp rf-ico-chevron-up"></div>
</td>
</tr>
</tbody>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-item.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-item.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-item.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -2,9 +2,9 @@
<table class="rf-pm-itm-gr">
<tbody>
<tr>
- <td class="rf-pm-itm-ico rf-pm-triangle-down"></td>
+ <td class="rf-pm-itm-ico rf-ico-triangle-down"></td>
<td class="rf-pm-itm-lbl">panelMenuItem</td>
- <td class="rf-pm-itm-exp-ico rf-pm-triangle-up"></td>
+ <td class="rf-pm-itm-exp-ico rf-ico-triangle-up"></td>
</tr>
</tbody>
</table>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-itemDis.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-itemDis.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-itemDis.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -2,9 +2,9 @@
<table class="rf-pm-itm-gr">
<tbody>
<tr>
- <td class="rf-pm-itm-ico rf-pm-chevron-down"></td>
+ <td class="rf-pm-itm-ico rf-ico-chevron-down"></td>
<td class="rf-pm-itm-lbl">panelMenuItem</td>
- <td class="rf-pm-itm-exp-ico rf-pm-chevron-up"></td>
+ <td class="rf-pm-itm-exp-ico rf-ico-chevron-up"></td>
</tr>
</tbody>
</table>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,17 +1,17 @@
<div id="f:panelMenuGroup-top" class="rf-pm-top-gr topGroupClass">
<input id="f:panelMenuGroup-top:expanded" name="f:panelMenuGroup-top:expanded" type="hidden" value="false"/>
- <div id="f:panelMenuGroup-top:hdr" class="rf-pm-top-gr-hdr">
+ <div id="f:panelMenuGroup-top:hdr" class="rf-pm-top-gr-hdr rf-pm-top-gr-hdr-colps">
<table class="rf-pm-top-gr-gr">
<tbody>
<tr>
<td class="rf-pm-top-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-triangle" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-triangle"></div>
+ <div class="rf-pm-ico-exp rf-ico-disc"></div>
</td>
<td class="rf-pm-top-gr-lbl"></td>
<td class="rf-pm-top-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-triangle" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-triangle"></div>
+ <div class="rf-pm-ico-exp rf-ico-disc"></div>
</td>
</tr>
</tbody>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,17 +1,17 @@
<div id="f:panelMenuGroup-topDis" class="rf-pm-top-gr topGroupClass rf-pm-top-gr-dis topGroupDisableClass">
<input id="f:panelMenuGroup-topDis:expanded" name="f:panelMenuGroup-topDis:expanded" type="hidden" value="false"/>
- <div id="f:panelMenuGroup-topDis:hdr" class="rf-pm-top-gr-hdr">
+ <div id="f:panelMenuGroup-topDis:hdr" class="rf-pm-top-gr-hdr rf-pm-top-gr-hdr-colps">
<table class="rf-pm-top-gr-gr">
<tbody>
<tr>
<td class="rf-pm-top-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-chevron" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-chevron" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-chevron"></div>
+ <div class="rf-pm-ico-exp rf-ico-chevron"></div>
</td>
<td class="rf-pm-top-gr-lbl"></td>
<td class="rf-pm-top-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-chevron" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-chevron" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-chevron"></div>
+ <div class="rf-pm-ico-exp rf-ico-chevron"></div>
</td>
</tr>
</tbody>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topItem.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topItem.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topItem.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -2,9 +2,9 @@
<table class="rf-pm-top-itm-gr">
<tbody>
<tr>
- <td class="rf-pm-top-itm-ico rf-pm-triangle"></td>
+ <td class="rf-pm-top-itm-ico rf-ico-triangle"></td>
<td class="rf-pm-top-itm-lbl">panelMenuItem</td>
- <td class="rf-pm-top-itm-exp-ico rf-pm-triangle"></td>
+ <td class="rf-pm-top-itm-exp-ico rf-ico-triangle"></td>
</tr>
</tbody>
</table>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topItemDis.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topItemDis.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topItemDis.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -2,9 +2,9 @@
<table class="rf-pm-top-itm-gr">
<tbody>
<tr>
- <td class="rf-pm-top-itm-ico rf-pm-chevron"></td>
+ <td class="rf-pm-top-itm-ico rf-ico-chevron"></td>
<td class="rf-pm-top-itm-lbl">panelMenuItem</td>
- <td class="rf-pm-top-itm-exp-ico rf-pm-chevron"></td>
+ <td class="rf-pm-top-itm-exp-ico rf-ico-chevron"></td>
</tr>
</tbody>
</table>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,17 +1,17 @@
<div id="f:panelMenuGroup" class="rf-pm-gr">
<input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="true"/>
- <div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr">
+ <div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr rf-pm-gr-hdr-exp">
<table class="rf-pm-gr-gr">
<tbody>
<tr>
<td class="rf-pm-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-none" style="display:none"></div>
- <div class="rf-pm-ico-exp rf-pm-none" style="display:block"></div>
+ <div class="rf-pm-ico-colps rf-ico-none"></div>
+ <div class="rf-pm-ico-exp rf-ico-none"></div>
</td>
<td class="rf-pm-gr-lbl">Group Label</td>
<td class="rf-pm-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-none" style="display:none"></div>
- <div class="rf-pm-ico-exp rf-pm-none" style="display:block"></div>
+ <div class="rf-pm-ico-colps rf-ico-none"></div>
+ <div class="rf-pm-ico-exp rf-ico-none"></div>
</td>
</tr>
</tbody>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,17 +1,17 @@
<div id="f:panelMenuGroup" class="rf-pm-top-gr">
<input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="true"/>
- <div id="f:panelMenuGroup:hdr" class="rf-pm-top-gr-hdr">
+ <div id="f:panelMenuGroup:hdr" class="rf-pm-top-gr-hdr rf-pm-top-gr-hdr-exp">
<table class="rf-pm-top-gr-gr">
<tbody>
<tr>
<td class="rf-pm-top-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-none" style="display:none"></div>
- <div class="rf-pm-ico-exp rf-pm-none" style="display:block"></div>
+ <div class="rf-pm-ico-colps rf-ico-none"></div>
+ <div class="rf-pm-ico-exp rf-ico-none"></div>
</td>
<td class="rf-pm-top-gr-lbl">Group Label</td>
<td class="rf-pm-top-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-none" style="display:none"></div>
- <div class="rf-pm-ico-exp rf-pm-none" style="display:block"></div>
+ <div class="rf-pm-ico-colps rf-ico-none"></div>
+ <div class="rf-pm-ico-exp rf-ico-none"></div>
</td>
</tr>
</tbody>
@@ -23,4 +23,4 @@
</script>
</div>
-</div>
\ No newline at end of file
+</div>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -1,17 +1,17 @@
<div id="f:panelMenuGroup" class="rf-pm-gr">
<input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="false"/>
- <div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr">
+ <div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr rf-pm-gr-hdr-colps">
<table class="rf-pm-gr-gr">
<tbody>
<tr>
<td class="rf-pm-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-none" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-none" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-none"></div>
+ <div class="rf-pm-ico-exp rf-ico-none"></div>
</td>
<td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-none" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-none" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-ico-none"></div>
+ <div class="rf-pm-ico-exp rf-ico-none"></div>
</td>
</tr>
</tbody>
Modified: branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2011-01-05 23:11:13 UTC (rev 20899)
+++ branches/RF-9323/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2011-01-05 23:40:33 UTC (rev 20900)
@@ -2,9 +2,9 @@
<table class="rf-pm-itm-gr">
<tbody>
<tr>
- <td class="rf-pm-itm-ico rf-pm-none"></td>
+ <td class="rf-pm-itm-ico rf-ico-none"></td>
<td class="rf-pm-itm-lbl">My MY Item</td>
- <td class="rf-pm-itm-exp-ico rf-pm-none"></td>
+ <td class="rf-pm-itm-exp-ico rf-ico-none"></td>
</tr>
</tbody>
</table>
13 years, 11 months
JBoss Rich Faces SVN: r20899 - trunk.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-05 18:11:13 -0500 (Wed, 05 Jan 2011)
New Revision: 20899
Modified:
trunk/
Log:
Initialized merge tracking via "svnmerge" with revisions "1-20621" from
https://svn.jboss.org/repos/richfaces/branches/RF-9323
Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
- /branches/RF-7817:1-19154 /branches/RF-8742:1-19867 /branches/RF-9309:1-19112,19378
+ /branches/RF-7817:1-19154 /branches/RF-8742:1-19867 /branches/RF-9309:1-19112,19378 /branches/RF-9323:1-20621
13 years, 11 months
JBoss Rich Faces SVN: r20898 - in branches/RF-9323/cdk/maven-cdk-plugin/src: main/java/org/richfaces/builder/mojo and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-05 18:05:01 -0500 (Wed, 05 Jan 2011)
New Revision: 20898
Modified:
branches/RF-9323/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
branches/RF-9323/cdk/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
Log:
RESOLVED - issue RF-10105: CDK: impossible to import configuration files from project
https://issues.jboss.org/browse/RF-10105
Modified: branches/RF-9323/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- branches/RF-9323/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-05 21:01:18 UTC (rev 20897)
+++ branches/RF-9323/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-05 23:05:01 UTC (rev 20898)
@@ -68,9 +68,8 @@
renderer=@JsfRenderer(type="org.richfaces.cdk.test.HtmlAbbrRenderer")),
@RendererSpecificComponent(type = "org.richfaces.cdk.test.TestHtmlDfn",
tag=@Tag(name="dfn"),
- generate="org.richfaces.cdk.test.component.html.HtmlTestDfn"
- /*,
- attributes="html5.xml"*/)
+ generate="org.richfaces.cdk.test.component.html.HtmlTestDfn",
+ attributes="html5.xml")
}
)
public abstract class AbstractTestComponent extends UIComponentBase /*implements ValueHolder */{
Modified: branches/RF-9323/cdk/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- branches/RF-9323/cdk/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2011-01-05 21:01:18 UTC (rev 20897)
+++ branches/RF-9323/cdk/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2011-01-05 23:05:01 UTC (rev 20898)
@@ -360,10 +360,14 @@
CdkClassLoader classLoader = null;
try {
- String outputDirectory = project.getBuild().getOutputDirectory();
- List<File> urls = new ArrayList<File>(classpathElements.size() + 1);
- urls.add(new File(outputDirectory));
-
+ // This Mojo executed befor process-resources phase, therefore we have to use original resource folders.
+ List<Resource> resources = project.getResources();
+ List<File> urls = new ArrayList<File>(classpathElements.size() + resources.size());
+ for (Resource resource : resources) {
+ String directory = resource.getDirectory();
+ // TODO - use includes/excludes and target path.
+ urls.add(resolveRelativePath(new File(directory)));
+ }
for (Iterator<String> iter = classpathElements.iterator(); iter.hasNext();) {
String element = iter.next();
13 years, 11 months
JBoss Rich Faces SVN: r20897 - branches/4.0.0.M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2011-01-05 16:01:18 -0500 (Wed, 05 Jan 2011)
New Revision: 20897
Modified:
branches/4.0.0.M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml
Log:
RF-10121 updated release branch to fix regression
Modified: branches/4.0.0.M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml
===================================================================
--- branches/4.0.0.M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml 2011-01-05 20:54:14 UTC (rev 20896)
+++ branches/4.0.0.M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml 2011-01-05 21:01:18 UTC (rev 20897)
@@ -145,8 +145,11 @@
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
-
<dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
</dependency>
13 years, 11 months
JBoss Rich Faces SVN: r20896 - tags/4.0.0.20101226-M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2011-01-05 15:54:14 -0500 (Wed, 05 Jan 2011)
New Revision: 20896
Modified:
tags/4.0.0.20101226-M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml
Log:
RF-10121 updating tag to to fix archetype regression
Modified: tags/4.0.0.20101226-M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml
===================================================================
--- tags/4.0.0.20101226-M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml 2011-01-05 14:28:02 UTC (rev 20895)
+++ tags/4.0.0.20101226-M5/archetypes/richfaces-archetype-simpleapp/src/main/resources/archetype-resources/pom.xml 2011-01-05 20:54:14 UTC (rev 20896)
@@ -145,8 +145,11 @@
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
-
<dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
</dependency>
13 years, 11 months
JBoss Rich Faces SVN: r20895 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-05 09:28:02 -0500 (Wed, 05 Jan 2011)
New Revision: 20895
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Template.java
Log:
fixed nested component prefixes for second rows of iteration components
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Template.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Template.java 2011-01-05 14:27:25 UTC (rev 20894)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Template.java 2011-01-05 14:28:02 UTC (rev 20895)
@@ -34,13 +34,13 @@
REDDIV ("redDiv", "Red div", ""),
BLUEDIV ("blueDiv", "Blue div", ""),
RICHDATATABLE1 ("richDataTable1", "Rich Data Table Row 1", "containerRichDataTable1:0:"),
- RICHDATATABLE2 ("richDataTable2", "Rich Data Table Row 2", "containerRichDataTable1:1:"),
+ RICHDATATABLE2 ("richDataTable2", "Rich Data Table Row 2", "containerRichDataTable2:1:"),
HDATATABLE1 ("hDataTable1", "JSF Data Table Row 1", "containerHDataTable1:0:"),
HDATATABLE2 ("hDataTable2", "JSF Data Table Row 2", "containerHDataTable1:1:"),
UIREPEAT1 ("uiRepeat1", "UI Repeat Row 1", "containerUiRepeat1:0:"),
- UIREPEAT2 ("uiRepeat2", "UI Repeat Row 2", "containerUiRepeat1:1:"),
+ UIREPEAT2 ("uiRepeat2", "UI Repeat Row 2", "containerUiRepeat2:1:"),
A4JREPEAT1 ("a4jRepeat1", "A4J Repeat Row 1", "containerA4JRepeat1:0:"),
- A4JREPEAT2 ("a4jRepeat2", "A4J Repeat Row 2", "containerA4JRepeat1:0:");
+ A4JREPEAT2 ("a4jRepeat2", "A4J Repeat Row 2", "containerA4JRepeat2:1:");
/**
* identifier of a template
13 years, 11 months
JBoss Rich Faces SVN: r20894 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-05 09:27:25 -0500 (Wed, 05 Jan 2011)
New Revision: 20894
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestInterval.java
Log:
increased maximum allowable deviation
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestInterval.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestInterval.java 2011-01-05 14:26:45 UTC (rev 20893)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestInterval.java 2011-01-05 14:27:25 UTC (rev 20894)
@@ -151,7 +151,7 @@
}
private void validateAverageDeviation() {
- long maximumAvgDeviation = Math.min(interval / 4, 1000);
+ long maximumAvgDeviation = Math.min(interval / 3, 1000);
long averageDeviation = deviationTotal / deviationCount;
if (seleniumDebug) {
13 years, 11 months