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 2008/03/18 18:56:47 UTC

svn commit: r638476 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java

Author: bommel
Date: Tue Mar 18 10:56:44 2008
New Revision: 638476

URL: http://svn.apache.org/viewvc?rev=638476&view=rev
Log:
(TOBAGO-637) Generate Components, JSP Tags from annotations

added invokeOnComponent for tobago component

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java?rev=638476&r1=638475&r2=638476&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java Tue Mar 18 10:56:44 2008
@@ -23,6 +23,8 @@
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ONCLICK;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
 import static org.apache.myfaces.tobago.TobagoConstants.FACET_MENUBAR;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UICell;
 import org.apache.myfaces.tobago.component.UICommand;
@@ -40,7 +42,7 @@
 import java.util.Map;
 
 public abstract class LayoutableRendererBase
-    extends RendererBase implements LayoutInformationProvider {
+    extends RendererBase implements LayoutableRenderer {
 
   private static final Log LOG = LogFactory.getLog(LayoutableRendererBase.class);
 
@@ -127,17 +129,20 @@
   private int getFixedSpace(FacesContext facesContext, UIComponent component,
                             String attr, String attrFixed) {
     int intSpace = -1;
-    String space = null;
+    Object space = null;
     if (component != null) {
-      space = ComponentUtil.getStringAttribute(component, attr);
+      space = ComponentUtil.getObjectAttribute(component, attr);
     }
-    if (space != null) {
+    if (space != null && space instanceof String) {
       try {
-        intSpace = Integer.parseInt(space.replaceAll("\\D", ""));
+        intSpace = Integer.parseInt(((String) space).replaceAll("\\D", ""));
       } catch (NumberFormatException e) {
         LOG.error("Caught: " + e.getMessage(), e);
       }
     }
+    if (space != null && space instanceof Integer) {
+      intSpace = (Integer) space;
+    }
     if (intSpace == -1) {
       return getConfiguredValue(facesContext, component, attrFixed);
     } else {
@@ -152,6 +157,10 @@
 
   protected void checkForCommandFacet(UIComponent component, List<String> clientIds, FacesContext facesContext,
                                       TobagoResponseWriter writer) throws IOException {
+    if (ComponentUtil.getBooleanAttribute(component, ATTR_READONLY)
+        || ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED)) {
+      return;
+    }
     Map<String, UIComponent> facets = component.getFacets();
     for (Map.Entry<String, UIComponent> entry : facets.entrySet()) {
       if (entry.getValue() instanceof UICommand) {
@@ -196,5 +205,11 @@
               + facetAction + "});\n}";
       writer.writeJavascript(script);
     }
+  }
+
+  public void layoutBegin(FacesContext context, UIComponent component) throws IOException {
+  }
+
+  public void layoutEnd(FacesContext context, UIComponent component) throws IOException {
   }
 }