Author: andrei_exadel
Date: 2007-12-28 07:54:38 -0500 (Fri, 28 Dec 2007)
New Revision: 5064
Removed:
trunk/ui/columns/src/main/java/org/richfaces/taglib/ActionSourceRule.java
trunk/ui/columns/src/main/java/org/richfaces/taglib/ComponentRule.java
trunk/ui/columns/src/main/java/org/richfaces/taglib/ValueHolderRule.java
Modified:
trunk/ui/columns/src/main/java/org/richfaces/taglib/ComponentHandler.java
Log:
delete meta-rules classes
Deleted: trunk/ui/columns/src/main/java/org/richfaces/taglib/ActionSourceRule.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ActionSourceRule.java 2007-12-28
12:34:21 UTC (rev 5063)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ActionSourceRule.java 2007-12-28
12:54:38 UTC (rev 5064)
@@ -1,138 +0,0 @@
-/**
- * Licensed under the Common Development and Distribution License,
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *
http://www.sun.com/cddl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.richfaces.taglib;
-
-import javax.faces.component.ActionSource;
-import javax.faces.component.ActionSource2;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.MethodExpressionActionListener;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.el.LegacyMethodBinding;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.util.FacesAPI;
-
-/**
- *
- * @author Jacob Hookom
- * @version $Id: ActionSourceRule.java,v 1.2 2005/08/24 04:38:50 jhook Exp $
- */
-final class ActionSourceRule extends MetaRule {
-
- public final static Class[] ACTION_SIG = new Class[0];
-
- public final static Class[] ACTION_LISTENER_SIG = new Class[] { ActionEvent.class };
-
- final static class ActionMapper extends Metadata {
-
- private final TagAttribute attr;
-
- public ActionMapper(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ActionSource) instance).setAction(new LegacyMethodBinding(
- this.attr.getMethodExpression(ctx, String.class,
- ActionSourceRule.ACTION_SIG)));
- }
- }
-
- final static class ActionMapper2 extends Metadata {
-
- private final TagAttribute attr;
-
- public ActionMapper2(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ActionSource2) instance).setActionExpression(this.attr
- .getMethodExpression(ctx, String.class,
- ActionSourceRule.ACTION_SIG));
- }
-
- }
-
- final static class ActionListenerMapper extends Metadata {
-
- private final TagAttribute attr;
-
- public ActionListenerMapper(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ActionSource) instance)
- .setActionListener(new LegacyMethodBinding(this.attr
- .getMethodExpression(ctx, null,
- ActionSourceRule.ACTION_LISTENER_SIG)));
- }
-
- }
-
- final static class ActionListenerMapper2 extends Metadata {
-
- private final TagAttribute attr;
-
- public ActionListenerMapper2(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ActionSource2) instance)
- .addActionListener(new MethodExpressionActionListener(
- this.attr.getMethodExpression(ctx, null,
- ActionSourceRule.ACTION_LISTENER_SIG)));
-
- }
-
- }
-
- public final static ActionSourceRule Instance = new ActionSourceRule();
-
- public ActionSourceRule() {
- super();
- }
-
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
- if (meta.isTargetInstanceOf(ActionSource.class)) {
-
- boolean elSupport = FacesAPI.getComponentVersion(meta
- .getTargetClass()) >= 12;
-
- if ("action".equals(name)) {
- if (elSupport) {
- return new ActionMapper2(attribute);
- } else {
- return new ActionMapper(attribute);
- }
- }
-
- if ("actionListener".equals(name)) {
- if (elSupport) {
- return new ActionListenerMapper2(attribute);
- } else {
- return new ActionListenerMapper(attribute);
- }
- }
- }
- return null;
- }
-}
Modified: trunk/ui/columns/src/main/java/org/richfaces/taglib/ComponentHandler.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ComponentHandler.java 2007-12-28
12:34:21 UTC (rev 5063)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ComponentHandler.java 2007-12-28
12:54:38 UTC (rev 5064)
@@ -253,34 +253,20 @@
return ctx.generateUniqueId(this.tagId);
}
+ /* (non-Javadoc)
+ * @see com.sun.facelets.tag.MetaTagHandler#createMetaRuleset(java.lang.Class)
+ */
protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset m = super.createMetaRuleset(type);
+ MetaRuleset ruleset = super.createMetaRuleset(type);
+ ruleset.ignore("var");
+ ruleset.ignore("index");
+ ruleset.ignore("columns");
+ ruleset.ignore("begin");
+ ruleset.ignore("end");
+ ruleset.ignore("value");
+ return ruleset;
- // ignore standard component attributes
- m.ignore("binding").ignore("id");
-
- // add auto wiring for attributes
- m.addRule(ComponentRule.Instance);
-
- // if it's an ActionSource
- if (ActionSource.class.isAssignableFrom(type)) {
- m.addRule(ActionSourceRule.Instance);
- }
-
- // if it's a ValueHolder
- if (ValueHolder.class.isAssignableFrom(type)) {
- m.addRule(ValueHolderRule.Instance);
-
- // if it's an EditableValueHolder
- if (EditableValueHolder.class.isAssignableFrom(type)) {
- m.ignore("submittedValue");
- m.ignore("valid");
- m.addRule(EditableValueHolderRule.Instance);
- }
- }
-
- return m;
- }
+ }
/**
* A hook method for allowing developers to do additional processing once Facelets
Deleted: trunk/ui/columns/src/main/java/org/richfaces/taglib/ComponentRule.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ComponentRule.java 2007-12-28
12:34:21 UTC (rev 5063)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ComponentRule.java 2007-12-28
12:54:38 UTC (rev 5064)
@@ -1,139 +0,0 @@
-/**
- * Licensed under the Common Development and Distribution License,
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *
http://www.sun.com/cddl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.richfaces.taglib;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.el.LegacyValueBinding;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.util.FacesAPI;
-
-/**
- *
- * @author Jacob Hookom
- * @version $Id: ComponentRule.java,v 1.2 2005/08/24 04:38:50 jhook Exp $
- */
-final class ComponentRule extends MetaRule {
-
- final class LiteralAttributeMetadata extends Metadata {
-
- private final String name;
- private final String value;
-
- public LiteralAttributeMetadata(String name, String value) {
- this.value = value;
- this.name = name;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIComponent) instance).getAttributes().put(this.name, this.value);
- }
- }
-
- final static class ValueExpressionMetadata extends Metadata {
-
- private final String name;
-
- private final TagAttribute attr;
-
- private final Class type;
-
- public ValueExpressionMetadata(String name, Class type,
- TagAttribute attr) {
- this.name = name;
- this.attr = attr;
- this.type = type;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIComponent) instance).setValueExpression(this.name, this.attr
- .getValueExpression(ctx, this.type));
- }
-
- }
-
- final static class ValueBindingMetadata extends Metadata {
-
- private final String name;
-
- private final TagAttribute attr;
-
- private final Class type;
-
- public ValueBindingMetadata(String name, Class type, TagAttribute attr) {
- this.name = name;
- this.attr = attr;
- this.type = type;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIComponent) instance).setValueBinding(this.name,
- new LegacyValueBinding(this.attr.getValueExpression(ctx,
- this.type)));
- }
-
- }
-
- private final static Logger log = Logger
- .getLogger("facelets.tag.component");
-
- public final static ComponentRule Instance = new ComponentRule();
-
- public ComponentRule() {
- super();
- }
-
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
- if (meta.isTargetInstanceOf(UIComponent.class)) {
-
- // if component and dynamic, then must set expression
- if (!attribute.isLiteral()) {
- Class type = meta.getPropertyType(name);
- if (type == null) {
- type = Object.class;
- }
- if (FacesAPI.getComponentVersion(meta.getTargetClass()) >= 12) {
- return new ValueExpressionMetadata(name, type, attribute);
- } else {
- return new ValueBindingMetadata(name, type, attribute);
- }
- } else if (meta.getWriteMethod(name) == null) {
-
- // this was an attribute literal, but not property
- warnAttr(attribute, meta.getTargetClass(), name);
-
- return new LiteralAttributeMetadata(name, attribute.getValue());
- }
- }
- return null;
- }
-
- private static void warnAttr(TagAttribute attr, Class type, String n) {
- if (log.isLoggable(Level.WARNING)) {
- log.warning(attr + " Property '" + n + "' is not on
type: "
- + type.getName());
- }
- }
-
-}
Deleted: trunk/ui/columns/src/main/java/org/richfaces/taglib/ValueHolderRule.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ValueHolderRule.java 2007-12-28
12:34:21 UTC (rev 5063)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ValueHolderRule.java 2007-12-28
12:54:38 UTC (rev 5064)
@@ -1,135 +0,0 @@
-/**
- * Licensed under the Common Development and Distribution License,
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *
http://www.sun.com/cddl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.richfaces.taglib;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.ValueHolder;
-import javax.faces.convert.Converter;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.el.LegacyValueBinding;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.util.FacesAPI;
-
-/**
- *
- * @author Jacob Hookom
- * @version $Id: ValueHolderRule.java,v 1.2 2005/08/24 04:38:51 jhook Exp $
- */
-final class ValueHolderRule extends MetaRule {
-
- final static class LiteralConverterMetadata extends Metadata {
-
- private final String converterId;
-
- public LiteralConverterMetadata(String converterId) {
- this.converterId = converterId;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ValueHolder) instance).setConverter(ctx.getFacesContext()
- .getApplication().createConverter(this.converterId));
- }
- }
-
- final static class DynamicConverterMetadata extends Metadata {
-
- private final TagAttribute attr;
-
- public DynamicConverterMetadata(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ValueHolder) instance).setConverter((Converter) this.attr
- .getObject(ctx, Converter.class));
- }
- }
-
- final static class LiteralValueMetadata extends Metadata {
-
- private final String value;
-
- public LiteralValueMetadata(String value) {
- this.value = value;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ValueHolder) instance).setValue(this.value);
- }
- }
-
- final static class DynamicValueExpressionMetadata extends Metadata {
-
- private final TagAttribute attr;
-
- public DynamicValueExpressionMetadata(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIComponent) instance).setValueExpression("value", attr
- .getValueExpression(ctx, Object.class));
- }
- }
-
- final static class DynamicValueBindingMetadata extends Metadata {
-
- private final TagAttribute attr;
-
- public DynamicValueBindingMetadata(TagAttribute attr) {
- this.attr = attr;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIComponent) instance).setValueBinding("value",
- new LegacyValueBinding(attr.getValueExpression(ctx,
- Object.class)));
- }
- }
-
- public final static ValueHolderRule Instance = new ValueHolderRule();
-
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
- if (meta.isTargetInstanceOf(ValueHolder.class)) {
-
- if ("converter".equals(name)) {
- if (attribute.isLiteral()) {
- return new LiteralConverterMetadata(attribute.getValue());
- } else {
- return new DynamicConverterMetadata(attribute);
- }
- }
-
- if ("value".equals(name)) {
- if (attribute.isLiteral()) {
- return new LiteralValueMetadata(attribute.getValue());
- } else {
- if (FacesAPI.getComponentVersion(meta.getTargetClass()) >= 12) {
- return new DynamicValueExpressionMetadata(attribute);
- } else {
- return new DynamicValueBindingMetadata(attribute);
- }
- }
- }
- }
- return null;
- }
-
-}