public abstract class Palette extends org.apache.tapestry.BaseComponent implements org.apache.tapestry.form.ValidatableField
This all takes a bit of JavaScript to accomplish (quite a bit), which means a Body
component must wrap the Palette. If JavaScript is not enabled in the client browser, then the
user will be unable to make (or change) any selections.
Cross-browser compatibility is not perfect. In some cases, the
MultiplePropertySelectioncomponent may be a better
choice.
| Parameter | Type | Direction | Required | Default | Description |
| selected | List |
in | yes | A List of selected values. Possible selections are defined by the model; this should be a
subset of the possible values. This may be null when the component is renderred. When the
containing form is submitted, this parameter is updated with a new List of selected objects.
The order may be set by the user, as well, depending on the sortMode parameter. |
|
| model | IPropertySelectionModel |
in | yes | Works, as with a PropertySelectioncomponent, to define the
possible values. |
|
| sort | string | in | no | SortMode.NONE |
Controls automatic sorting of the options. |
| rows | int | in | no | 10 | The number of rows that should be visible in the Pallete's <select> elements. |
| tableClass | String |
in | no | tapestry-palette | The CSS class for the table which surrounds the other elements of the Palette. |
| selectedTitleBlock | Block |
in | no | "Selected" | If specified, allows a Blockto be placed within the <th> reserved for the
title above the selected items <select> (on the right). This allows for images or other
components to be placed there. By default, the simple word Selected is used. |
| availableTitleBlock | Block |
in | no | "Available" | As with selectedTitleBlock, but for the left column, of items which are available to be
selected. The default is the word Available. |
| selectImage selectDisabledImage deselectImage deselectDisabledImage upImage upDisabledImage downImage downDisabledImage |
IAsset |
in | no | If any of these are specified then they override the default images provided with the
component. This allows the look and feel to be customized relatively easily.
The most common reason to replace the images is to deal with backgrounds. The default images are anti-aliased against a white background. If a colored or patterned background is used, the default images will have an ugly white fringe. Until all browsers have full support for PNG (which has a true alpha channel), it is necessary to customize the images to match the background. |
A Palette requires some CSS entries to render correctly ... especially the middle column, which contains the two or four buttons for moving selections between the two columns. The width and alignment of this column must be set using CSS. Additionally, CSS is commonly used to give the Palette columns a fixed width, and to dress up the titles. Here is an example of some CSS you can use to format the palette component:
TABLE.tapestry-palette TH
{
font-size: 9pt;
font-weight: bold;
color: white;
background-color: #330066;
text-align: center;
}
TD.available-cell SELECT
{
font-weight: normal;
background-color: #FFFFFF;
width: 200px;
}
TD.selected-cell SELECT
{
font-weight: normal;
background-color: #FFFFFF;
width: 200px;
}
TABLE.tapestry-palette TD.controls
{
text-align: center;
vertical-align: middle;
width: 60px;
}
As of 4.0, this component can be validated.
| Constructor and Description |
|---|
Palette() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
cleanupAfterRender(org.apache.tapestry.IRequestCycle cycle) |
abstract org.apache.tapestry.components.Block |
getAvailableTitleBlock() |
abstract org.apache.tapestry.IAsset |
getDeselectDisabledImage() |
abstract org.apache.tapestry.IAsset |
getDeselectImage() |
abstract org.apache.tapestry.IAsset |
getDownDisabledImage() |
abstract org.apache.tapestry.IAsset |
getDownImage() |
abstract java.lang.String |
getIdParameter() |
abstract org.apache.tapestry.form.IPropertySelectionModel |
getModel() |
abstract int |
getRows() |
abstract org.apache.tapestry.IScript |
getScript()
Injected.
|
abstract org.apache.tapestry.IAsset |
getSelectDisabledImage() |
abstract java.util.List |
getSelected() |
abstract org.apache.tapestry.components.Block |
getSelectedTitleBlock() |
abstract org.apache.tapestry.IAsset |
getSelectImage() |
abstract java.lang.String |
getSort() |
java.util.Map |
getSymbols() |
abstract org.apache.tapestry.IAsset |
getUpDisabledImage() |
abstract org.apache.tapestry.IAsset |
getUpImage() |
abstract org.apache.tapestry.form.ValidatableFieldSupport |
getValidatableFieldSupport()
Injected.
|
boolean |
isDisabled()
Returns false.
|
boolean |
isRequired() |
boolean |
isSortUser() |
protected void |
renderComponent(org.apache.tapestry.IMarkupWriter writer,
org.apache.tapestry.IRequestCycle cycle) |
protected void |
renderFormComponent(org.apache.tapestry.IMarkupWriter writer,
org.apache.tapestry.IRequestCycle cycle) |
protected void |
rewindFormComponent(org.apache.tapestry.IMarkupWriter writer,
org.apache.tapestry.IRequestCycle cycle) |
abstract void |
setAvailableColumn(PaletteColumn column) |
abstract void |
setClientId(java.lang.String clientId) |
abstract void |
setForm(org.apache.tapestry.IForm form) |
abstract void |
setName(java.lang.String name) |
abstract void |
setRequiredMessage(java.lang.String message) |
abstract void |
setSelected(java.util.List selected) |
abstract void |
setSelectedColumn(PaletteColumn column) |
addAsset, addBody, addComponent, checkActiveLock, enterActiveState, finishLoad, format, format, format, format, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getComponent, getComponents, getContainedComponent, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isInActiveState, isParameterBound, isRendering, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setProperty, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetClientId, getDisplayName, getForm, getNameaddAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isRendering, renderBody, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setPropertypublic Palette()
public abstract void setAvailableColumn(PaletteColumn column)
public abstract void setSelectedColumn(PaletteColumn column)
public abstract void setName(java.lang.String name)
setName in interface org.apache.tapestry.form.IFormComponentpublic abstract void setForm(org.apache.tapestry.IForm form)
public abstract void setRequiredMessage(java.lang.String message)
public abstract java.lang.String getIdParameter()
public abstract void setClientId(java.lang.String clientId)
protected void renderComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
renderComponent in class org.apache.tapestry.BaseComponentprotected void renderFormComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
protected void rewindFormComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
protected void cleanupAfterRender(org.apache.tapestry.IRequestCycle cycle)
cleanupAfterRender in class org.apache.tapestry.AbstractComponentpublic java.util.Map getSymbols()
public boolean isSortUser()
public abstract org.apache.tapestry.components.Block getAvailableTitleBlock()
public abstract org.apache.tapestry.IAsset getDeselectDisabledImage()
public abstract org.apache.tapestry.IAsset getDeselectImage()
public abstract org.apache.tapestry.IAsset getDownDisabledImage()
public abstract org.apache.tapestry.IAsset getDownImage()
public abstract org.apache.tapestry.IAsset getSelectDisabledImage()
public abstract org.apache.tapestry.form.IPropertySelectionModel getModel()
public abstract int getRows()
public abstract org.apache.tapestry.components.Block getSelectedTitleBlock()
public abstract org.apache.tapestry.IAsset getSelectImage()
public abstract java.lang.String getSort()
public abstract org.apache.tapestry.IAsset getUpDisabledImage()
public abstract org.apache.tapestry.IAsset getUpImage()
public boolean isDisabled()
isDisabled in interface org.apache.tapestry.form.IFormComponentpublic abstract java.util.List getSelected()
public abstract void setSelected(java.util.List selected)
public abstract org.apache.tapestry.IScript getScript()
public abstract org.apache.tapestry.form.ValidatableFieldSupport getValidatableFieldSupport()
public boolean isRequired()
isRequired in interface org.apache.tapestry.form.IFormComponentAbstractFormComponent.isRequired()