You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/03 23:35:00 UTC
svn commit: r673822 [4/7] - in /myfaces/orchestra/trunk:
examples/src/main/java/org/apache/myfaces/examples/annotations/
examples/src/main/java/org/apache/myfaces/examples/ballot/backings/
examples/src/main/java/org/apache/myfaces/examples/ballot/dao/ ...
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigTag.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigTag.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigTag.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigTag.java Thu Jul 3 14:34:56 2008
@@ -24,117 +24,117 @@
public class DynaConfigTag extends UIComponentBodyTagBase
{
- private String displaySize;
- private String forProperty;
- private String displayOnly;
- private String readOnly;
- private String disabled;
-
- public void release()
- {
- super.release();
-
- displaySize = null;
- forProperty = null;
- }
-
- protected void setProperties(UIComponent component)
- {
- super.setProperties(component);
- setIntegerProperty(component, "displaySize", displaySize);
- setStringProperty(component, "for", forProperty);
- setBooleanProperty(component, "displayOnly", displayOnly);
- setBooleanProperty(component, "readOnly", readOnly);
- setBooleanProperty(component, "disabled", disabled);
- }
-
- /**
- * @see DynaConfig#setDisplaySize(Integer)
- */
- public String getDisplaySize()
- {
- return displaySize;
- }
-
- /**
- * @see DynaConfig#setDisplaySize(Integer)
- */
- public void setDisplaySize(String size)
- {
- this.displaySize = size;
- }
-
- /**
- * @see DynaConfig#setFor(String)
- */
- public String getFor()
- {
- return forProperty;
- }
-
- /**
- * @see DynaConfig#setFor(String)
- */
- public void setFor(String forProperty)
- {
- this.forProperty = forProperty;
- }
-
- /**
- * @see DynaConfig#setDisplayOnly(Boolean)
- */
- public String getDisplayOnly()
- {
- return displayOnly;
- }
-
- /**
- * @see DynaConfig#setDisplayOnly(Boolean)
- */
- public void setDisplayOnly(String displayOnly)
- {
- this.displayOnly = displayOnly;
- }
-
- /**
- * @see DynaConfig#setDisabled(Boolean)
- */
- public String getDisabled()
- {
- return disabled;
- }
-
- /**
- * @see DynaConfig#setDisabled(Boolean)
- */
- public void setDisabled(String disabled)
- {
- this.disabled = disabled;
- }
-
- /**
- * @see DynaConfig#setReadOnly(Boolean)
- */
- public String getReadOnly()
- {
- return readOnly;
- }
-
- /**
- * @see DynaConfig#setReadOnly(Boolean)
- */
- public void setReadOnly(String readOnly)
- {
- this.readOnly = readOnly;
- }
-
- public String getComponentType()
- {
- return DynaConfig.COMPONENT_TYPE;
- }
-
- public String getRendererType()
- {
- return null;
- }
+ private String displaySize;
+ private String forProperty;
+ private String displayOnly;
+ private String readOnly;
+ private String disabled;
+
+ public void release()
+ {
+ super.release();
+
+ displaySize = null;
+ forProperty = null;
+ }
+
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setIntegerProperty(component, "displaySize", displaySize);
+ setStringProperty(component, "for", forProperty);
+ setBooleanProperty(component, "displayOnly", displayOnly);
+ setBooleanProperty(component, "readOnly", readOnly);
+ setBooleanProperty(component, "disabled", disabled);
+ }
+
+ /**
+ * @see DynaConfig#setDisplaySize(Integer)
+ */
+ public String getDisplaySize()
+ {
+ return displaySize;
+ }
+
+ /**
+ * @see DynaConfig#setDisplaySize(Integer)
+ */
+ public void setDisplaySize(String size)
+ {
+ this.displaySize = size;
+ }
+
+ /**
+ * @see DynaConfig#setFor(String)
+ */
+ public String getFor()
+ {
+ return forProperty;
+ }
+
+ /**
+ * @see DynaConfig#setFor(String)
+ */
+ public void setFor(String forProperty)
+ {
+ this.forProperty = forProperty;
+ }
+
+ /**
+ * @see DynaConfig#setDisplayOnly(Boolean)
+ */
+ public String getDisplayOnly()
+ {
+ return displayOnly;
+ }
+
+ /**
+ * @see DynaConfig#setDisplayOnly(Boolean)
+ */
+ public void setDisplayOnly(String displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ /**
+ * @see DynaConfig#setDisabled(Boolean)
+ */
+ public String getDisabled()
+ {
+ return disabled;
+ }
+
+ /**
+ * @see DynaConfig#setDisabled(Boolean)
+ */
+ public void setDisabled(String disabled)
+ {
+ this.disabled = disabled;
+ }
+
+ /**
+ * @see DynaConfig#setReadOnly(Boolean)
+ */
+ public String getReadOnly()
+ {
+ return readOnly;
+ }
+
+ /**
+ * @see DynaConfig#setReadOnly(Boolean)
+ */
+ public void setReadOnly(String readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ public String getComponentType()
+ {
+ return DynaConfig.COMPONENT_TYPE;
+ }
+
+ public String getRendererType()
+ {
+ return null;
+ }
}
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigs.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigs.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigs.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigs.java Thu Jul 3 14:34:56 2008
@@ -31,49 +31,49 @@
*/
public class DynaConfigs extends UIComponentBase
{
- public static final String COMPONENT_TYPE = "org.apache.myfaces.orchestra.dynaForm.DynaConfigs";
- public static final String COMPONENT_FAMILY = "org.apache.myfaces.orchestra.dynaForm.DynaForm";
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.orchestra.dynaForm.DynaConfigs";
+ public static final String COMPONENT_FAMILY = "org.apache.myfaces.orchestra.dynaForm.DynaForm";
- private transient Map<String, DynaConfig> configMap = null;
+ private transient Map<String, DynaConfig> configMap = null;
- @Override
- public String getFamily()
- {
- return COMPONENT_FAMILY;
- }
-
- public DynaConfig getConfig(String name)
- {
- Map<String, DynaConfig> configMap = getConfigMap();
- return configMap.get(name);
- }
-
- protected Map<String, DynaConfig> getConfigMap()
- {
- if (configMap != null)
- {
- return configMap;
- }
- configMap = new LinkedHashMap<String, DynaConfig>();
-
- for (Object child : getChildren())
- {
- if (child instanceof DynaConfig)
- {
- DynaConfig dynaConfig = (DynaConfig) child;
- if (configMap.containsKey(dynaConfig.getFor()))
- {
- throw new IllegalStateException("duplicate config for property '" + dynaConfig.getFor() + "'");
- }
- configMap.put(dynaConfig.getFor(), dynaConfig);
- }
- }
-
- return configMap;
- }
-
- public Iterator<DynaConfig> iterator()
- {
- return getConfigMap().values().iterator();
- }
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ public DynaConfig getConfig(String name)
+ {
+ Map<String, DynaConfig> configMap = getConfigMap();
+ return configMap.get(name);
+ }
+
+ protected Map<String, DynaConfig> getConfigMap()
+ {
+ if (configMap != null)
+ {
+ return configMap;
+ }
+ configMap = new LinkedHashMap<String, DynaConfig>();
+
+ for (Object child : getChildren())
+ {
+ if (child instanceof DynaConfig)
+ {
+ DynaConfig dynaConfig = (DynaConfig) child;
+ if (configMap.containsKey(dynaConfig.getFor()))
+ {
+ throw new IllegalStateException("duplicate config for property '" + dynaConfig.getFor() + "'");
+ }
+ configMap.put(dynaConfig.getFor(), dynaConfig);
+ }
+ }
+
+ return configMap;
+ }
+
+ public Iterator<DynaConfig> iterator()
+ {
+ return getConfigMap().values().iterator();
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigsTag.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigsTag.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigsTag.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaConfigsTag.java Thu Jul 3 14:34:56 2008
@@ -22,18 +22,18 @@
public class DynaConfigsTag extends UIComponentBodyTagBase
{
- public void release()
- {
- super.release();
- }
+ public void release()
+ {
+ super.release();
+ }
- public String getComponentType()
- {
- return DynaConfigs.COMPONENT_TYPE;
- }
+ public String getComponentType()
+ {
+ return DynaConfigs.COMPONENT_TYPE;
+ }
- public String getRendererType()
- {
- return null;
- }
+ public String getRendererType()
+ {
+ return null;
+ }
}
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaForm.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaForm.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaForm.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaForm.java Thu Jul 3 14:34:56 2008
@@ -79,253 +79,253 @@
*/
public class DynaForm extends UIComponentBase
{
- public static final String COMPONENT_TYPE = "org.apache.myfaces.orchestra.dynaForm.DynaForm";
- public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.orchestra.dynaForm.DynaForm";
- public static final String COMPONENT_FAMILY = "org.apache.myfaces.orchestra.dynaForm.DynaForm";
-
- public static final String DYNA_FORM_CREATED = "org.apache.myfaces.dynaForm.CREATED";
- public static final String DYNA_FORM_URI = "org.apache.myfaces.dynaForm.URI";
-
- private String uri;
- private String bundle;
- private String valueBindingPrefix;
- private Boolean displayOnly;
- private Boolean exclusiveFields;
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.orchestra.dynaForm.DynaForm";
+ public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.orchestra.dynaForm.DynaForm";
+ public static final String COMPONENT_FAMILY = "org.apache.myfaces.orchestra.dynaForm.DynaForm";
+
+ public static final String DYNA_FORM_CREATED = "org.apache.myfaces.dynaForm.CREATED";
+ public static final String DYNA_FORM_URI = "org.apache.myfaces.dynaForm.URI";
+
+ private String uri;
+ private String bundle;
+ private String valueBindingPrefix;
+ private Boolean displayOnly;
+ private Boolean exclusiveFields;
private Boolean idAsDisplayOnly;
// TODO: why is this property marked with a JPA Transient annotation?
@Transient
- private transient UriResolver.Configuration configuration = null;
- @Transient
- private transient DynaConfigs formConfigs = null;
- @Transient
- private transient ELContext elcontext;
-
- /**
- * Create a UIColumn component to wrap a (label, value) pair of JSF components
- * that represent a single persistent property. This class is used when the
- * DynaForm is generating a "row per object" layout for a list of persistent
- * objects.
- * <p>
- * TODO: before writing out the component, look for an existing component with that
- * fieldname inside the parent. If it exists, then just skip the component creation.
- * This allows the user to do custom layout for some of the fields. This might also
- * make the @UIComponent annotation obsolete.
- */
- private final class AddComponentToTable implements NewComponentListener
- {
- private final UIComponent destCmp;
-
- private AddComponentToTable(UIComponent component)
- {
- super();
- this.destCmp = component;
- }
-
- // TODO: fieldName is an unused parameter
- @SuppressWarnings("unchecked")
- public void newComponent(String fieldName, UIComponent label, UIComponent component)
- {
- UIColumn column = new UIColumn();
- column.getChildren().add(component);
- column.setHeader(label);
- column.getAttributes().put(DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
-
- _FacesUtils.copyRendered(component, column);
-
- this.destCmp.getChildren().add(column);
- }
-
- public boolean containsComponent(String id)
- {
- return this.destCmp.findComponent(id) != null;
- }
-
- public UIComponent findComponent(String id)
- {
- return this.destCmp.findComponent(id);
- }
- }
-
- /**
- * Simply attach a (label, value) pair of JSF components that represent a
- * single persistent property.
- * <p>
- * This class is used when the DynaForm is generating a plain "form style"
- * layout for a single persistent object.
- */
- protected static class AddComponentSimple implements NewComponentListener
- {
- private final UIComponent destCmp;
-
- protected AddComponentSimple(UIComponent component)
- {
- super();
- this.destCmp = component;
- }
-
- @SuppressWarnings("unchecked")
- public void newComponent(String fieldName, UIComponent label, UIComponent component)
- {
- _FacesUtils.copyRendered(component, label);
-
- this.destCmp.getChildren().add(label);
- this.destCmp.getChildren().add(component);
- }
-
- public boolean containsComponent(String id)
- {
- return this.destCmp.findComponent(id) != null;
- }
-
- public UIComponent findComponent(String id)
- {
- return this.destCmp.findComponent(id);
- }
- }
-
- public DynaForm()
- {
- super();
- }
-
- @Override
- public String getFamily()
- {
- return COMPONENT_FAMILY;
- }
-
- /**
- * @see #setUri
- */
- public String getUri()
- {
- if (uri != null)
- {
- return uri;
- }
- ValueBinding vb = getValueBinding("uri");
- return vb != null ? (String) vb.getValue(getFacesContext()) : null;
- }
-
- /**
- * Specifies how to obtain the metadata for the value object.
- * <p>
- * This is a string of form "inspector:classname". The inspector part ndicates
- * which of the configured Extractor implementations should be used to obtain the
- * metadata for this class. The classname is of course the concrete class of the
- * specified object.
- * <p>
- * For example, "ejb:fqn.to.model.Entity" means use the EJB3-based extractor
- * implementation to obtain metadata about the given entity
- * <p>
- * TODO: why can't value.getClass() be used for the classname part of the uri?
- * Maybe because the value EL expression can map to a null property when creating
- * a new instance?
- * <p>
- *
- * @see org.apache.myfaces.orchestra.dynaForm.uri.UriResolver
- */
- public void setUri(String uri)
- {
- this.uri = uri;
- }
-
- /**
- * @see #setValueBindingPrefix
- */
- public String getValueBindingPrefix()
- {
- if (valueBindingPrefix != null)
- {
- return valueBindingPrefix;
- }
- ValueBinding vb = getValueBinding("valueBindingPrefix");
- return vb != null ? (String) vb.getValue(getFacesContext()) : null;
- }
-
- /**
- * Specify how to get and set the model value for each persistent property
- * of the value object.
- * <p>
- * When the JSF components that correspond to the individual persistent
- * properties of the value object are created, they need EL expressions to
- * tell them how to access the corresponding model value.
- * <p>
- * The EL expression used for each created component is of form
- * <code>#{valueBindingPrefix.propname}</code>.
- * <p>
- * Of course valueBindingPrefix will normally refer to the same object
- * that the "value" property refers to. In fact, there probably isn't any
- * other sane value for this property.
- * <p>
- * TODO: Can we get rid of this attribute? Either call
- * <code>getValueBinding().getExpressionString()</code> or create a special
- * ValueBinding subclass that takes a "base object" parameter which we can
- * point at the result of evaluating the main value expression.
- */
- public void setValueBindingPrefix(String valueBindingPrefix)
- {
- this.valueBindingPrefix = valueBindingPrefix;
- }
-
- /**
- * @see #setBundle
- */
- public String getBundle()
- {
- if (bundle != null)
- {
- return bundle;
- }
- ValueBinding vb = getValueBinding("bundle");
- return vb != null ? (String) vb.getValue(getFacesContext()) : null;
- }
-
- /**
- * The bundle to use to convert property names to localised label strings.
- * <p>
- * For each persistent property on the value object, a pair of components
- * (label and value) are created. The label text is computed by using the
- * persistent property name as a key into the specified bundle.
- * <p>
- * This must be the name of a managed bean that implements Map.
- */
- public void setBundle(String bundle)
- {
- this.bundle = bundle;
- }
-
- /**
- * Display the whole form in read only mode, ie all the JSF components
- * generated to display persistent properties are "read only".
- */
- public void setDisplayOnly(boolean displayOnly)
- {
- this.displayOnly = displayOnly;
- }
-
- /**
- * @see #setDisplayOnly(boolean)
- */
- public boolean isDisplayOnly()
- {
- if (displayOnly != null)
- {
- return displayOnly.booleanValue();
- }
- ValueBinding vb = getValueBinding("displayOnly");
- if (vb != null)
- {
- Boolean ret = (Boolean) vb.getValue(getFacesContext());
- if (ret != null)
- {
- return ret.booleanValue();
- }
- }
+ private transient UriResolver.Configuration configuration = null;
+ @Transient
+ private transient DynaConfigs formConfigs = null;
+ @Transient
+ private transient ELContext elcontext;
+
+ /**
+ * Create a UIColumn component to wrap a (label, value) pair of JSF components
+ * that represent a single persistent property. This class is used when the
+ * DynaForm is generating a "row per object" layout for a list of persistent
+ * objects.
+ * <p>
+ * TODO: before writing out the component, look for an existing component with that
+ * fieldname inside the parent. If it exists, then just skip the component creation.
+ * This allows the user to do custom layout for some of the fields. This might also
+ * make the @UIComponent annotation obsolete.
+ */
+ private final class AddComponentToTable implements NewComponentListener
+ {
+ private final UIComponent destCmp;
+
+ private AddComponentToTable(UIComponent component)
+ {
+ super();
+ this.destCmp = component;
+ }
- return false;
- }
+ // TODO: fieldName is an unused parameter
+ @SuppressWarnings("unchecked")
+ public void newComponent(String fieldName, UIComponent label, UIComponent component)
+ {
+ UIColumn column = new UIColumn();
+ column.getChildren().add(component);
+ column.setHeader(label);
+ column.getAttributes().put(DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
+
+ _FacesUtils.copyRendered(component, column);
+
+ this.destCmp.getChildren().add(column);
+ }
+
+ public boolean containsComponent(String id)
+ {
+ return this.destCmp.findComponent(id) != null;
+ }
+
+ public UIComponent findComponent(String id)
+ {
+ return this.destCmp.findComponent(id);
+ }
+ }
+
+ /**
+ * Simply attach a (label, value) pair of JSF components that represent a
+ * single persistent property.
+ * <p>
+ * This class is used when the DynaForm is generating a plain "form style"
+ * layout for a single persistent object.
+ */
+ protected static class AddComponentSimple implements NewComponentListener
+ {
+ private final UIComponent destCmp;
+
+ protected AddComponentSimple(UIComponent component)
+ {
+ super();
+ this.destCmp = component;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void newComponent(String fieldName, UIComponent label, UIComponent component)
+ {
+ _FacesUtils.copyRendered(component, label);
+
+ this.destCmp.getChildren().add(label);
+ this.destCmp.getChildren().add(component);
+ }
+
+ public boolean containsComponent(String id)
+ {
+ return this.destCmp.findComponent(id) != null;
+ }
+
+ public UIComponent findComponent(String id)
+ {
+ return this.destCmp.findComponent(id);
+ }
+ }
+
+ public DynaForm()
+ {
+ super();
+ }
+
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ /**
+ * @see #setUri
+ */
+ public String getUri()
+ {
+ if (uri != null)
+ {
+ return uri;
+ }
+ ValueBinding vb = getValueBinding("uri");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * Specifies how to obtain the metadata for the value object.
+ * <p>
+ * This is a string of form "inspector:classname". The inspector part ndicates
+ * which of the configured Extractor implementations should be used to obtain the
+ * metadata for this class. The classname is of course the concrete class of the
+ * specified object.
+ * <p>
+ * For example, "ejb:fqn.to.model.Entity" means use the EJB3-based extractor
+ * implementation to obtain metadata about the given entity
+ * <p>
+ * TODO: why can't value.getClass() be used for the classname part of the uri?
+ * Maybe because the value EL expression can map to a null property when creating
+ * a new instance?
+ * <p>
+ *
+ * @see org.apache.myfaces.orchestra.dynaForm.uri.UriResolver
+ */
+ public void setUri(String uri)
+ {
+ this.uri = uri;
+ }
+
+ /**
+ * @see #setValueBindingPrefix
+ */
+ public String getValueBindingPrefix()
+ {
+ if (valueBindingPrefix != null)
+ {
+ return valueBindingPrefix;
+ }
+ ValueBinding vb = getValueBinding("valueBindingPrefix");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * Specify how to get and set the model value for each persistent property
+ * of the value object.
+ * <p>
+ * When the JSF components that correspond to the individual persistent
+ * properties of the value object are created, they need EL expressions to
+ * tell them how to access the corresponding model value.
+ * <p>
+ * The EL expression used for each created component is of form
+ * <code>#{valueBindingPrefix.propname}</code>.
+ * <p>
+ * Of course valueBindingPrefix will normally refer to the same object
+ * that the "value" property refers to. In fact, there probably isn't any
+ * other sane value for this property.
+ * <p>
+ * TODO: Can we get rid of this attribute? Either call
+ * <code>getValueBinding().getExpressionString()</code> or create a special
+ * ValueBinding subclass that takes a "base object" parameter which we can
+ * point at the result of evaluating the main value expression.
+ */
+ public void setValueBindingPrefix(String valueBindingPrefix)
+ {
+ this.valueBindingPrefix = valueBindingPrefix;
+ }
+
+ /**
+ * @see #setBundle
+ */
+ public String getBundle()
+ {
+ if (bundle != null)
+ {
+ return bundle;
+ }
+ ValueBinding vb = getValueBinding("bundle");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * The bundle to use to convert property names to localised label strings.
+ * <p>
+ * For each persistent property on the value object, a pair of components
+ * (label and value) are created. The label text is computed by using the
+ * persistent property name as a key into the specified bundle.
+ * <p>
+ * This must be the name of a managed bean that implements Map.
+ */
+ public void setBundle(String bundle)
+ {
+ this.bundle = bundle;
+ }
+
+ /**
+ * Display the whole form in read only mode, ie all the JSF components
+ * generated to display persistent properties are "read only".
+ */
+ public void setDisplayOnly(boolean displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ /**
+ * @see #setDisplayOnly(boolean)
+ */
+ public boolean isDisplayOnly()
+ {
+ if (displayOnly != null)
+ {
+ return displayOnly.booleanValue();
+ }
+ ValueBinding vb = getValueBinding("displayOnly");
+ if (vb != null)
+ {
+ Boolean ret = (Boolean) vb.getValue(getFacesContext());
+ if (ret != null)
+ {
+ return ret.booleanValue();
+ }
+ }
+
+ return false;
+ }
/**
* Display id fields (ie the key fields of the persistent object) in the form
@@ -366,411 +366,411 @@
}
/**
- * Process only fields listed by their facets
- * <p>
- * TODO: document this properly. What does this do exactly??
- */
- public void setExclusiveFields(boolean exclusiveFields)
- {
- this.exclusiveFields = exclusiveFields;
- }
-
- /**
- * @see #setExclusiveFields(boolean)
- */
- public boolean isExclusiveFields()
- {
- if (exclusiveFields != null)
- {
- return exclusiveFields.booleanValue();
- }
- ValueBinding vb = getValueBinding("exclusiveFields");
- if (vb != null)
- {
- Boolean ret = (Boolean) vb.getValue(getFacesContext());
- if (ret != null)
- {
- return ret.booleanValue();
- }
- }
-
- return false;
- }
-
- @Override
- public void restoreState(FacesContext context, Object stateArray)
- {
- Object[] states = (Object[]) stateArray;
- super.restoreState(context, states[0]);
- uri = (String) states[1];
- // var = (String) states[2];
- displayOnly = (Boolean) states[2];
- bundle = (String) states[3];
- valueBindingPrefix = (String) states[4];
+ * Process only fields listed by their facets
+ * <p>
+ * TODO: document this properly. What does this do exactly??
+ */
+ public void setExclusiveFields(boolean exclusiveFields)
+ {
+ this.exclusiveFields = exclusiveFields;
+ }
+
+ /**
+ * @see #setExclusiveFields(boolean)
+ */
+ public boolean isExclusiveFields()
+ {
+ if (exclusiveFields != null)
+ {
+ return exclusiveFields.booleanValue();
+ }
+ ValueBinding vb = getValueBinding("exclusiveFields");
+ if (vb != null)
+ {
+ Boolean ret = (Boolean) vb.getValue(getFacesContext());
+ if (ret != null)
+ {
+ return ret.booleanValue();
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object stateArray)
+ {
+ Object[] states = (Object[]) stateArray;
+ super.restoreState(context, states[0]);
+ uri = (String) states[1];
+ // var = (String) states[2];
+ displayOnly = (Boolean) states[2];
+ bundle = (String) states[3];
+ valueBindingPrefix = (String) states[4];
idAsDisplayOnly = (Boolean) states[5];
- exclusiveFields = (Boolean) states[6];
- }
+ exclusiveFields = (Boolean) states[6];
+ }
- @Override
- public Object saveState(FacesContext context)
- {
- return new Object[]
- {
- super.saveState(context),
- uri,
- // var,
- displayOnly,
- bundle,
- valueBindingPrefix,
+ @Override
+ public Object saveState(FacesContext context)
+ {
+ return new Object[]
+ {
+ super.saveState(context),
+ uri,
+ // var,
+ displayOnly,
+ bundle,
+ valueBindingPrefix,
idAsDisplayOnly,
- exclusiveFields
- };
- }
-
- /**
- * Get the overall configuration based on the current value of the uri property.
- * <p>
- * This returns an object that simply pairs an Extractor object with the remaining
- * part of the URI. The Extractor instance selected is specified by the "protocol"
- * part of the URI.
- *
- * @see org.apache.myfaces.orchestra.dynaForm.uri.UriResolver
- */
- protected UriResolver.Configuration getConfiguration()
- {
- if (configuration == null)
- {
- configuration = new FacesUriResolver().resolveUri(getUri());
- }
- return configuration;
- }
-
- public Extractor getExtractor()
- {
- return getConfiguration().getExtractor();
- }
-
- /**
- * try to find a parent dyna form+
- */
- protected DynaForm findParentDynaForm(DynaForm start)
- {
- UIComponent component = start.getParent();
- while (component != null)
- {
- if (component instanceof DynaForm)
- {
- return (DynaForm) component;
- }
- component = component.getParent();
- }
-
- return null;
- }
-
- /**
- * Find the dynaForm component
- */
- public static DynaForm getDynaForm(UIComponent component)
- {
- if (component == null)
- {
- throw new IllegalArgumentException("component==null not allowed");
- }
-
- UIComponent dynaFormComponent = component;
- while (dynaFormComponent != null && (!(dynaFormComponent instanceof DynaForm)))
- {
- dynaFormComponent = dynaFormComponent.getParent();
- }
- if (dynaFormComponent == null)
- {
- throw new IllegalArgumentException("component with id '" + component.getId() + "' not contained in an dynaForm");
- }
-
- return (DynaForm) dynaFormComponent;
- }
-
- /**
- * get access to the special form configurations
- */
- public DynaConfigs getFormConfigs()
- {
- if (formConfigs != null)
- {
- return formConfigs;
- }
-
- for (Object obj : getChildren())
- {
- if (obj instanceof DynaConfigs)
- {
- formConfigs = (DynaConfigs) obj;
- return formConfigs;
- }
- }
-
- return null;
- }
-
- /**
- * Note that this method should only be called when _FacesUtils.useValueExpression is true.
- * <p>
- * This is needed when using either JSF1.2 or (JSF1.1 + facelets).
- * <p>
- * It is still not clear why we need this anyway; instead of storing a context for later
- * use, why not just use the context available at the time an expression must be evaluated?
- */
- public ELContext getELContext()
- {
- return elcontext;
- }
-
- public void setELContext(ELContext elcontext)
- {
- this.elcontext = elcontext;
- }
-
- @Override
- public boolean isRendered()
- {
- // ensure we are not treated as a rendering component
- return false;
- }
-
- /**
- * Dynamically compute and add child components to the current tree.
- * <p>
- * This method is required to be invoked from the TagHandler when an instance of
- * this component is created. Components are created based upon the class specified
- * by the "uri" property, and added as children of the parent component of this component.
- * <p>
- * This component itself never has any components, and never generates any output
- * into the response stream.
- * <p>
- * It would be much nicer if this component could be the parent of the components it
- * dynamically creates, but that doesn't work well with an h:panelGrid or h:dataTable
- * component as the parent; a panelGrid counts its children while a dataTable counts
- * its UIColumn children. To make things work, the created components must therefore
- * be direct children of the parent. Note that this component is also a child of the
- * parent, but because it marks itself as rendered=false it does not affect the
- * behaviour of parent components that count their (rendered) children.
- * <p>
- * Note also that although this method is capable of deleting previously-created
- * components and creating a new set, at the moment this method is only invoked
- * by the taghandler when this component is created. That means that the "uri"
- * parameter is only used on first access to the view, and is ignored thereafter.
- */
- @SuppressWarnings("unchecked")
- public void initView(FacesContext context)
- {
- UIComponent layoutComponent = getParent();
- ViewType viewType = getViewType(layoutComponent);
-
- // check if the uri has changed since the last rendering. This can happen
- // if the uri points to a value-binding
- String previousUri = (String) getAttributes().get(DynaForm.DYNA_FORM_URI);
- if (previousUri != null && !previousUri.equals(getUri()))
- {
- removeDynaFormCreatedComponents(layoutComponent);
- }
-
- // create & add components
- // boolean needAdd = processPreviouslyAdded(context, layoutComponent);
- // if (needAdd)
- {
- getAttributes().put(DynaForm.DYNA_FORM_URI, getUri());
- addComponents(context, this, layoutComponent, viewType);
- }
- }
-
- public void removeDynaFormCreatedComponents(UIComponent base)
- {
- @SuppressWarnings("unchecked")
- List<UIComponent> children = base.getChildren();
- if (children == null || children.size() < 1 )
- {
- return;
- }
-
- Iterator<UIComponent> iterChildren = children.iterator();
- while (iterChildren.hasNext())
- {
- UIComponent component = (UIComponent) iterChildren.next();
-
- if (Boolean.TRUE.equals(component.getAttributes().get(DynaForm.DYNA_FORM_CREATED)))
- {
- iterChildren.remove();
- }
- else
- {
- removeDynaFormCreatedComponents(component);
- }
- }
- }
-
- /**
- * determine the current view type
- * <ul>
- * <li>"list" means: the layout component "is a" or "is embedded in an" list component (UIData)</li>
- * <li>"form" means: anything else</li>
- * </ul>
- */
- protected ViewType getViewType(UIComponent startComponent)
- {
- UIComponent component = startComponent;
- while (component != null && !(component instanceof DynaForm))
- {
- if (isTable(component))
- {
- return ViewType.LIST;
- }
-
- component = component.getParent();
- }
-
- return ViewType.FORM;
- }
-
- /**
- * create and add the components to the layout component.
- *
- * TODO: clean this method up. It still had artefacts from when this code was in a separate
- * Renderer class.
- */
- protected void addComponents(final FacesContext context,
- final DynaForm dynaForm, final UIComponent layoutComponent,
- final ViewType viewType)
- {
- MetaData metaData = extractMetaData(dynaForm);
-
- Slipstream slipstream = new Slipstream();
- slipstream.setDynaForm(this);
- slipstream.setModelMetaData(metaData);
-
- if (dynaForm.getBundle() != null)
- {
- // get the bundle and attach it
- ValueBinding vb = context.getApplication().createValueBinding("#{" + dynaForm.getBundle() + "}");
- @SuppressWarnings("unchecked")
- Map<String, String> bundleMap = (Map<String, String>) vb.getValue(context);
- slipstream.setLabelBundle(bundleMap);
- }
-
- JsfGuiBuilder guiBuilder = createGuiBuilder(context);
-
- guiBuilder.setELContext(dynaForm.getELContext());
- guiBuilder.setContext(context);
-
- if (isTable(layoutComponent))
- {
- guiBuilder.setNewComponentListener(new AddComponentToTable(layoutComponent));
- }
- else
- {
- guiBuilder.setNewComponentListener(new AddComponentSimple(layoutComponent));
- }
-
- String valueBindingPrefix = getValueBindingPrefix(dynaForm, layoutComponent);
- if (valueBindingPrefix == null)
- {
- throw new UnsupportedOperationException("can't determine the value binding prefix");
- }
- guiBuilder.setBackingEntityPrefix(valueBindingPrefix);
-
- slipstream.setGuiBuilder(guiBuilder);
- slipstream.process();
- }
-
- private boolean isTable(UIComponent layoutComponent)
- {
- return layoutComponent instanceof UIData || UIData.COMPONENT_FAMILY.equals(layoutComponent.getFamily());
- }
-
- protected String getValueBindingPrefix(DynaForm dynaForm, UIComponent layoutComponent)
- {
- String valueBindingPrefix = dynaForm.getValueBindingPrefix();
- if (valueBindingPrefix == null)
- {
- valueBindingPrefix = (String) layoutComponent.getAttributes().get("var");
- }
-
- return valueBindingPrefix;
- }
-
- private MetaData extractMetaData(final DynaForm dynaForm)
- {
- MetaDataImpl metaData = new MetaDataImpl();
-
- try
- {
- // lookup which fields to process
- new JsfRequestFieldExtractor().getMetaData(metaData, dynaForm);
-
- if (dynaForm.isExclusiveFields())
- {
- // the same as above, but keep their ordering and some additional metadata
- new JsfExclusiveExtractor().getMetaData(metaData, dynaForm);
- metaData.setLockFields(true);
- }
-
- // use the users extractor
- dynaForm.getExtractor().getMetaData(metaData, dynaForm.getConfiguration().getEntity());
-
- // processs the jsf stuff
- new JsfExtractor().getMetaData(metaData, dynaForm);
-
- }
- finally
- {
- metaData.setLockFields(false);
- }
-
- return metaData;
- }
-
- protected JsfGuiBuilder createGuiBuilder(final FacesContext facesContext)
- {
- return JsfGuiBuilderFactory.create(facesContext);
- }
-
- /**
- * check if we already added components to the layout component.<br />
- * <p/>
- * if this is the case then:
- * <ul>
- * <li>keep them cached and avoid readd</li>
- * <li><strike>in development mode: remove the components</strike></li>
- * <li><strike>in production mode: keep them cached</strike></li>
- * </ul>
- * <p/>
- * TODO: need to figure out whats the best way to recreate the components
- *
- * @return true if we have to add our components again
- */
- protected boolean processPreviouslyAdded(FacesContext context,
- UIComponent root)
- {
- @SuppressWarnings("unchecked")
- List<UIComponent> rootComponentChildren = root.getChildren();
- if (rootComponentChildren != null)
- {
- for (Object component : rootComponentChildren)
- {
- UIComponent child = (UIComponent) component;
- if (Boolean.TRUE.equals(child.getAttributes().get(
- DynaForm.DYNA_FORM_CREATED)))
- {
- return false;
- }
-
- if (!processPreviouslyAdded(context, child))
- {
- return false;
- }
- }
- }
+ exclusiveFields
+ };
+ }
+
+ /**
+ * Get the overall configuration based on the current value of the uri property.
+ * <p>
+ * This returns an object that simply pairs an Extractor object with the remaining
+ * part of the URI. The Extractor instance selected is specified by the "protocol"
+ * part of the URI.
+ *
+ * @see org.apache.myfaces.orchestra.dynaForm.uri.UriResolver
+ */
+ protected UriResolver.Configuration getConfiguration()
+ {
+ if (configuration == null)
+ {
+ configuration = new FacesUriResolver().resolveUri(getUri());
+ }
+ return configuration;
+ }
- return true;
- }
+ public Extractor getExtractor()
+ {
+ return getConfiguration().getExtractor();
+ }
+
+ /**
+ * try to find a parent dyna form+
+ */
+ protected DynaForm findParentDynaForm(DynaForm start)
+ {
+ UIComponent component = start.getParent();
+ while (component != null)
+ {
+ if (component instanceof DynaForm)
+ {
+ return (DynaForm) component;
+ }
+ component = component.getParent();
+ }
+
+ return null;
+ }
+
+ /**
+ * Find the dynaForm component
+ */
+ public static DynaForm getDynaForm(UIComponent component)
+ {
+ if (component == null)
+ {
+ throw new IllegalArgumentException("component==null not allowed");
+ }
+
+ UIComponent dynaFormComponent = component;
+ while (dynaFormComponent != null && (!(dynaFormComponent instanceof DynaForm)))
+ {
+ dynaFormComponent = dynaFormComponent.getParent();
+ }
+ if (dynaFormComponent == null)
+ {
+ throw new IllegalArgumentException("component with id '" + component.getId() + "' not contained in an dynaForm");
+ }
+
+ return (DynaForm) dynaFormComponent;
+ }
+
+ /**
+ * get access to the special form configurations
+ */
+ public DynaConfigs getFormConfigs()
+ {
+ if (formConfigs != null)
+ {
+ return formConfigs;
+ }
+
+ for (Object obj : getChildren())
+ {
+ if (obj instanceof DynaConfigs)
+ {
+ formConfigs = (DynaConfigs) obj;
+ return formConfigs;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Note that this method should only be called when _FacesUtils.useValueExpression is true.
+ * <p>
+ * This is needed when using either JSF1.2 or (JSF1.1 + facelets).
+ * <p>
+ * It is still not clear why we need this anyway; instead of storing a context for later
+ * use, why not just use the context available at the time an expression must be evaluated?
+ */
+ public ELContext getELContext()
+ {
+ return elcontext;
+ }
+
+ public void setELContext(ELContext elcontext)
+ {
+ this.elcontext = elcontext;
+ }
+
+ @Override
+ public boolean isRendered()
+ {
+ // ensure we are not treated as a rendering component
+ return false;
+ }
+
+ /**
+ * Dynamically compute and add child components to the current tree.
+ * <p>
+ * This method is required to be invoked from the TagHandler when an instance of
+ * this component is created. Components are created based upon the class specified
+ * by the "uri" property, and added as children of the parent component of this component.
+ * <p>
+ * This component itself never has any components, and never generates any output
+ * into the response stream.
+ * <p>
+ * It would be much nicer if this component could be the parent of the components it
+ * dynamically creates, but that doesn't work well with an h:panelGrid or h:dataTable
+ * component as the parent; a panelGrid counts its children while a dataTable counts
+ * its UIColumn children. To make things work, the created components must therefore
+ * be direct children of the parent. Note that this component is also a child of the
+ * parent, but because it marks itself as rendered=false it does not affect the
+ * behaviour of parent components that count their (rendered) children.
+ * <p>
+ * Note also that although this method is capable of deleting previously-created
+ * components and creating a new set, at the moment this method is only invoked
+ * by the taghandler when this component is created. That means that the "uri"
+ * parameter is only used on first access to the view, and is ignored thereafter.
+ */
+ @SuppressWarnings("unchecked")
+ public void initView(FacesContext context)
+ {
+ UIComponent layoutComponent = getParent();
+ ViewType viewType = getViewType(layoutComponent);
+
+ // check if the uri has changed since the last rendering. This can happen
+ // if the uri points to a value-binding
+ String previousUri = (String) getAttributes().get(DynaForm.DYNA_FORM_URI);
+ if (previousUri != null && !previousUri.equals(getUri()))
+ {
+ removeDynaFormCreatedComponents(layoutComponent);
+ }
+
+ // create & add components
+ // boolean needAdd = processPreviouslyAdded(context, layoutComponent);
+ // if (needAdd)
+ {
+ getAttributes().put(DynaForm.DYNA_FORM_URI, getUri());
+ addComponents(context, this, layoutComponent, viewType);
+ }
+ }
+
+ public void removeDynaFormCreatedComponents(UIComponent base)
+ {
+ @SuppressWarnings("unchecked")
+ List<UIComponent> children = base.getChildren();
+ if (children == null || children.size() < 1 )
+ {
+ return;
+ }
+
+ Iterator<UIComponent> iterChildren = children.iterator();
+ while (iterChildren.hasNext())
+ {
+ UIComponent component = (UIComponent) iterChildren.next();
+
+ if (Boolean.TRUE.equals(component.getAttributes().get(DynaForm.DYNA_FORM_CREATED)))
+ {
+ iterChildren.remove();
+ }
+ else
+ {
+ removeDynaFormCreatedComponents(component);
+ }
+ }
+ }
+
+ /**
+ * determine the current view type
+ * <ul>
+ * <li>"list" means: the layout component "is a" or "is embedded in an" list component (UIData)</li>
+ * <li>"form" means: anything else</li>
+ * </ul>
+ */
+ protected ViewType getViewType(UIComponent startComponent)
+ {
+ UIComponent component = startComponent;
+ while (component != null && !(component instanceof DynaForm))
+ {
+ if (isTable(component))
+ {
+ return ViewType.LIST;
+ }
+
+ component = component.getParent();
+ }
+
+ return ViewType.FORM;
+ }
+
+ /**
+ * create and add the components to the layout component.
+ *
+ * TODO: clean this method up. It still had artefacts from when this code was in a separate
+ * Renderer class.
+ */
+ protected void addComponents(final FacesContext context,
+ final DynaForm dynaForm, final UIComponent layoutComponent,
+ final ViewType viewType)
+ {
+ MetaData metaData = extractMetaData(dynaForm);
+
+ Slipstream slipstream = new Slipstream();
+ slipstream.setDynaForm(this);
+ slipstream.setModelMetaData(metaData);
+
+ if (dynaForm.getBundle() != null)
+ {
+ // get the bundle and attach it
+ ValueBinding vb = context.getApplication().createValueBinding("#{" + dynaForm.getBundle() + "}");
+ @SuppressWarnings("unchecked")
+ Map<String, String> bundleMap = (Map<String, String>) vb.getValue(context);
+ slipstream.setLabelBundle(bundleMap);
+ }
+
+ JsfGuiBuilder guiBuilder = createGuiBuilder(context);
+
+ guiBuilder.setELContext(dynaForm.getELContext());
+ guiBuilder.setContext(context);
+
+ if (isTable(layoutComponent))
+ {
+ guiBuilder.setNewComponentListener(new AddComponentToTable(layoutComponent));
+ }
+ else
+ {
+ guiBuilder.setNewComponentListener(new AddComponentSimple(layoutComponent));
+ }
+
+ String valueBindingPrefix = getValueBindingPrefix(dynaForm, layoutComponent);
+ if (valueBindingPrefix == null)
+ {
+ throw new UnsupportedOperationException("can't determine the value binding prefix");
+ }
+ guiBuilder.setBackingEntityPrefix(valueBindingPrefix);
+
+ slipstream.setGuiBuilder(guiBuilder);
+ slipstream.process();
+ }
+
+ private boolean isTable(UIComponent layoutComponent)
+ {
+ return layoutComponent instanceof UIData || UIData.COMPONENT_FAMILY.equals(layoutComponent.getFamily());
+ }
+
+ protected String getValueBindingPrefix(DynaForm dynaForm, UIComponent layoutComponent)
+ {
+ String valueBindingPrefix = dynaForm.getValueBindingPrefix();
+ if (valueBindingPrefix == null)
+ {
+ valueBindingPrefix = (String) layoutComponent.getAttributes().get("var");
+ }
+
+ return valueBindingPrefix;
+ }
+
+ private MetaData extractMetaData(final DynaForm dynaForm)
+ {
+ MetaDataImpl metaData = new MetaDataImpl();
+
+ try
+ {
+ // lookup which fields to process
+ new JsfRequestFieldExtractor().getMetaData(metaData, dynaForm);
+
+ if (dynaForm.isExclusiveFields())
+ {
+ // the same as above, but keep their ordering and some additional metadata
+ new JsfExclusiveExtractor().getMetaData(metaData, dynaForm);
+ metaData.setLockFields(true);
+ }
+
+ // use the users extractor
+ dynaForm.getExtractor().getMetaData(metaData, dynaForm.getConfiguration().getEntity());
+
+ // processs the jsf stuff
+ new JsfExtractor().getMetaData(metaData, dynaForm);
+
+ }
+ finally
+ {
+ metaData.setLockFields(false);
+ }
+
+ return metaData;
+ }
+
+ protected JsfGuiBuilder createGuiBuilder(final FacesContext facesContext)
+ {
+ return JsfGuiBuilderFactory.create(facesContext);
+ }
+
+ /**
+ * check if we already added components to the layout component.<br />
+ * <p/>
+ * if this is the case then:
+ * <ul>
+ * <li>keep them cached and avoid readd</li>
+ * <li><strike>in development mode: remove the components</strike></li>
+ * <li><strike>in production mode: keep them cached</strike></li>
+ * </ul>
+ * <p/>
+ * TODO: need to figure out whats the best way to recreate the components
+ *
+ * @return true if we have to add our components again
+ */
+ protected boolean processPreviouslyAdded(FacesContext context,
+ UIComponent root)
+ {
+ @SuppressWarnings("unchecked")
+ List<UIComponent> rootComponentChildren = root.getChildren();
+ if (rootComponentChildren != null)
+ {
+ for (Object component : rootComponentChildren)
+ {
+ UIComponent child = (UIComponent) component;
+ if (Boolean.TRUE.equals(child.getAttributes().get(
+ DynaForm.DYNA_FORM_CREATED)))
+ {
+ return false;
+ }
+
+ if (!processPreviouslyAdded(context, child))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaFormTag.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaFormTag.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaFormTag.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/DynaFormTag.java Thu Jul 3 14:34:56 2008
@@ -32,67 +32,67 @@
*/
public class DynaFormTag extends UIComponentBodyTagBase
{
- private String uri;
- private String valueBindingPrefix;
- private String displayOnly;
- private String bundle;
- private String exclusiveFields;
+ private String uri;
+ private String valueBindingPrefix;
+ private String displayOnly;
+ private String bundle;
+ private String exclusiveFields;
private String idAsDisplayOnly;
public void release()
- {
- super.release();
+ {
+ super.release();
- uri = null;
- displayOnly = null;
+ uri = null;
+ displayOnly = null;
idAsDisplayOnly = null;
bundle = null;
- exclusiveFields = null;
- valueBindingPrefix = null;
- }
-
- protected void setProperties(UIComponent component)
- {
- super.setProperties(component);
- setStringProperty(component, "uri", uri);
- setStringProperty(component, "valueBindingPrefix", valueBindingPrefix);
- setBooleanProperty(component, "displayOnly", displayOnly);
- setStringProperty(component, "bundle", bundle);
- setBooleanProperty(component, "exclusiveFields", exclusiveFields);
+ exclusiveFields = null;
+ valueBindingPrefix = null;
+ }
+
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setStringProperty(component, "uri", uri);
+ setStringProperty(component, "valueBindingPrefix", valueBindingPrefix);
+ setBooleanProperty(component, "displayOnly", displayOnly);
+ setStringProperty(component, "bundle", bundle);
+ setBooleanProperty(component, "exclusiveFields", exclusiveFields);
setBooleanProperty(component, "idAsDisplayOnly", idAsDisplayOnly);
- }
+ }
+
+ /**
+ * @see org.apache.myfaces.orchestra.dynaForm.component.dynaForm.DynaForm#setUri(String)
+ */
+ public String getUri()
+ {
+ return uri;
+ }
- /**
- * @see org.apache.myfaces.orchestra.dynaForm.component.dynaForm.DynaForm#setUri(String)
- */
- public String getUri()
- {
- return uri;
- }
-
- /**
- * @see org.apache.myfaces.orchestra.dynaForm.component.dynaForm.DynaForm#setUri(String)
- */
- public void setUri(String uri)
- {
- this.uri = uri;
- }
-
- /**
- * @see DynaForm#setDisplayOnly(boolean)
- */
- public String getDisplayOnly()
- {
- return displayOnly;
- }
-
- /**
- * @see DynaForm#setDisplayOnly(boolean)
- */
- public void setDisplayOnly(String displayOnly)
- {
- this.displayOnly = displayOnly;
- }
+ /**
+ * @see org.apache.myfaces.orchestra.dynaForm.component.dynaForm.DynaForm#setUri(String)
+ */
+ public void setUri(String uri)
+ {
+ this.uri = uri;
+ }
+
+ /**
+ * @see DynaForm#setDisplayOnly(boolean)
+ */
+ public String getDisplayOnly()
+ {
+ return displayOnly;
+ }
+
+ /**
+ * @see DynaForm#setDisplayOnly(boolean)
+ */
+ public void setDisplayOnly(String displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
/**
* @see DynaForm#setIdAsDisplayOnly(boolean)
@@ -111,74 +111,74 @@
}
/**
- * @see DynaForm#setBundle(String)
- */
- public String getBundle()
- {
- return bundle;
- }
-
- /**
- * @see DynaForm#setBundle(String)
- */
- public void setBundle(String bundle)
- {
- this.bundle = bundle;
- }
-
- /**
- * @see DynaForm#setExclusiveFields(boolean)
- */
- public String getExclusiveFields()
- {
- return exclusiveFields;
- }
-
- /**
- * @see DynaForm#setExclusiveFields(boolean)
- */
- public void setExclusiveFields(String exclusiveFields)
- {
- this.exclusiveFields = exclusiveFields;
- }
-
- /**
- * @see DynaForm#setValueBindingPrefix(String)
- */
- public String getValueBindingPrefix()
- {
- return valueBindingPrefix;
- }
-
- /**
- * @see DynaForm#setValueBindingPrefix(String)
- */
- public void setValueBindingPrefix(String valueBindingPrefix)
- {
- this.valueBindingPrefix = valueBindingPrefix;
- }
-
- public String getComponentType()
- {
- return DynaForm.COMPONENT_TYPE;
- }
-
- public String getRendererType()
- {
- return null;
- }
-
- public int doEndTag() throws JspException
- {
- // first, save the component, doEndTag will reset the reference to it
- DynaForm component = (DynaForm) findComponent(getFacesContext());
- FacesContext context = getFacesContext();
+ * @see DynaForm#setBundle(String)
+ */
+ public String getBundle()
+ {
+ return bundle;
+ }
- int ret = super.doEndTag();
+ /**
+ * @see DynaForm#setBundle(String)
+ */
+ public void setBundle(String bundle)
+ {
+ this.bundle = bundle;
+ }
- // now the component should be cleaned-up and ready to be populated again
- component.initView(context);
+ /**
+ * @see DynaForm#setExclusiveFields(boolean)
+ */
+ public String getExclusiveFields()
+ {
+ return exclusiveFields;
+ }
+
+ /**
+ * @see DynaForm#setExclusiveFields(boolean)
+ */
+ public void setExclusiveFields(String exclusiveFields)
+ {
+ this.exclusiveFields = exclusiveFields;
+ }
+
+ /**
+ * @see DynaForm#setValueBindingPrefix(String)
+ */
+ public String getValueBindingPrefix()
+ {
+ return valueBindingPrefix;
+ }
+
+ /**
+ * @see DynaForm#setValueBindingPrefix(String)
+ */
+ public void setValueBindingPrefix(String valueBindingPrefix)
+ {
+ this.valueBindingPrefix = valueBindingPrefix;
+ }
- return ret;
- }
+ public String getComponentType()
+ {
+ return DynaForm.COMPONENT_TYPE;
+ }
+
+ public String getRendererType()
+ {
+ return null;
+ }
+
+ public int doEndTag() throws JspException
+ {
+ // first, save the component, doEndTag will reset the reference to it
+ DynaForm component = (DynaForm) findComponent(getFacesContext());
+ FacesContext context = getFacesContext();
+
+ int ret = super.doEndTag();
+
+ // now the component should be cleaned-up and ready to be populated again
+ component.initView(context);
+
+ return ret;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/facelets/DynaFormHandler.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/facelets/DynaFormHandler.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/facelets/DynaFormHandler.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/facelets/DynaFormHandler.java Thu Jul 3 14:34:56 2008
@@ -30,34 +30,34 @@
*/
public class DynaFormHandler extends ComponentHandler
{
- public DynaFormHandler(ComponentConfig tagConfig)
- {
- super(tagConfig);
- }
+ public DynaFormHandler(ComponentConfig tagConfig)
+ {
+ super(tagConfig);
+ }
- @Override
- protected void onComponentPopulated(FaceletContext ctx, UIComponent c, UIComponent parent)
- {
- boolean resetParent = false;
- DynaForm dynaForm = (DynaForm) c;
- if (dynaForm.getParent() == null)
- {
- resetParent = true;
- dynaForm.setParent(parent);
- }
- try
- {
- dynaForm.setELContext(ctx);
- dynaForm.initView(ctx.getFacesContext());
- }
- finally
- {
- // ensure no one else will be able to use this ELContext afterwards
- dynaForm.setELContext(null);
- if (resetParent)
- {
- dynaForm.setParent(null);
- }
- }
- }
+ @Override
+ protected void onComponentPopulated(FaceletContext ctx, UIComponent c, UIComponent parent)
+ {
+ boolean resetParent = false;
+ DynaForm dynaForm = (DynaForm) c;
+ if (dynaForm.getParent() == null)
+ {
+ resetParent = true;
+ dynaForm.setParent(parent);
+ }
+ try
+ {
+ dynaForm.setELContext(ctx);
+ dynaForm.initView(ctx.getFacesContext());
+ }
+ finally
+ {
+ // ensure no one else will be able to use this ELContext afterwards
+ dynaForm.setELContext(null);
+ if (resetParent)
+ {
+ dynaForm.setParent(null);
+ }
+ }
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/DynaFormComponentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/DynaFormComponentHandler.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/DynaFormComponentHandler.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/DynaFormComponentHandler.java Thu Jul 3 14:34:56 2008
@@ -26,5 +26,5 @@
*/
public interface DynaFormComponentHandler
{
- public void buildComponent(DynaForm dynaForm, GuiBuilder guiBuilder, MetaField field);
+ public void buildComponent(DynaForm dynaForm, GuiBuilder guiBuilder, MetaField field);
}
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/GuiBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/GuiBuilder.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/GuiBuilder.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/GuiBuilder.java Thu Jul 3 14:34:56 2008
@@ -42,10 +42,10 @@
public abstract class GuiBuilder
{
private boolean idAsDisplayOnly;
- private boolean displayOnly;
- private Map<String, String> labelBundle;
+ private boolean displayOnly;
+ private Map<String, String> labelBundle;
- /**
+ /**
* Returns true if this field should be rendered display only.
*/
public boolean isFieldDisplayOnly(MetaField field)
@@ -54,12 +54,12 @@
}
/**
- * Set to true if the guiBuilder should build a read-only form only.
- */
- public void setFormDisplayOnly(boolean displayOnly)
- {
- this.displayOnly = displayOnly;
- }
+ * Set to true if the guiBuilder should build a read-only form only.
+ */
+ public void setFormDisplayOnly(boolean displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
/**
* @see #setIdAsDisplayOnly(boolean)
@@ -78,206 +78,206 @@
}
/**
- * @see #setLabelBundle(Map)
- */
- public Map<String, String> getLabelBundle()
- {
- return labelBundle;
- }
-
- /**
- * The resource bundle to be used when translating field names into
- * text labels.
- * <p>
- * A labelBundle is optional; if not specified then the field name will
- * be used as the label. In addition, if a field-name is not defined in
- * the resource bundle then the raw field-name will also be used.
- */
- public void setLabelBundle(Map<String, String> labelBundle)
- {
- this.labelBundle = labelBundle;
- }
-
- /**
- * Output text using the field as value provider.
- */
- public abstract void createOutputText(MetaField field);
-
- /**
- * input field
- */
- public abstract void createInputText(MetaField field);
-
- /**
- * input date
- */
- public abstract void createInputDate(MetaField field);
-
- /**
- * select one menu
- */
- public abstract void createSelectOneMenu(MetaField field);
-
- /**
- * enter a number
- */
- public abstract void createInputNumber(MetaField field);
-
- /**
- * select a boolean
- */
- public abstract void createInputBoolean(MetaField field);
-
- /**
- * search for component
- */
- public abstract void createSearchFor(MetaField field);
-
- /**
- * search for component
- */
- public abstract void createSearchForSelectMenu(MetaField field);
-
- // public abstract void createSearchForSelectMenu(MetaField field);
-
- /**
- * this is when the user passed in a component to use for the this field
- */
- public abstract void createNative(MetaField field);
-
- /**
- * actuallly build the fields gui component
- */
- protected boolean buildField(MetaField field)
- {
- Class<?> fieldType = field.getType();
-
- if (field.getWantedComponent() != null)
- {
- createNative(field);
- return true;
- }
-
- if (!field.getWantedComponentType().equals(FieldRepresentation.Automatic))
- {
- switch (field.getWantedComponentType())
- {
- case OutputText:
- createOutputText(field);
- return true;
-
- case InputText:
- createInputText(field);
- return true;
-
- case InputDate:
- createInputDate(field);
- return true;
-
- case SelectOneMenu:
- if (RelationType.MANY_TO_ONE.equals(field.getRelationType()))
- {
- createSearchForSelectMenu(field);
- }
- else
- {
- // TODO: will not work now
- createSelectOneMenu(field);
- }
- return true;
-
- /*
- case SelectSearchMenu:
- createSearchForSelectMenu(field);
- return true;
- */
-
- case InputNumber:
- createInputNumber(field);
- return true;
-
- case InputBoolean:
- createInputBoolean(field);
- return true;
- }
- }
-
- if (Boolean.TRUE.equals(field.getDisplayOnly()))
- {
- createOutputText(field);
- return true;
- }
-
- if (field.getAllowedSelections() != null)
- {
- createSelectOneMenu(field);
- return true;
- }
-
- if (RelationType.MANY_TO_ONE.equals(field.getRelationType()))
- {
- createSearchFor(field);
- return true;
- }
-
- if (fieldType == null)
- {
- throw new IllegalArgumentException("No type for field '" + field.getName() + "' detected.");
- }
-
- if (Date.class.isAssignableFrom(fieldType))
- {
- createInputDate(field);
- return true;
- }
-
- TypeInfos.Info typeInfo = TypeInfos.getInfo(fieldType);
- if (typeInfo != null && typeInfo.isNumber())
- {
- createInputNumber(field);
- return true;
- }
-
- if (String.class.isAssignableFrom(fieldType))
- {
- createInputText(field);
- return true;
- }
-
- if (Boolean.class.isAssignableFrom(fieldType) || boolean.class.equals(fieldType))
- {
- createInputBoolean(field);
- return true;
- }
-
- return false;
- }
-
- /**
- * Localise a text string using the resource-bundle specified for the dynaform.
- * <p>
- * If the key is null, or there is no resource-bundle, or there is no entry in
- * the resource bundle for the specified key, then return the dflt string.
- */
- protected String translateText(String key, String dflt)
- {
- if (key == null)
- {
- return dflt;
- }
-
- Map<String, String> bundle = getLabelBundle();
- if (bundle == null)
- {
- return dflt;
- }
-
- Object val = bundle.get(key);
- if (val != null)
- {
- return val.toString();
- }
-
- return dflt;
- }
+ * @see #setLabelBundle(Map)
+ */
+ public Map<String, String> getLabelBundle()
+ {
+ return labelBundle;
+ }
+
+ /**
+ * The resource bundle to be used when translating field names into
+ * text labels.
+ * <p>
+ * A labelBundle is optional; if not specified then the field name will
+ * be used as the label. In addition, if a field-name is not defined in
+ * the resource bundle then the raw field-name will also be used.
+ */
+ public void setLabelBundle(Map<String, String> labelBundle)
+ {
+ this.labelBundle = labelBundle;
+ }
+
+ /**
+ * Output text using the field as value provider.
+ */
+ public abstract void createOutputText(MetaField field);
+
+ /**
+ * input field
+ */
+ public abstract void createInputText(MetaField field);
+
+ /**
+ * input date
+ */
+ public abstract void createInputDate(MetaField field);
+
+ /**
+ * select one menu
+ */
+ public abstract void createSelectOneMenu(MetaField field);
+
+ /**
+ * enter a number
+ */
+ public abstract void createInputNumber(MetaField field);
+
+ /**
+ * select a boolean
+ */
+ public abstract void createInputBoolean(MetaField field);
+
+ /**
+ * search for component
+ */
+ public abstract void createSearchFor(MetaField field);
+
+ /**
+ * search for component
+ */
+ public abstract void createSearchForSelectMenu(MetaField field);
+
+ // public abstract void createSearchForSelectMenu(MetaField field);
+
+ /**
+ * this is when the user passed in a component to use for the this field
+ */
+ public abstract void createNative(MetaField field);
+
+ /**
+ * actuallly build the fields gui component
+ */
+ protected boolean buildField(MetaField field)
+ {
+ Class<?> fieldType = field.getType();
+
+ if (field.getWantedComponent() != null)
+ {
+ createNative(field);
+ return true;
+ }
+
+ if (!field.getWantedComponentType().equals(FieldRepresentation.Automatic))
+ {
+ switch (field.getWantedComponentType())
+ {
+ case OutputText:
+ createOutputText(field);
+ return true;
+
+ case InputText:
+ createInputText(field);
+ return true;
+
+ case InputDate:
+ createInputDate(field);
+ return true;
+
+ case SelectOneMenu:
+ if (RelationType.MANY_TO_ONE.equals(field.getRelationType()))
+ {
+ createSearchForSelectMenu(field);
+ }
+ else
+ {
+ // TODO: will not work now
+ createSelectOneMenu(field);
+ }
+ return true;
+
+ /*
+ case SelectSearchMenu:
+ createSearchForSelectMenu(field);
+ return true;
+ */
+
+ case InputNumber:
+ createInputNumber(field);
+ return true;
+
+ case InputBoolean:
+ createInputBoolean(field);
+ return true;
+ }
+ }
+
+ if (Boolean.TRUE.equals(field.getDisplayOnly()))
+ {
+ createOutputText(field);
+ return true;
+ }
+
+ if (field.getAllowedSelections() != null)
+ {
+ createSelectOneMenu(field);
+ return true;
+ }
+
+ if (RelationType.MANY_TO_ONE.equals(field.getRelationType()))
+ {
+ createSearchFor(field);
+ return true;
+ }
+
+ if (fieldType == null)
+ {
+ throw new IllegalArgumentException("No type for field '" + field.getName() + "' detected.");
+ }
+
+ if (Date.class.isAssignableFrom(fieldType))
+ {
+ createInputDate(field);
+ return true;
+ }
+
+ TypeInfos.Info typeInfo = TypeInfos.getInfo(fieldType);
+ if (typeInfo != null && typeInfo.isNumber())
+ {
+ createInputNumber(field);
+ return true;
+ }
+
+ if (String.class.isAssignableFrom(fieldType))
+ {
+ createInputText(field);
+ return true;
+ }
+
+ if (Boolean.class.isAssignableFrom(fieldType) || boolean.class.equals(fieldType))
+ {
+ createInputBoolean(field);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Localise a text string using the resource-bundle specified for the dynaform.
+ * <p>
+ * If the key is null, or there is no resource-bundle, or there is no entry in
+ * the resource bundle for the specified key, then return the dflt string.
+ */
+ protected String translateText(String key, String dflt)
+ {
+ if (key == null)
+ {
+ return dflt;
+ }
+
+ Map<String, String> bundle = getLabelBundle();
+ if (bundle == null)
+ {
+ return dflt;
+ }
+
+ Object val = bundle.get(key);
+ if (val != null)
+ {
+ return val.toString();
+ }
+
+ return dflt;
+ }
}
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/Slipstream.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/Slipstream.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/Slipstream.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/Slipstream.java Thu Jul 3 14:34:56 2008
@@ -30,80 +30,80 @@
*/
public class Slipstream
{
- private MetaData modelMetaData;
- private GuiBuilder guiBuilder;
- private Map<String, String> labelBundle;
- private DynaForm dynaForm;
-
- public Slipstream()
- {
- }
+ private MetaData modelMetaData;
+ private GuiBuilder guiBuilder;
+ private Map<String, String> labelBundle;
+ private DynaForm dynaForm;
+
+ public Slipstream()
+ {
+ }
public MetaData getModelMetaData()
- {
- return modelMetaData;
- }
-
- public void setModelMetaData(MetaData modelMetaData)
- {
- this.modelMetaData = modelMetaData;
- }
-
- public GuiBuilder getGuiBuilder()
- {
- return guiBuilder;
- }
-
- public void setGuiBuilder(GuiBuilder guiBuilder)
- {
- this.guiBuilder = guiBuilder;
- }
-
- public Map<String, String> getLabelBundle()
- {
- return labelBundle;
- }
-
- public void setLabelBundle(Map<String, String> labelBundle)
- {
- this.labelBundle = labelBundle;
- }
-
- public DynaForm getDynaForm()
- {
- return dynaForm;
- }
-
- public void setDynaForm(DynaForm dynaForm)
- {
- this.dynaForm = dynaForm;
- }
-
- public void process()
- {
- configureGuiBuilder();
-
- MetaData metaData = modelMetaData;
- Iterator<String> iterFieldNames = metaData.iterFieldNames();
- while (iterFieldNames.hasNext())
- {
- String fieldName = iterFieldNames.next();
- MetaField field = modelMetaData.getField(fieldName);
- if (field.getComponentHandler() != null)
- {
- field.getComponentHandler().buildComponent(dynaForm, guiBuilder, field);
- }
- else
- {
- guiBuilder.buildField(field);
- }
- }
- }
-
- protected void configureGuiBuilder()
- {
- guiBuilder.setFormDisplayOnly(dynaForm.isDisplayOnly());
- guiBuilder.setLabelBundle(getLabelBundle());
+ {
+ return modelMetaData;
+ }
+
+ public void setModelMetaData(MetaData modelMetaData)
+ {
+ this.modelMetaData = modelMetaData;
+ }
+
+ public GuiBuilder getGuiBuilder()
+ {
+ return guiBuilder;
+ }
+
+ public void setGuiBuilder(GuiBuilder guiBuilder)
+ {
+ this.guiBuilder = guiBuilder;
+ }
+
+ public Map<String, String> getLabelBundle()
+ {
+ return labelBundle;
+ }
+
+ public void setLabelBundle(Map<String, String> labelBundle)
+ {
+ this.labelBundle = labelBundle;
+ }
+
+ public DynaForm getDynaForm()
+ {
+ return dynaForm;
+ }
+
+ public void setDynaForm(DynaForm dynaForm)
+ {
+ this.dynaForm = dynaForm;
+ }
+
+ public void process()
+ {
+ configureGuiBuilder();
+
+ MetaData metaData = modelMetaData;
+ Iterator<String> iterFieldNames = metaData.iterFieldNames();
+ while (iterFieldNames.hasNext())
+ {
+ String fieldName = iterFieldNames.next();
+ MetaField field = modelMetaData.getField(fieldName);
+ if (field.getComponentHandler() != null)
+ {
+ field.getComponentHandler().buildComponent(dynaForm, guiBuilder, field);
+ }
+ else
+ {
+ guiBuilder.buildField(field);
+ }
+ }
+ }
+
+ protected void configureGuiBuilder()
+ {
+ guiBuilder.setFormDisplayOnly(dynaForm.isDisplayOnly());
+ guiBuilder.setLabelBundle(getLabelBundle());
guiBuilder.setIdAsDisplayOnly(dynaForm.isIdAsDisplayOnly());
- }
+ }
}
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/DataSourceLabelConverter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/DataSourceLabelConverter.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/DataSourceLabelConverter.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/DataSourceLabelConverter.java Thu Jul 3 14:34:56 2008
@@ -31,50 +31,50 @@
*/
public class DataSourceLabelConverter implements Converter, StateHolder
{
- private boolean _transient = false;
- private MethodBinding mbLabel;
+ private boolean _transient = false;
+ private MethodBinding mbLabel;
- public DataSourceLabelConverter()
- {
- }
-
- public DataSourceLabelConverter(MethodBinding mbLabel)
- {
- this.mbLabel = mbLabel;
- }
-
- public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String s) throws ConverterException
- {
- throw new UnsupportedOperationException();
- }
-
- public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object o) throws ConverterException
- {
- return (String) mbLabel.invoke(facesContext, new Object[] {o});
- }
-
- public Object saveState(FacesContext facesContext)
- {
- return new Object[]
- {
- UIComponentBase.saveAttachedState(facesContext, mbLabel)
- };
- }
-
- public void restoreState(FacesContext facesContext, Object o)
- {
- Object[] state = (Object[]) o;
-
- mbLabel = (MethodBinding) UIComponentBase.restoreAttachedState(facesContext, state[0]);
- }
-
- public boolean isTransient()
- {
- return _transient;
- }
-
- public void setTransient(boolean b)
- {
- _transient = b;
- }
+ public DataSourceLabelConverter()
+ {
+ }
+
+ public DataSourceLabelConverter(MethodBinding mbLabel)
+ {
+ this.mbLabel = mbLabel;
+ }
+
+ public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String s) throws ConverterException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object o) throws ConverterException
+ {
+ return (String) mbLabel.invoke(facesContext, new Object[] {o});
+ }
+
+ public Object saveState(FacesContext facesContext)
+ {
+ return new Object[]
+ {
+ UIComponentBase.saveAttachedState(facesContext, mbLabel)
+ };
+ }
+
+ public void restoreState(FacesContext facesContext, Object o)
+ {
+ Object[] state = (Object[]) o;
+
+ mbLabel = (MethodBinding) UIComponentBase.restoreAttachedState(facesContext, state[0]);
+ }
+
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+
+ public void setTransient(boolean b)
+ {
+ _transient = b;
+ }
}