org.apache.tapestry5.corelib.components
Class Palette

java.lang.Object
  extended by org.apache.tapestry5.corelib.base.AbstractField
      extended by org.apache.tapestry5.corelib.components.Palette
All Implemented Interfaces:
ClientElement, Field

@IncludeJavaScriptLibrary(value="palette.js")
public class Palette
extends AbstractField

Multiple selection component. Generates a UI consisting of two <select> elements configured for multiple selection; the one on the left is the list of "available" elements, the one on the right is "selected". Elements can be moved between the lists by clicking a button, or double clicking an option (and eventually, via drag and drop).

The items in the available list are kept ordered as per SelectModel order. When items are moved from the selected list to the available list, they items are inserted back into their proper positions.

The Palette may operate in normal or re-orderable mode, controlled by the reorder parameter.

In normal mode, the items in the selected list are kept in the same "natural" order as the items in the available list.

In re-order mode, items moved to the selected list are simply added to the bottom of the list. In addition, two extra buttons appear to move items up and down within the selected list.

Much of the look and feel is driven by CSS, the default Tapestry CSS is used to set up the columns, etc. By default, the <select> element's widths are 200px, and it is common to override this to a specific value:

 <style>
 DIV.t-palette SELECT { width: 300px; }
 </style>
 

You'll want to ensure that both <select> in each column is the same width, otherwise the display will update poorly as options are moved from one column to the other.

Option groups within the SelectModel will be rendered, but are not supported by many browsers, and are not fully handled on the client side.


Constructor Summary
Palette()
           
 
Method Summary
 Renderable getAvailableRenderer()
           
 Renderable getSelectedRenderer()
           
protected  void processSubmission(String elementName)
          Method implemented by subclasses to actually do the work of processing the submission of the form.
 
Methods inherited from class org.apache.tapestry5.corelib.base.AbstractField
createDefaultParameterBinding, decorateInsideField, getClientId, getControlName, getLabel, isDisabled, isRequired, setDecorator, setFormSupport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Palette

public Palette()
Method Detail

getAvailableRenderer

public Renderable getAvailableRenderer()

getSelectedRenderer

public Renderable getSelectedRenderer()

processSubmission

protected void processSubmission(String elementName)
Description copied from class: AbstractField
Method implemented by subclasses to actually do the work of processing the submission of the form. The element's elementName property will already have been set. This method is only invoked if the field is not disabled.

Specified by:
processSubmission in class AbstractField
Parameters:
elementName - the name of the element (used to find the correct parameter in the request)


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.