You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2010/06/04 17:05:13 UTC
svn commit: r951435 - in
/myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets:
SupportsMarkupRule.java SupportsRenderedPartiallyRule.java
TobagoComponentHandler.java
Author: bommel
Date: Fri Jun 4 15:05:12 2010
New Revision: 951435
URL: http://svn.apache.org/viewvc?rev=951435&view=rev
Log:
(TOBAGO-637) property renderedPartially
Added:
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsRenderedPartiallyRule.java (with props)
Modified:
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsMarkupRule.java
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
Modified: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsMarkupRule.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsMarkupRule.java?rev=951435&r1=951434&r2=951435&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsMarkupRule.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsMarkupRule.java Fri Jun 4 15:05:12 2010
@@ -30,11 +30,6 @@ import org.apache.myfaces.tobago.util.Co
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
-/*
- * User: bommel
- * Date: Jan 20, 2007
- * Time: 5:54:23 PM
- */
public class SupportsMarkupRule extends MetaRule {
public static final SupportsMarkupRule INSTANCE = new SupportsMarkupRule();
Added: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsRenderedPartiallyRule.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsRenderedPartiallyRule.java?rev=951435&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsRenderedPartiallyRule.java (added)
+++ myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsRenderedPartiallyRule.java Fri Jun 4 15:05:12 2010
@@ -0,0 +1,63 @@
+package org.apache.myfaces.tobago.facelets;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.el.ELAdaptor;
+import com.sun.facelets.tag.MetaRule;
+import com.sun.facelets.tag.Metadata;
+import com.sun.facelets.tag.MetadataTarget;
+import com.sun.facelets.tag.TagAttribute;
+import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
+import org.apache.myfaces.tobago.util.ComponentUtils;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+
+public class SupportsRenderedPartiallyRule extends MetaRule {
+ public static final SupportsRenderedPartiallyRule INSTANCE = new SupportsRenderedPartiallyRule();
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget metadataTarget) {
+ if (metadataTarget.isTargetInstanceOf(SupportsRenderedPartiallyRule.class)) {
+ if (Attributes.RENDERED_PARTIALLY.equals(name)) {
+ return new SupportsRenderedPartiallyMapper(attribute);
+ }
+ }
+ return null;
+ }
+
+ static final class SupportsRenderedPartiallyMapper extends Metadata {
+
+ private final TagAttribute attribute;
+
+ public SupportsRenderedPartiallyMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ if (attribute.isLiteral()) {
+ String[] components = ComponentUtils.splitList(attribute.getValue());
+ ((SupportsRenderedPartially) instance).setRenderedPartially(components);
+ } else {
+ ValueExpression expression = attribute.getValueExpression(ctx, Object.class);
+ ELAdaptor.setExpression((UIComponent) instance, Attributes.RENDERED_PARTIALLY, expression);
+ }
+ }
+ }
+}
Propchange: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsRenderedPartiallyRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/SupportsRenderedPartiallyRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java?rev=951435&r1=951434&r2=951435&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java Fri Jun 4 15:05:12 2010
@@ -26,6 +26,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.OnComponentCreated;
import org.apache.myfaces.tobago.component.OnComponentPopulated;
import org.apache.myfaces.tobago.component.SupportsMarkup;
+import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
import org.apache.myfaces.tobago.event.SheetStateChangeSource;
import org.apache.myfaces.tobago.event.SortActionSource;
import org.apache.myfaces.tobago.event.TabChangeSource;
@@ -66,6 +67,9 @@ public class TobagoComponentHandler exte
if (InputSuggest.class.isAssignableFrom(aClass)) {
metaRuleset.addRule(SuggestMethodRule.INSTANCE);
}
+ if (SupportsRenderedPartially.class.isAssignableFrom(aClass)) {
+ metaRuleset.addRule(SupportsRenderedPartiallyRule.INSTANCE);
+ }
return metaRuleset;
}