myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skitch...@apache.org
Subject svn commit: r781355 - /myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfig.java
Date Wed, 03 Jun 2009 12:56:19 GMT
Author: skitching
Date: Wed Jun  3 12:56:18 2009
New Revision: 781355

URL: http://svn.apache.org/viewvc?rev=781355&view=rev
Log:
Cleanup only: avoid computing EL expressions multiple times, improve exception messages.

Modified:
    myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfig.java

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfig.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfig.java?rev=781355&r1=781354&r2=781355&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfig.java
(original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfig.java
Wed Jun  3 12:56:18 2009
@@ -39,6 +39,9 @@
  * to override the settings auto-detected by the Extractor. Each instance overrides the properties
  * of a single persistent field. The attribute "for" on this component should specify the
name
  * of the property to be overridden on the persistent object associated with the DynaForm.
+ * <p>
+ * This component can also have a single child component, in which case that is used as the
+ * component for rendering this dynamic field.
  */
 public class DynaConfig extends UIComponentBase
 {
@@ -156,8 +159,9 @@
     }
 
     /**
-     * Render this field by using the managed bean with the specified name,
-     * which must be a subtype of DynaFormComponentHandler.
+     * Specifies the "controller bean" used to render this specific field.
+     * <p>
+     * This should be the name of a managed bean which implements DynaFormComponentHandler.
      */
     public void setComponentHandler(String beanName)
     {
@@ -215,13 +219,16 @@
 
     public void configureMetaData(MetaFieldWritable field)
     {
-        if (getDisplaySize() != null)
+        Integer displaySize = getDisplaySize();
+        if (displaySize != null)
         {
-            field.setDisplaySize(getDisplaySize().intValue());
+            field.setDisplaySize(displaySize.intValue());
         }
-        if (getDisplayOnly() != null)
+
+        Boolean displayOnly = getDisplayOnly();
+        if (displayOnly != null)
         {
-            field.setDisplayOnly(getDisplayOnly());
+            field.setDisplayOnly(displayOnly);
         }
 
         // field is writable unless readonly is true.
@@ -231,29 +238,30 @@
         // fields are always readable
         field.setCanRead(true);
 
-        if (getDisabled() != null)
+        Boolean disabled = getDisabled();
+        if (disabled != null)
         {
-            field.setDisabled(getDisabled().booleanValue());
+            field.setDisabled(disabled.booleanValue());
         }
 
-        String ch = getComponentHandler();
-        if (ch != null)
+        String chName = getComponentHandler();
+        if (chName != null)
         {
-            Object componentHandlerBean = FrameworkAdapter.getCurrentInstance().getBean(ch);
+            Object componentHandlerBean = FrameworkAdapter.getCurrentInstance().getBean(chName);
             if (componentHandlerBean == null)
             {
                 throw new IllegalArgumentException(
-                    "no component handler with bean name " + ch + " found.");
+                    "No component handler with bean name [" + chName + "] found.");
             }
             if (!(componentHandlerBean instanceof DynaFormComponentHandler))
             {
                 throw new IllegalArgumentException(
-                    "component handler with bean name " + ch + 
-                    " doesn't implement the " + DynaFormComponentHandler.class.getName()
+ " interface.");
+                    "Managed bean with name [" + chName + 
+                    "] doesn't implement interface " + DynaFormComponentHandler.class.getName());
             }
 
             field.setComponentHandler((DynaFormComponentHandler) componentHandlerBean);
-       }
+        }
 
         if (getChildCount() > 0)
         {



Mime
View raw message