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/10/12 08:19:08 UTC

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

Author: bommel
Date: Thu Oct 11 23:19:07 2007
New Revision: 584061

URL: http://svn.apache.org/viewvc?rev=584061&view=rev
Log:
(TOBAGO-505) <tx:selectBooleanCheckbox> with attribute "labelWidth" doesn't work

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=584061&r1=584060&r2=584061&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 Thu Oct 11 23:19:07 2007
@@ -24,6 +24,7 @@
 import com.sun.facelets.tag.jsf.ComponentHandler;
 import com.sun.facelets.tag.jsf.ComponentSupport;
 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;
@@ -31,6 +32,8 @@
 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 javax.el.ELException;
 import javax.faces.FacesException;
@@ -45,6 +48,8 @@
  * Time: 6:14:34 PM
  */
 public abstract class TobagoLabelExtensionHandler extends ComponentHandler {
+  private static final Log LOG = LogFactory.getLog(TobagoLabelExtensionHandler.class);
+  private static final String DEFAULT_COLUMNS = "fixed;*";
   private TagAttribute labelWidthAttribute;
   private TagAttribute tipAttribute;
   private TagAttribute labelAttribute;
@@ -148,7 +153,12 @@
     UIGridLayout gridLayout = (UIGridLayout) application.createComponent(UIGridLayout.COMPONENT_TYPE);
     gridLayout.setRendererType(TobagoConstants.RENDERER_TYPE_GRID_LAYOUT);
     if (labelWidthAttribute != null) {
-      gridLayout.setColumns(getColumns(labelWidthAttribute.getValue(faceletContext)));
+      String columns = getColumns(labelWidthAttribute.getValue(faceletContext));
+      if (!LayoutUtil.checkTokens(columns)) {
+        LOG.warn("Illegal value for columns = \"" + columns + "\" replacing with default: \"" + DEFAULT_COLUMNS + "\"");
+        columns = DEFAULT_COLUMNS;
+      }
+      gridLayout.setColumns(columns);
     } else {
       gridLayout.setColumns(getColumns("fixed"));
     }



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

Posted by Volker Weber <v....@inexso.de>.
Hi Bernd,

i tryed this before, but it did not work in tobago-example-facelets
helloWorld.xml (adding a labelWidth to the tx:date).


Regards,
    Volker

2007/10/12, bommel@apache.org <bo...@apache.org>:
> Author: bommel
> Date: Thu Oct 11 23:19:07 2007
> New Revision: 584061
>
> URL: http://svn.apache.org/viewvc?rev=584061&view=rev
> Log:
> (TOBAGO-505) <tx:selectBooleanCheckbox> with attribute "labelWidth" doesn't work
>
> 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=584061&r1=584060&r2=584061&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 Thu Oct 11 23:19:07 2007
> @@ -24,6 +24,7 @@
>  import com.sun.facelets.tag.jsf.ComponentHandler;
>  import com.sun.facelets.tag.jsf.ComponentSupport;
>  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;
> @@ -31,6 +32,8 @@
>  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 javax.el.ELException;
>  import javax.faces.FacesException;
> @@ -45,6 +48,8 @@
>   * Time: 6:14:34 PM
>   */
>  public abstract class TobagoLabelExtensionHandler extends ComponentHandler {
> +  private static final Log LOG = LogFactory.getLog(TobagoLabelExtensionHandler.class);
> +  private static final String DEFAULT_COLUMNS = "fixed;*";
>    private TagAttribute labelWidthAttribute;
>    private TagAttribute tipAttribute;
>    private TagAttribute labelAttribute;
> @@ -148,7 +153,12 @@
>      UIGridLayout gridLayout = (UIGridLayout) application.createComponent(UIGridLayout.COMPONENT_TYPE);
>      gridLayout.setRendererType(TobagoConstants.RENDERER_TYPE_GRID_LAYOUT);
>      if (labelWidthAttribute != null) {
> -      gridLayout.setColumns(getColumns(labelWidthAttribute.getValue(faceletContext)));
> +      String columns = getColumns(labelWidthAttribute.getValue(faceletContext));
> +      if (!LayoutUtil.checkTokens(columns)) {
> +        LOG.warn("Illegal value for columns = \"" + columns + "\" replacing with default: \"" + DEFAULT_COLUMNS + "\"");
> +        columns = DEFAULT_COLUMNS;
> +      }
> +      gridLayout.setColumns(columns);
>      } else {
>        gridLayout.setColumns(getColumns("fixed"));
>      }
>
>
>