cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2 ScriptableWidget.java
Date Fri, 23 Apr 2004 13:02:31 GMT
mpo         2004/04/23 06:02:31

  Modified:    src/blocks/forms/java/org/apache/cocoon/forms/transformation
                        WidgetReplacingPipe.java
                        EffectWidgetReplacingPipe.java
               src/blocks/forms/java/org/apache/cocoon/forms/formmodel
                        Form.java ExpressionContextImpl.java
                        AbstractWidget.java ContainerWidget.java Union.java
                        RepeaterAction.java Widget.java
               src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript
                        ScriptableWidget.java
               src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2
                        ScriptableWidget.java
  Log:
  Completing the formal move of getWidget(id) to the ContainerWidget interface.
  
  Revision  Changes    Path
  1.6       +3 -2      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/transformation/WidgetReplacingPipe.java
  
  Index: WidgetReplacingPipe.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/transformation/WidgetReplacingPipe.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WidgetReplacingPipe.java	18 Mar 2004 21:04:39 -0000	1.5
  +++ WidgetReplacingPipe.java	23 Apr 2004 13:02:31 -0000	1.6
  @@ -19,6 +19,7 @@
   
   import org.apache.avalon.excalibur.pool.Recyclable;
   import org.apache.cocoon.forms.Constants;
  +import org.apache.cocoon.forms.formmodel.ContainerWidget;
   import org.apache.cocoon.forms.formmodel.Repeater;
   import org.apache.cocoon.forms.formmodel.Widget;
   import org.apache.cocoon.i18n.I18nUtils;
  @@ -249,7 +250,7 @@
           if (widgetId == null || widgetId.equals("")) {
               throw new SAXException("FormsTemplateTransformer: missing id attribute on a
Cocoon Forms element.");
           }
  -        Widget widget = contextWidget.getWidget(widgetId);
  +        Widget widget = ((ContainerWidget)contextWidget).getWidget(widgetId);
           if (widget == null) {
               throw new SAXException("FormsTemplateTransformer: widget with id \"" + widgetId
+ "\" does not exist in the container " + contextWidget.getFullyQualifiedId());
           }
  
  
  
  1.11      +3 -2      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java
  
  Index: EffectWidgetReplacingPipe.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EffectWidgetReplacingPipe.java	12 Apr 2004 21:43:39 -0000	1.10
  +++ EffectWidgetReplacingPipe.java	23 Apr 2004 13:02:31 -0000	1.11
  @@ -18,6 +18,7 @@
   import org.apache.avalon.excalibur.pool.Recyclable;
   import org.apache.cocoon.forms.Constants;
   import org.apache.cocoon.forms.formmodel.AggregateField;
  +import org.apache.cocoon.forms.formmodel.ContainerWidget;
   import org.apache.cocoon.forms.formmodel.Repeater;
   import org.apache.cocoon.forms.formmodel.Struct;
   import org.apache.cocoon.forms.formmodel.Union;
  @@ -167,7 +168,7 @@
       }
   
       protected Widget getWidget(String widgetId) throws SAXException {
  -        Widget widget = contextWidget.getWidget(widgetId);
  +        Widget widget = ((ContainerWidget)contextWidget).getWidget(widgetId);
           if (widget == null) {
               if (contextWidget.getFullyQualifiedId().equals("")) {
                   throwSAXException("Widget with id \"" + widgetId + "\" does not exist in
the form container.");
  
  
  
  1.10      +2 -2      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java
  
  Index: Form.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Form.java	22 Apr 2004 14:26:48 -0000	1.9
  +++ Form.java	23 Apr 2004 13:02:31 -0000	1.10
  @@ -207,7 +207,7 @@
               StringTokenizer stok = new StringTokenizer(submitId, ".");
               Widget submit = this;
               while (stok.hasMoreTokens()) {
  -                submit = submit.getWidget(stok.nextToken());
  +                submit = ((ContainerWidget)submit).getWidget(stok.nextToken());
                   if (submit == null) {
                       throw new IllegalArgumentException("Invalid submit id (no such widget):
" + submitId);
                   }
  
  
  
  1.2       +3 -3      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ExpressionContextImpl.java
  
  Index: ExpressionContextImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ExpressionContextImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExpressionContextImpl.java	9 Mar 2004 10:33:49 -0000	1.1
  +++ ExpressionContextImpl.java	23 Apr 2004 13:02:31 -0000	1.2
  @@ -65,9 +65,9 @@
           // TODO allow to access other widgets instead of only siblings (allow going up
with ../ notation or something)
           Widget widget;
           if (!referenceChildren)
  -            widget = this.widget.getParent().getWidget(name);
  +            widget = ((ContainerWidget)this.widget.getParent()).getWidget(name);
           else
  -            widget = this.widget.getWidget(name);
  +            widget = ((ContainerWidget)this.widget).getWidget(name);
           if (widget != null) {
               Object value = widget.getValue();
   
  
  
  
  1.12      +1 -7      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
  
  Index: AbstractWidget.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractWidget.java	22 Apr 2004 09:41:49 -0000	1.11
  +++ AbstractWidget.java	23 Apr 2004 13:02:31 -0000	1.12
  @@ -160,12 +160,6 @@
           return false;
       }
   
  -    // TODO: consider moving this from the Widget interface to the ContainerWidget
  -    // then we could remove it here as well, no?
  -    public Widget getWidget(String id) {
  -        return null;
  -    }
  -    
       /**
        * @inheritDoc 
        * 
  
  
  
  1.3       +3 -3      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ContainerWidget.java
  
  Index: ContainerWidget.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ContainerWidget.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContainerWidget.java	12 Apr 2004 14:05:09 -0000	1.2
  +++ ContainerWidget.java	23 Apr 2004 13:02:31 -0000	1.3
  @@ -35,12 +35,12 @@
   
       /**
        * Gets the child widget with the given id.
  -     * Returns null if there is no child with the given id.
  +     * @return null if there is no child with the given id.
        */
       public Widget getWidget(String id);
   
       /**
  -     * Returns an iterator over the widgets this object contains
  +     * @return an iterator over the widgets this object contains
        */
       public Iterator getChildren();
   
  
  
  
  1.8       +2 -2      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java
  
  Index: Union.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Union.java	21 Apr 2004 20:33:29 -0000	1.7
  +++ Union.java	23 Apr 2004 13:02:31 -0000	1.8
  @@ -58,7 +58,7 @@
       // *widget* (not definition) references after the expansion has put all of the widgets
in place.
       public void resolve() {
           String caseWidgetId = definition.getCaseWidgetId();
  -        caseWidget = getParent().getWidget(caseWidgetId);
  +        caseWidget = ((ContainerWidget)getParent()).getWidget(caseWidgetId);
       }
   
       /**
  
  
  
  1.3       +2 -2      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterAction.java
  
  Index: RepeaterAction.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RepeaterAction.java	9 Apr 2004 16:43:21 -0000	1.2
  +++ RepeaterAction.java	23 Apr 2004 13:02:31 -0000	1.3
  @@ -40,7 +40,7 @@
               Widget widget;
               if (name != null) {
                   // Get the corresponding sibling
  -                widget = getParent().getWidget(name);
  +                widget = ((ContainerWidget)getParent()).getWidget(name);
               } else {
                   // Get the grand-parent (parent is the repeater row).
                   widget = getParent().getParent();
  
  
  
  1.7       +2 -10     cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
  
  Index: Widget.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Widget.java	22 Apr 2004 06:57:07 -0000	1.6
  +++ Widget.java	23 Apr 2004 13:02:31 -0000	1.7
  @@ -149,15 +149,7 @@
        * for some widgets this may not make sense, those should return false here.
        */
       public boolean isRequired();
  -
  -    /**
  -     * Gets the child widget of this widget with the given id, or null if there isn't such
a child.
  -     */
  -    //TODO: this is duplicated on the ContainerWidget interface
  -    // and in fact only seems to be reasonable in that scope
  -    // should we not remove this?
  -    public Widget getWidget(String id);
  -    
  +   
       /**
        * Broadcast an event previously queued by this widget to its event listeners.
        */
  
  
  
  1.3       +5 -4      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java
  
  Index: ScriptableWidget.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ScriptableWidget.java	11 Mar 2004 02:56:32 -0000	1.2
  +++ ScriptableWidget.java	23 Apr 2004 13:02:31 -0000	1.3
  @@ -17,6 +17,7 @@
   package org.apache.cocoon.forms.flow.javascript;
   import org.apache.cocoon.forms.formmodel.AggregateField;
   import org.apache.cocoon.forms.formmodel.BooleanField;
  +import org.apache.cocoon.forms.formmodel.ContainerWidget;
   import org.apache.cocoon.forms.formmodel.Field;
   import org.apache.cocoon.forms.formmodel.MultiValueField;
   import org.apache.cocoon.forms.formmodel.Output;
  @@ -75,7 +76,7 @@
                   return true;
               }
           } else if (delegate != null) {
  -            Widget sub = delegate.getWidget(id);
  +            Widget sub = ((ContainerWidget)delegate).getWidget(id);
               if (sub != null) {
                   return true;
               }
  @@ -107,7 +108,7 @@
                   return new Integer(values.length);
               }
           } else if (delegate != null) {
  -            Widget sub = delegate.getWidget(id);
  +            Widget sub = ((ContainerWidget)delegate).getWidget(id);
               if (sub != null) {
                   if (sub instanceof Field ||
                       sub instanceof BooleanField ||
  @@ -190,7 +191,7 @@
                   }
               }
           } else if (delegate != null) {
  -            Widget sub = delegate.getWidget(id);
  +            Widget sub = ((ContainerWidget)delegate).getWidget(id);
               if (sub instanceof Field) {
                   Field field = (Field)sub;
                   value = unwrap(value);
  
  
  
  1.7       +4 -4      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java
  
  Index: ScriptableWidget.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ScriptableWidget.java	21 Apr 2004 13:33:37 -0000	1.6
  +++ ScriptableWidget.java	23 Apr 2004 13:02:31 -0000	1.7
  @@ -129,7 +129,7 @@
       public boolean has(String id, Scriptable start) {
           if (delegate != null) {
               if (!(delegate instanceof Repeater)) {
  -                Widget sub = delegate.getWidget(id);
  +                Widget sub = ((ContainerWidget)delegate).getWidget(id);
                   if (sub != null) {
                       return true;
                   }
  @@ -159,7 +159,7 @@
               return result;
           }
           if (delegate != null && !(delegate instanceof Repeater)) {
  -            Widget sub = delegate.getWidget(id);
  +            Widget sub = ((ContainerWidget)delegate).getWidget(id);
               if (sub != null) {
                   return wrap(sub);
               }
  @@ -499,7 +499,7 @@
       }
   
       public ScriptableWidget jsFunction_getWidget(String id) {
  -        Widget sub = delegate.getWidget(id);
  +        Widget sub = ((ContainerWidget)delegate).getWidget(id);
           return wrap(sub);
       }
   
  
  
  

Mime
View raw message