Author: alexsmirnov
Date: 2011-01-13 14:45:26 -0500 (Thu, 13 Jan 2011)
New Revision: 21004
Modified:
trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.UIComponent.xml
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java
Log:
RESOLVED - issue RF-9949: Faces-config: several components have attribute actionExpression
https://issues.jboss.org/browse/RF-9949
Modified:
trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.UIComponent.xml
===================================================================
---
trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.UIComponent.xml 2011-01-13
19:31:58 UTC (rev 21003)
+++
trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.UIComponent.xml 2011-01-13
19:45:26 UTC (rev 21004)
@@ -180,5 +180,9 @@
<icon />
<property-name>binding</property-name>
<property-class>javax.faces.component.UIComponent</property-class>
+ <property-extension>
+ <cdk:generate>false</cdk:generate>
+ <cdk:literal>false</cdk:literal>
+ </property-extension>
</property>
</cdk:properties>
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java 2011-01-13
19:31:58 UTC (rev 21003)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java 2011-01-13
19:45:26 UTC (rev 21004)
@@ -30,5 +30,8 @@
*/
public abstract class ElementAdapterBase<Bean extends ElementBeanBase, Model extends
BeanModelBase> extends AdapterBase<Bean, Model> {
+ protected void postMarshal(Model model, Bean bean) {
+ bean.setFilterHiddenAttributes(true);
+ };
}
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java 2011-01-13
19:31:58 UTC (rev 21003)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java 2011-01-13
19:45:26 UTC (rev 21004)
@@ -35,6 +35,7 @@
/**
* TODO - is the tho different collections are necessary ?
+ *
* @author akolonitsky
* @since Mar 19, 2010
*/
@@ -55,29 +56,64 @@
}
};
+ private static final Predicate<PropertyBase> VISIBLE_PROPERTY_PREDICATE = new
Predicate<PropertyBase>() {
+ @Override
+ public boolean apply(PropertyBase input) {
+ if (input instanceof PropertyModel) {
+ return !input.isHidden();
+ }
+ return false;
+ }
+ };
+
+ private static final Predicate<PropertyBase> VISIBLE_ATTRIBUTE_PREDICATE = new
Predicate<PropertyBase>() {
+ @Override
+ public boolean apply(PropertyBase input) {
+ if (input instanceof AttributeModel) {
+ return !input.isHidden();
+ }
+ return false;
+ }
+ };
+
private Collection<? extends PropertyBase> attributes = Lists.newArrayList();
-
- private Collection<PropertyModel> properties =
(Collection<PropertyModel>) Collections2.filter(attributes, PROPERTY_PREDICATE);
- private Collection<AttributeModel> facesAttributes =
(Collection<AttributeModel>) Collections2.filter(attributes, ATTRIBUTE_PREDICATE);
+ private Collection<PropertyModel> properties =
(Collection<PropertyModel>) Collections2.filter(attributes,
+ PROPERTY_PREDICATE);
+ private Collection<AttributeModel> facesAttributes =
(Collection<AttributeModel>) Collections2.filter(attributes,
+ ATTRIBUTE_PREDICATE);
+
public Collection<PropertyModel> getProperties() {
return properties;
}
-
public Collection<AttributeModel> getFacesAttributes() {
return this.facesAttributes;
}
-
public Collection<PropertyBase> getAttributes() {
return (Collection<PropertyBase>) attributes;
}
- public void setAttributes(Collection<PropertyBase> attributes) {
- this.attributes = attributes;
- properties = (Collection<PropertyModel>)
Collections2.filter(this.attributes, PROPERTY_PREDICATE);
- facesAttributes = (Collection<AttributeModel>)
Collections2.filter(this.attributes, ATTRIBUTE_PREDICATE);
+ /**
+ * <p class="changed_added_4_0">Set filtering visible properties and
attributes, to unmarshall public properties only.</p>
+ * @param filter
+ */
+ public void setFilterHiddenAttributes(boolean filter) {
+ if (filter) {
+ properties = (Collection<PropertyModel>)
Collections2.filter(this.attributes, VISIBLE_PROPERTY_PREDICATE);
+ facesAttributes =
+ (Collection<AttributeModel>) Collections2.filter(this.attributes,
VISIBLE_ATTRIBUTE_PREDICATE);
+ } else {
+ properties = (Collection<PropertyModel>)
Collections2.filter(this.attributes, PROPERTY_PREDICATE);
+ facesAttributes = (Collection<AttributeModel>)
Collections2.filter(this.attributes, ATTRIBUTE_PREDICATE);
+ }
}
+
+ // public void setAttributes(Collection<PropertyBase> attributes) {
+ // this.attributes = attributes;
+ // properties = (Collection<PropertyModel>)
Collections2.filter(this.attributes, PROPERTY_PREDICATE);
+ // facesAttributes = (Collection<AttributeModel>)
Collections2.filter(this.attributes, ATTRIBUTE_PREDICATE);
+ // }
}