tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/palette Palette.properties Palette.jwc Palette.html Palette.java
Date Mon, 17 Mar 2003 18:10:15 GMT
hlship      2003/03/17 10:10:15

  Modified:    contrib/src/org/apache/tapestry/contrib/palette Palette.jwc
                        Palette.html Palette.java
  Added:       contrib/src/org/apache/tapestry/contrib/palette
                        Palette.properties
  Log:
  Update Palette template layout.  Add parameter for pixel width of the controls column.
  
  Revision  Changes    Path
  1.2       +6 -1      jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/palette/Palette.jwc
  
  Index: Palette.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/palette/Palette.jwc,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Palette.jwc	5 Mar 2003 23:02:33 -0000	1.1
  +++ Palette.jwc	17 Mar 2003 18:10:15 -0000	1.2
  @@ -43,6 +43,8 @@
     	type="java.lang.String" 
     	required="no"
     	direction="in"/>
  +  	
  +  <parameter name="controlsWidth" type="int" direction="in"/>
     
     <parameter name="selectImage" type="org.apache.tapestry.IAsset" direction="in"/>
     <parameter name="selectDisabledImage" type="org.apache.tapestry.IAsset" direction="in"/>
  @@ -53,6 +55,9 @@
     <parameter name="downImage" type="org.apache.tapestry.IAsset" direction="in"/>
     <parameter name="downDisabledImage" type="org.apache.tapestry.IAsset" direction="in"/>
       
  +  <property-specification name="name" type="java.lang.String"/>
  +  <property-specification name="form" type="org.apache.tapestry.IForm"/>
  +  
     <private-asset name="Select" resource-path="select_right.gif"/>
     <private-asset name="SelectDisabled" resource-path="select_right_off.gif"/>
     <private-asset name="Deselect" resource-path="deselect_left.gif"/>
  
  
  
  1.2       +12 -12    jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/palette/Palette.html
  
  Index: Palette.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/palette/Palette.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Palette.html	5 Mar 2003 23:02:33 -0000	1.1
  +++ Palette.html	17 Mar 2003 18:10:15 -0000	1.2
  @@ -5,41 +5,41 @@
     <tr>
     	<th>
    <span jwcid="@RenderBlock" block="ognl:availableTitleBlock"/>
  - <span jwcid="defaultAvailableTitleBlock@Block">Available</span>
  + <span jwcid="defaultAvailableTitleBlock@Block"><span key="title.available"/></span>
   </th>
  -  	<td class="controls" rowspan=2>
  +  	<td jwcid="@Any" element="td" class="controls" rowspan="2" width="ognl:controlsWidth"
align="center" valign="center">
     	    <a jwcid="@Any" 
     	    	element="a" 
     	    	href="ognl:symbols.selectOnClickScript"><img jwcid="@Image"
     	    		image="ognl:selectImage"
     	    		name="ognl:symbols.selectImageName"
  -  	    		alt="[Select]"/></a>
  -    <br>
  +  	    		alt="string:tooltip.select"/></a>
  +
       <a jwcid="@Any" element="a"
       	href="ognl:symbols.deselectOnClickScript"><img jwcid="@Image"
       		image="ognl:deselectImage"
       		name="ognl:symbols.deselectImageName"
  -    		alt="[Deselect]"/></a>
  +    		alt="string:tooltip.deselect"/></a>
       
       <span jwcid="@Conditional" condition="ognl:sortUser">
  -    <br/>
  +
       <a jwcid="@Any" element="a"
       	href="ognl:symbols.upOnClickScript"><img jwcid="@Image" 
       		image="ognl:upImage"
       		name="ognl:symbols.upImageName"
  -    		alt="[Move Up]"/></a>
  -    <br/>
  +    		alt="string:tooltip.moveup"/></a>
  +
       <a jwcid="@Any" element="a"
       	href="ognl:symbols.downOnClickScript"><img jwcid="@Image"
       		image="ognl:downImage"
       		name="ognl:symbols.downImageName"
  -    		alt="[Move Down]"/></a>
  +    		alt="string:tooltip.movedown"/></a>
       </span>
  -    
  +
       </td>
     	<th>
    <span jwcid="@RenderBlock" block="ognl:selectedTitleBlock"/>
  - <span jwcid="defaultSelectedTitleBlock@Block">Selected</span>
  + <span jwcid="defaultSelectedTitleBlock@Block"><span key="title.selected"/></span>
       </th>
     </tr>
     <tr>
  
  
  
  1.3       +26 -36    jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/palette/Palette.java
  
  Index: Palette.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/palette/Palette.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Palette.java	15 Mar 2003 21:22:29 -0000	1.2
  +++ Palette.java	17 Mar 2003 18:10:15 -0000	1.3
  @@ -83,6 +83,7 @@
   import org.apache.tapestry.form.IPropertySelectionModel;
   import org.apache.tapestry.html.Body;
   import org.apache.tapestry.request.RequestContext;
  +import org.apache.tapestry.valid.IValidationDelegate;
   
   /**
    *  A component used to make a number of selections from a list.  The general look
  @@ -221,20 +222,6 @@
       private static final String DEFAULT_TABLE_CLASS = "tapestry-palette";
   
       /**
  -     *  {@link IForm} which is currently wrapping the Palette.
  -     *
  -     **/
  -
  -    private IForm _form;
  -
  -    /**
  -     *  The element name assigned to this usage of the Palette by the Form.
  -     *
  -     **/
  -
  -    private String _name;
  -
  -    /**
        *  A set of symbols produced by the Palette script.  This is used to
        *  provide proper names for some of the HTML elements (&lt;select&gt; and
        *  &lt;button&gt; elements, etc.).
  @@ -283,34 +270,35 @@
           setTableClass(DEFAULT_TABLE_CLASS);
           setRows(DEFAULT_ROWS);
           setSort(SortMode.NONE);
  +        setControlsWidth(60);
       }
   
  -    /**
  -     *  Returns the name used for the selected (right column) &lt;select&gt; element.
  -     **/
  -
  -    public String getName()
  -    {
  -        return _name;
  -    }
  -
  -    public IForm getForm()
  -    {
  -        return _form;
  -    }
   
  +    public abstract String getName();
  +    public abstract void setName(String name);
  +    
  +    public abstract IForm getForm();
  +    public abstract void setForm(IForm form);
  +    
       protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
       {
  -        _form = Form.get(getPage().getRequestCycle());
  +        IForm form  = Form.get(getPage().getRequestCycle());
   
  -        if (_form == null)
  +        if (form == null)
               throw new ApplicationRuntimeException(
                   "Palette component must be wrapped by a Form.",
                   this);
  +                
  +		setForm(form);
  +		
  +    	IValidationDelegate delegate = form.getDelegate();
  +    	
  +    	if (delegate != null)
  +    		delegate.setFormComponent(this);
   
  -        _name = _form.getElementId(this);
  +        setName(form.getElementId(this));
   
  -        if (_form.isRewinding())
  +        if (form.isRewinding())
           {
               handleSubmission(cycle);
               return;
  @@ -333,7 +321,7 @@
           // is submitted.  This is also key to the operation
           // of the PropertySelection.
   
  -        _form.addEventHandler(
  +        form.addEventHandler(
               FormEventType.SUBMIT,
               (String) _symbols.get("formSubmitFunctionName"));
   
  @@ -349,7 +337,6 @@
       {
           _availableWriter = null;
           _selectedWriter = null;
  -        _form = null;
           _symbols = null;
   
           super.cleanupAfterRender(cycle);
  @@ -445,7 +432,7 @@
           _selectedWriter.begin("select");
           _selectedWriter.attribute("multiple");
           _selectedWriter.attribute("size", getRows());
  -        _selectedWriter.attribute("name", _name);
  +        _selectedWriter.attribute("name", getName());
           _selectedWriter.println();
   
           _availableWriter.begin("select");
  @@ -520,7 +507,7 @@
       {
   
           RequestContext context = cycle.getRequestContext();
  -        String[] values = context.getParameters(_name);
  +        String[] values = context.getParameters(getName());
   
           int count = Tapestry.size(values);
   
  @@ -628,4 +615,7 @@
   
       public abstract void setSelected(List selected);
   
  +	/** @since 2.4 **/
  +	
  +	public abstract void setControlsWidth(int controlsWidth);
   }
  
  
  
  1.1                  jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/palette/Palette.properties
  
  Index: Palette.properties
  ===================================================================
  # $Id: Palette.properties,v 1.1 2003/03/17 18:10:15 hlship Exp $
  title.available=Available
  title.selected=Selected
  
  tooltip.select=[Select]
  tooltip.deselect=[Deselect]
  tooltip.moveup=[Move Up]
  tooltip.movedown=[Move Down]
  
  

Mime
View raw message