cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: rev 47104 - cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel
Date Thu, 23 Sep 2004 14:16:39 GMT
Author: sylvain
Date: Thu Sep 23 07:16:39 2004
New Revision: 47104

Modified:
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ActionDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanFieldDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ClassDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FormDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MessagesDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/NewDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/OutputDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/StructDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinitionBuilder.java
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
Log:
Widget attributes can now be defined in the form definition (need also to write docs for this)

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
Thu Sep 23 07:16:39 2004
@@ -429,12 +429,16 @@
         contentHandler.endElement(Constants.INSTANCE_NS, element, Constants.INSTANCE_PREFIX_COLON
+ element);
     }
 
-    public Object getAttribute(String name) {
-        if (this.attributes != null){
-            return this.attributes.get(name);
-        } else{
-            return null;
-        }
+	public Object getAttribute(String name) {
+        Object result = null;
+        
+        // First check locally
+        if (this.attributes != null) result = this.attributes.get(name);
+        
+        // Fall back to the definition's attributes
+        if (result == null) result = getDefinition().getAttribute(name);
+        
+        return result;
     }
 
     public void setAttribute(String name, Object value) {

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
Thu Sep 23 07:16:39 2004
@@ -33,7 +33,7 @@
 /**
  * Provides functionality that is common across many WidgetDefinition implementations.
  * 
- * @version $Id: AbstractWidgetDefinition.java,v 1.7 2004/06/15 07:33:44 sylvain Exp $
+ * @version $Id$
  */
 public abstract class AbstractWidgetDefinition implements WidgetDefinition {
     private FormDefinition formDefinition;
@@ -42,6 +42,8 @@
     //TODO consider final on these
     private String location = null;
     private String id;
+    /** The initial map of attributes (can be null) */
+    private Map attributes;
     private Map displayData;
     private List validators;
     
@@ -89,6 +91,18 @@
         this.id = id;
     }
     
+    protected void setAttributes(Map attributes) {
+        this.attributes = attributes;   
+    }
+    
+    public Object getAttribute(String name) {
+        if (this.attributes != null) {
+            return this.attributes.get(name);
+        } else {
+            return null;
+        }
+    }
+
     protected void addCreateListener(CreateListener listener) {
     		this.createListener = WidgetEventMulticaster.add(this.createListener, listener);
     }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -64,17 +64,37 @@
         this.widgetListenerBuilderSelector = (ServiceSelector) serviceManager.lookup(WidgetListenerBuilder.ROLE
+ "Selector");
     }
 
-    protected void setLocation(Element widgetElement, AbstractWidgetDefinition widgetDefinition)
{
+    protected void setCommonProperties(Element widgetElement, AbstractWidgetDefinition widgetDefinition)
throws Exception {
+        // location
         widgetDefinition.setLocation(DomHelper.getLocation(widgetElement));
-    }
-
-    protected void setId(Element widgetElement, AbstractWidgetDefinition widgetDefinition)
throws Exception {
-        String id = DomHelper.getAttribute(widgetElement, "id");
-        if (id.length() < 1) {
-            throw new Exception("Missing id attribute on element '" + widgetElement.getTagName()
+ "' at " +
-                                DomHelper.getLocation(widgetElement));
+        
+        // id
+        if (widgetDefinition instanceof FormDefinition) {
+            // FormDefinition is the *only* kind of widget that has an optional id
+            widgetDefinition.setId(DomHelper.getAttribute(widgetElement, "id", ""));   
+        } else {
+            String id = DomHelper.getAttribute(widgetElement, "id");
+            if (id.length() < 1) {
+                throw new Exception("Missing id attribute on element '" + widgetElement.getTagName()
+ "' at " +
+                                    DomHelper.getLocation(widgetElement));
+            }
+            widgetDefinition.setId(id);
+        }
+        
+        // attributes
+        Element attrContainer = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS,
"attributes", false);
+        if (attrContainer != null) {
+            // There's a <fd:attributes> element. Get its <fd:attribute> children
+            Element[] attrs = DomHelper.getChildElements(attrContainer, Constants.DEFINITION_NS,
"attribute");
+            if (attrs != null && attrs.length > 0) {
+                // We actually do have some
+                Map attrMap = new HashMap();
+                for (int i = 0; i < attrs.length; i++) {
+                    attrMap.put(DomHelper.getAttribute(attrs[i], "name"), DomHelper.getAttribute(attrs[i],
"value"));
+                }
+                widgetDefinition.setAttributes(attrMap);
+            }
         }
-        widgetDefinition.setId(id);
     }
 
     protected WidgetDefinition buildAnotherWidgetDefinition(Element widgetDefinition) throws
Exception {

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ActionDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ActionDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ActionDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -24,13 +24,12 @@
 /**
  * Builds {@link ActionDefinition}s.
  * 
- * @version $Id: ActionDefinitionBuilder.java,v 1.1 2004/03/09 10:33:50 reinhard Exp $
+ * @version $Id$
  */
 public class ActionDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
     public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception
{
         ActionDefinition actionDefinition = createDefinition();
-        setLocation(widgetElement, actionDefinition);
-        setId(widgetElement, actionDefinition);
+        setCommonProperties(widgetElement, actionDefinition);
         setDisplayData(widgetElement, actionDefinition);
 
         String actionCommand = DomHelper.getAttribute(widgetElement, "action-command");

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanFieldDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanFieldDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanFieldDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -23,13 +23,12 @@
 /**
  * Builds {@link BooleanFieldDefinition}s.
  * 
- * @version $Id: BooleanFieldDefinitionBuilder.java,v 1.2 2004/07/02 09:17:08 jeremy Exp
$
+ * @version $Id$
  */
 public class BooleanFieldDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
     public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception
{
         BooleanFieldDefinition definition = new BooleanFieldDefinition();
-        setLocation(widgetElement, definition);
-        setId(widgetElement, definition);
+        setCommonProperties(widgetElement, definition);
         setDisplayData(widgetElement, definition);
         setValidators(widgetElement, definition);
         Iterator iter = buildEventListeners(widgetElement, "on-value-changed", ValueChangedListener.class).iterator();

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ClassDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ClassDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ClassDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -22,14 +22,13 @@
 /**
  * Builds {ClassDefinition}s.
  *
- * @version $Id: ClassDefinitionBuilder.java,v 1.3 2004/04/12 14:05:09 tim Exp $
+ * @version $Id$
  */
 public class ClassDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
 
     public WidgetDefinition buildWidgetDefinition(Element element) throws Exception {
         ClassDefinition definition = new ClassDefinition();
-        setLocation(element, definition);
-        setId(element, definition);
+        setCommonProperties(element, definition);
         setDisplayData(element, definition);
         setValidators(element, definition);
 

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -26,7 +26,7 @@
 /**
  * Builds {FieldDefinition}s.
  *
- * @version $Id: FieldDefinitionBuilder.java,v 1.4 2004/06/15 07:33:44 sylvain Exp $
+ * @version $Id$
  */
 public class FieldDefinitionBuilder extends AbstractDatatypeWidgetDefinitionBuilder {
 
@@ -37,8 +37,7 @@
     }
 
     protected void buildWidgetDefinition(FieldDefinition fieldDefinition, Element widgetElement)
throws Exception {
-        setLocation(widgetElement, fieldDefinition);
-        setId(widgetElement, fieldDefinition);
+        setCommonProperties(widgetElement, fieldDefinition);
 
         Element datatypeElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS,
"datatype");
         if (datatypeElement == null) {

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FormDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FormDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FormDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -22,14 +22,13 @@
 /**
  * Builds {@link FormDefinition}s.
  * 
- * @version $Id: FormDefinitionBuilder.java,v 1.3 2004/06/08 15:42:19 danielf Exp $
+ * @version $Id$
  */
 public class FormDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
 
     public WidgetDefinition buildWidgetDefinition(Element formElement) throws Exception {
         FormDefinition formDefinition = new FormDefinition();
-        setLocation(formElement, formDefinition);
-        formDefinition.setId(DomHelper.getAttribute(formElement, "id", ""));
+        setCommonProperties(formElement, formDefinition);
         setDisplayData(formElement, formDefinition);
         setValidators(formElement, formDefinition);
 

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MessagesDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MessagesDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MessagesDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -20,13 +20,12 @@
 /**
  * Builds {@link MessagesDefinition}s.
  * 
- * @version $Id: MessagesDefinitionBuilder.java,v 1.1 2004/03/09 10:33:50 reinhard Exp $
+ * @version $Id$
  */
 public class MessagesDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
     public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception
{
         MessagesDefinition messagesDefinition = new MessagesDefinition();
-        setLocation(widgetElement, messagesDefinition);
-        setId(widgetElement, messagesDefinition);
+        setCommonProperties(widgetElement, messagesDefinition);
         setDisplayData(widgetElement, messagesDefinition);
         return messagesDefinition;
     }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -26,13 +26,12 @@
 /**
  * Builds {@link MultiValueFieldDefinition}s.
  * 
- * @version $Id: MultiValueFieldDefinitionBuilder.java,v 1.4 2004/04/22 14:44:31 mpo Exp
$
+ * @version $Id$
  */
 public class MultiValueFieldDefinitionBuilder extends AbstractDatatypeWidgetDefinitionBuilder
{
     public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception
{
         MultiValueFieldDefinition definition = new MultiValueFieldDefinition();
-        setLocation(widgetElement, definition);
-        setId(widgetElement, definition);
+        setCommonProperties(widgetElement, definition);
         setDisplayData(widgetElement, definition);
         setValidators(widgetElement, definition);
 

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/NewDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/NewDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/NewDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -20,14 +20,13 @@
 /**
  * Builds {NewDefinition}s.
  *
- * @version $Id: NewDefinitionBuilder.java,v 1.2 2004/04/12 14:05:09 tim Exp $
+ * @version $Id$
  */
 public class NewDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
 
     public WidgetDefinition buildWidgetDefinition(Element element) throws Exception {
         NewDefinition definition = new NewDefinition();
-        setLocation(element, definition);
-        setId(element, definition);
+        setCommonProperties(element, definition);
         return definition;
     }
 }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/OutputDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/OutputDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/OutputDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -24,13 +24,12 @@
 /**
  * Builds {@link OutputDefinition}s.
  * 
- * @version $Id: OutputDefinitionBuilder.java,v 1.3 2004/03/17 15:37:58 joerg Exp $
+ * @version $Id$
  */
 public class OutputDefinitionBuilder extends AbstractDatatypeWidgetDefinitionBuilder {
     public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception
{
         OutputDefinition definition = new OutputDefinition();
-        setLocation(widgetElement, definition);
-        setId(widgetElement, definition);
+        setCommonProperties(widgetElement, definition);
 
         Element datatypeElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS,
"datatype");
         if (datatypeElement == null) {

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -35,7 +35,7 @@
  * </ul>
  * 
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
- * @version CVS $Id: RepeaterActionDefinitionBuilder.java,v 1.1 2004/03/09 10:33:49 reinhard
Exp $
+ * @version CVS $Id$
  */
 public class RepeaterActionDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
     
@@ -43,8 +43,7 @@
     public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception
{
         String actionCommand = DomHelper.getAttribute(widgetElement, "action-command");
         RepeaterActionDefinition definition = createDefinition(widgetElement, actionCommand);
-        setLocation(widgetElement, definition);
-        setId(widgetElement, definition);
+        setCommonProperties(widgetElement, definition);
         setDisplayData(widgetElement, definition);
         setValidators(widgetElement, definition);
 

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -22,7 +22,7 @@
 /**
  * Builds {@link RepeaterDefinition}s.
  * 
- * @version $Id: RepeaterDefinitionBuilder.java,v 1.2 2004/03/09 13:08:45 cziegeler Exp $
+ * @version $Id$
  */
 public class RepeaterDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
 
@@ -31,8 +31,7 @@
         int initialSize = DomHelper.getAttributeAsInteger(repeaterElement, "initial-size",
0);
         
         RepeaterDefinition repeaterDefinition = new RepeaterDefinition(initialSize);
-        setLocation(repeaterElement, repeaterDefinition);
-        setId(repeaterElement, repeaterDefinition);
+        setCommonProperties(repeaterElement, repeaterDefinition);
         setDisplayData(repeaterElement, repeaterDefinition);
         setValidators(repeaterElement, repeaterDefinition);
 

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -24,7 +24,7 @@
 /**
  * 
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
- * @version CVS $Id: RowActionDefinitionBuilder.java,v 1.1 2004/03/09 10:33:49 reinhard Exp
$
+ * @version CVS $Id$
  */
 public class RowActionDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
     
@@ -32,8 +32,7 @@
     public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception
{
         String actionCommand = DomHelper.getAttribute(widgetElement, "action-command");
         RowActionDefinition definition = createDefinition(widgetElement, actionCommand);
-        setLocation(widgetElement, definition);
-        setId(widgetElement, definition);
+        setCommonProperties(widgetElement, definition);
         setDisplayData(widgetElement, definition);
 
         definition.setActionCommand(actionCommand);

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/StructDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/StructDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/StructDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -22,14 +22,13 @@
 /**
  * Builds {StructDefinition}s.
  *
- * @version $Id: StructDefinitionBuilder.java,v 1.3 2004/04/12 14:05:09 tim Exp $
+ * @version $Id$
  */
 public class StructDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
 
     public WidgetDefinition buildWidgetDefinition(Element element) throws Exception {
         StructDefinition definition = new StructDefinition();
-        setLocation(element, definition);
-        setId(element, definition);
+        setCommonProperties(element, definition);
         setDisplayData(element, definition);
         setValidators(element, definition);
 

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -22,14 +22,13 @@
 /**
  * Builds {UnionDefinition}s.
  *
- * @version $Id: UnionDefinitionBuilder.java,v 1.3 2004/04/12 14:05:09 tim Exp $
+ * @version $Id$
  */
 public class UnionDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
 
     public WidgetDefinition buildWidgetDefinition(Element element) throws Exception {
         UnionDefinition definition = new UnionDefinition();
-        setLocation(element, definition);
-        setId(element, definition);
+        setCommonProperties(element, definition);
         definition.setCaseWidgetId(DomHelper.getAttribute(element, "case", ""));
         setDisplayData(element, definition);
         setValidators(element, definition);

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinitionBuilder.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinitionBuilder.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinitionBuilder.java
Thu Sep 23 07:16:39 2004
@@ -23,7 +23,7 @@
  * 
  * @author <a href="mailto:uv@upaya.co.uk">Upayavira</a>
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
- * @version CVS $Id: UploadDefinitionBuilder.java,v 1.2 2004/03/09 11:31:12 joerg Exp $
+ * @version CVS $Id$
  */
 public class UploadDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
 
@@ -32,8 +32,7 @@
         boolean required = DomHelper.getAttributeAsBoolean(widgetElement, "required", false);
         
         UploadDefinition uploadDefinition = new UploadDefinition(required, mimeTypes);
-        setLocation(widgetElement, uploadDefinition);
-        setId(widgetElement, uploadDefinition);
+        setCommonProperties(widgetElement, uploadDefinition);
 
         setDisplayData(widgetElement, uploadDefinition);
         setValidators(widgetElement, uploadDefinition);

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
Thu Sep 23 07:16:39 2004
@@ -24,7 +24,7 @@
  * usually won't have to bother with the WidgetDefinition's, but will rather use
  * the Widget's themselves.
  * 
- * @version CVS $Id: WidgetDefinition.java,v 1.5 2004/04/29 08:46:19 cziegeler Exp $
+ * @version CVS $Id$
  */
 public interface WidgetDefinition {
 
@@ -47,6 +47,14 @@
      * Gets id of this widget definition.
      */
     public String getId();
+    
+    /**
+     * Gets an attribute that has been defined on the widget's definition
+     * 
+     * @param name the attribute name
+     * @return the attribute value, or null if it doesn't exist
+     */
+    public Object getAttribute(String name);
     
     /**
      * Validate a widget using the validators that were defined in its definition. If validation

Mime
View raw message