You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ds...@apache.org on 2004/04/16 02:28:36 UTC

cvs commit: jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/components Otherwise.jwc Choose.java Choose.jwc

dsolis      2004/04/15 17:28:36

  Modified:    .        status.xml
               doc/src/ComponentReference contrib.Otherwise.html
                        contrib.Choose.html
               contrib/src/org/apache/tapestry/contrib/components
                        Otherwise.jwc Choose.java Choose.jwc
  Log:
  Fix bug 28422 (Add element parameter to contrib:Choose)
  
  Revision  Changes    Path
  1.46      +5 -1      jakarta-tapestry/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/status.xml,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- status.xml	15 Apr 2004 23:26:37 -0000	1.45
  +++ status.xml	16 Apr 2004 00:28:36 -0000	1.46
  @@ -247,6 +247,10 @@
    		Add FormConditional to Component Reference   	
    	</action>
   
  + 	<action type="fix" dev="DS" fixes-bug="28422">
  + 		Add element parameter to contrib:Choose   	
  + 	</action>
  +
    	</release>
     	
   <!-- Use due-to to give acknowledgement for patches. -->
  
  
  
  1.4       +4 -3      jakarta-tapestry/doc/src/ComponentReference/contrib.Otherwise.html
  
  Index: contrib.Otherwise.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/doc/src/ComponentReference/contrib.Otherwise.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- contrib.Otherwise.html	10 Mar 2004 00:35:32 -0000	1.3
  +++ contrib.Otherwise.html	16 Apr 2004 00:28:36 -0000	1.4
  @@ -89,9 +89,10 @@
                     to the tag. If no element is specified, informal parameters 
                     are ignored.</td>
                 </tr>
  -            </table>          <p> Body: <strong>rendered</strong><br>
  +            </table>          
  +            <p> Body: <strong>rendered</strong><br>
                 Informal parameters: <strong>allowed</strong><br>
  -              Reserved parameters: none </p>    
  +              Reserved parameters: condition</p>    
    </td>
   </tr>
   
  
  
  
  1.6       +25 -9     jakarta-tapestry/doc/src/ComponentReference/contrib.Choose.html
  
  Index: contrib.Choose.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/doc/src/ComponentReference/contrib.Choose.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- contrib.Choose.html	15 Apr 2004 23:36:16 -0000	1.5
  +++ contrib.Choose.html	16 Apr 2004 00:28:36 -0000	1.6
  @@ -91,14 +91,30 @@
    <td colspan="2">
     <b>Parameters</b>
   	<br>
  -  None
  -  <p>
  -  Body: <STRONG>rendered<BR></STRONG>
  -  Informal parameters: 
  -            <STRONG>forbidden</STRONG>
  -     <br>
  -  Reserved 
  -            parameters: <EM>none</EM></p>
  +            <table border="1" cellpadding="4" cellspacing="4" class="parameters">
  +              <tr> 
  +                <th>Name</th>
  +                <th>Type</th>
  +                <th>Direction</th>
  +                <th>Required</th>
  +                <th>Default</th>
  +                <th>Description</th>
  +              </tr>
  +              <tr> 
  +                <td>element</td>
  +                <td>String</td>
  +                <td>in</td>
  +                <td>no</td>
  +                <td>&nbsp;</td>
  +                <td>If specified, then the component acts like an <a href="Any.html">Any</a>, 
  +                  emitting an open and close tag. Informal parameters are applied 
  +                  to the tag. If no element is specified, informal parameters 
  +                  are ignored.</td>
  +              </tr>
  +            </table>
  +            <p> Body: <STRONG>rendered<BR>
  +              </STRONG> Informal parameters: <strong>allowed</strong><br>
  +              Reserved parameters: <EM>none</EM></p>
       
    </td>
   </tr>
  
  
  
  1.3       +3 -1      jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/components/Otherwise.jwc
  
  Index: Otherwise.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/components/Otherwise.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Otherwise.jwc	29 Feb 2004 18:49:12 -0000	1.2
  +++ Otherwise.jwc	16 Apr 2004 00:28:36 -0000	1.3
  @@ -31,6 +31,8 @@
     	</description>
     </parameter>
   
  +  <reserved-parameter name="condition"/>
  +
     <property-specification name="condition" type="boolean" initial-value="true"/>
     
   </component-specification>
  
  
  
  1.6       +17 -1     jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/components/Choose.java
  
  Index: Choose.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/components/Choose.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Choose.java	19 Feb 2004 17:38:09 -0000	1.5
  +++ Choose.java	16 Apr 2004 00:28:36 -0000	1.6
  @@ -18,6 +18,7 @@
   import org.apache.tapestry.IMarkupWriter;
   import org.apache.tapestry.IRender;
   import org.apache.tapestry.IRequestCycle;
  +import org.apache.tapestry.Tapestry;
   
   /**
    *  This component is a container for {@link When} or Otherwise components;
  @@ -42,7 +43,20 @@
   	/**  Renders its wrapped components. */
   	protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
   	{
  +		String element = getElement();
  +			
  +		boolean render = !cycle.isRewinding() && Tapestry.isNonBlank(element);
  +			
  +		if (render)
  +		{
  +			writer.begin(element);
  +			renderInformalParameters(writer, cycle);
  +		}
  +
   		renderBody(writer, cycle);
  +			
  +		if (render)
  +			writer.end(element);
   	}
   	
   	protected void cleanupAfterRender(IRequestCycle cycle)
  @@ -53,4 +67,6 @@
   	
   	public abstract boolean isConditionMet();
   	public abstract void setConditionMet(boolean value);
  +
  +	public abstract String getElement();
   }
  
  
  
  1.3       +8 -2      jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/components/Choose.jwc
  
  Index: Choose.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/components/Choose.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Choose.jwc	29 Feb 2004 18:49:11 -0000	1.2
  +++ Choose.jwc	16 Apr 2004 00:28:36 -0000	1.3
  @@ -19,11 +19,17 @@
     "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
     "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
     
  -<component-specification class="org.apache.tapestry.contrib.components.Choose" allow-informal-parameters="no">
  +<component-specification class="org.apache.tapestry.contrib.components.Choose">
   
     <description>
     Provides the context for mutually exclusive conditional evaluation.
     </description>
  +
  +  <parameter name="element" type="java.lang.String" direction="in" required="no">
  +  	<description>
  +  	The element to emulate.
  +  	</description>
  +  </parameter>
     
     <property-specification name="conditionMet" type="boolean" initial-value="false"/>
     
  
  
  

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