You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ti...@apache.org on 2003/12/19 21:36:48 UTC

cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel AbstractWidget.java

tim         2003/12/19 12:36:48

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/formmodel
                        AbstractWidget.java
  Log:
  Optimize getForm by allowing each parent a chance to cache the form.
  
  Revision  Changes    Path
  1.5       +5 -11     cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidget.java
  
  Index: AbstractWidget.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidget.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractWidget.java	24 Sep 2003 20:47:06 -0000	1.4
  +++ AbstractWidget.java	19 Dec 2003 20:36:48 -0000	1.5
  @@ -67,21 +67,15 @@
       public void setParent(Widget widget) {
           this.parent = widget;
       }
  -    
  +
       public Form getForm() {
           if (this.form == null) {
  -            // Find the form
  -            Widget current = this;
  -            Widget parent;
  -        
  -            while((parent = current.getParent()) != null) {
  -                current = parent;
  +            if (parent == null) {
  +                this.form = (Form)this;
  +            } else {
  +                this.form = parent.getForm();
               }
  -            
  -            // And keep it locally
  -            this.form = (Form)current;
           }
  -        
           return this.form;
       }