You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by mi...@apache.org on 2003/12/29 01:21:03 UTC

cvs commit: jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/form FormConditional.java FormConditional.jwc

mindbridge    2003/12/28 16:21:03

  Modified:    contrib/src/org/apache/tapestry/contrib/form
                        FormConditional.java FormConditional.jwc
  Log:
  Removing the 'invert' parameter from FormConditional and marking it as reserved.
  Invert is unnecessary since OGNL is used, and removing it greatly cuts down 
  on the hidden fieds in the form.
  
  Revision  Changes    Path
  1.2       +3 -29     jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/form/FormConditional.java
  
  Index: FormConditional.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/form/FormConditional.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FormConditional.java	6 Sep 2003 14:04:43 -0000	1.1
  +++ FormConditional.java	29 Dec 2003 00:21:03 -0000	1.2
  @@ -104,15 +104,14 @@
           String name = form.getElementId(this);
   
           boolean condition = getCondition(cycle, form, name);
  -        boolean invert = getInvert(cycle, form, name);
   
           // call listener
           IActionListener listener = getListener();
           if (listener != null)
               listener.actionTriggered(this, cycle);
   
  -        // render the component body only if the condition is different from the invert
  -        if (condition != invert) {
  +        // render the component body only if the condition is true
  +        if (condition) {
               String element = getElement();
               
               boolean render = cycleRewinding && StringUtils.isNotEmpty(element);
  @@ -153,29 +152,6 @@
           return condition;
       }
   
  -    private boolean getInvert(IRequestCycle cycle, IForm form, String name)
  -    {
  -        boolean invert;
  -        
  -        if (!cycle.isRewinding())
  -        {
  -            invert = getInvert();
  -            writeValue(form, name, invert);
  -        }
  -        else
  -        {
  -            RequestContext context = cycle.getRequestContext();
  -            String submittedConditions[] = context.getParameters(name);
  -            invert = convertValue(submittedConditions[1]);
  -        }
  -
  -        IBinding invertValueBinding = getInvertValueBinding();
  -        if (invertValueBinding != null) 
  -            invertValueBinding.setBoolean(invert);
  -        
  -        return invert;
  -    }
  -
       private void writeValue(IForm form, String name, boolean value)
       {
           String externalValue;
  @@ -225,11 +201,9 @@
       }
   
       public abstract boolean getCondition();
  -    public abstract boolean getInvert();
       public abstract String getElement();
   
       public abstract IBinding getConditionValueBinding();
  -    public abstract IBinding getInvertValueBinding();
   
       public abstract IActionListener getListener();
   
  
  
  
  1.2       +2 -15     jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/form/FormConditional.jwc
  
  Index: FormConditional.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/form/FormConditional.jwc,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FormConditional.jwc	6 Sep 2003 14:04:43 -0000	1.1
  +++ FormConditional.jwc	29 Dec 2003 00:21:03 -0000	1.2
  @@ -15,14 +15,6 @@
       </description>
     </parameter>
     
  -  <parameter name="invert" type="boolean" direction="in">
  -    <description>
  -    If true, inverts the condition, so that a false condition causes the 
  -    content to be included.  If false (the default), then the condition
  -    is evaluated normally.
  -    </description>
  -  </parameter>
  -
     <parameter name="element" type="java.lang.String" direction="in" required="no">
     	<description>
     	The element to emulate.
  @@ -38,12 +30,7 @@
       </description>
     </parameter>
   
  -  <parameter name="invertValue" type="boolean">
  -    <description>
  -    Whether the condition is inverted or not. During render this is a obtained from 
  -    the invert parameter. Diring rewind it is the submited value of invert.
  -    </description>
  -  </parameter>
  +  <reserved-parameter name="invert"/>
     
     <property-specification name="name" type="java.lang.String"/>
     <property-specification name="form" type="org.apache.tapestry.IForm"/>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org