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 2007/11/19 14:53:50 UTC

svn commit: r596299 - /myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java

Author: bommel
Date: Mon Nov 19 05:53:49 2007
New Revision: 596299

URL: http://svn.apache.org/viewvc?rev=596299&view=rev
Log:
(TOBAGO-544) tip and label attribute of TobagoLabelExtensionHandler (tx) in facelets should set the expression on label if a expression is available

Modified:
    myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java

Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java?rev=596299&r1=596298&r2=596299&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java Mon Nov 19 05:53:49 2007
@@ -18,13 +18,15 @@
  */
 
 import com.sun.facelets.FaceletContext;
+import com.sun.facelets.el.ELAdaptor;
 import com.sun.facelets.tag.MetaRuleset;
 import com.sun.facelets.tag.TagAttribute;
 import com.sun.facelets.tag.jsf.ComponentConfig;
 import com.sun.facelets.tag.jsf.ComponentHandler;
 import com.sun.facelets.tag.jsf.ComponentSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.tobago.TobagoConstants;
-import org.apache.myfaces.tobago.util.LayoutUtil;
 import org.apache.myfaces.tobago.component.SupportsMarkup;
 import org.apache.myfaces.tobago.component.UIGridLayout;
 import org.apache.myfaces.tobago.component.UIInput;
@@ -32,10 +34,10 @@
 import org.apache.myfaces.tobago.component.UIPanel;
 import org.apache.myfaces.tobago.facelets.SuggestMethodRule;
 import org.apache.myfaces.tobago.facelets.SupportsMarkupRule;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.util.LayoutUtil;
 
 import javax.el.ELException;
+import javax.el.ValueExpression;
 import javax.faces.FacesException;
 import javax.faces.application.Application;
 import javax.faces.component.UIComponent;
@@ -127,10 +129,20 @@
     label.setId(uid);
     label.getAttributes().put(TobagoConstants.ATTR_FOR, "@auto");
     if (tipAttribute != null) {
-      label.setTip(tipAttribute.getValue(faceletContext));
+      if (tipAttribute.isLiteral()) {
+        label.setTip(tipAttribute.getValue(faceletContext));
+      } else {
+        ValueExpression expression = tipAttribute.getValueExpression(faceletContext, String.class);
+        ELAdaptor.setExpression(label, TobagoConstants.ATTR_TIP, expression);
+      }
     }
     if (labelAttribute != null) {
-      label.setValue(labelAttribute.getValue(faceletContext));
+      if (labelAttribute.isLiteral()) {
+        label.setValue(labelAttribute.getValue(faceletContext));
+      } else {
+        ValueExpression expression = labelAttribute.getValueExpression(faceletContext, String.class);
+        ELAdaptor.setExpression(label, TobagoConstants.ATTR_LABEL, expression); 
+      }
     }
     panel.getChildren().add(label);
   }