|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hivemind.impl.BaseLocatable org.apache.tapestry.AbstractComponent org.apache.tapestry.BaseComponent net.sf.tacos.ajax.components.palette.Palette
public abstract class Palette
A component used to make a number of selections from a list. The general look is a pair of <select> elements. with a pair of buttons between them. The right element is a list of values that can be selected. The buttons move values from the right column ("available") to the left column ("selected").
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
org.apache.tapestry.contrib.form.MultiplePropertySelection
component
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 PropertySelection component,
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 Block to 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 Summary | |
---|---|
Palette()
|
Method Summary | |
---|---|
protected void |
cleanupAfterRender(org.apache.tapestry.IRequestCycle cycle)
|
abstract org.apache.tapestry.components.Block |
getAvailableTitleBlock()
Block parameter |
abstract org.apache.tapestry.IAsset |
getDeselectDisabledImage()
param |
abstract org.apache.tapestry.IAsset |
getDeselectImage()
param |
abstract org.apache.tapestry.IAsset |
getDownDisabledImage()
param |
abstract org.apache.tapestry.IAsset |
getDownImage()
param |
abstract String |
getIdParameter()
|
abstract org.apache.tapestry.form.IPropertySelectionModel |
getModel()
param |
abstract int |
getRows()
param |
abstract org.apache.tapestry.IScript |
getScript()
Injected. |
abstract org.apache.tapestry.IAsset |
getSelectDisabledImage()
param |
abstract List |
getSelected()
|
abstract org.apache.tapestry.components.Block |
getSelectedTitleBlock()
param |
abstract org.apache.tapestry.IAsset |
getSelectImage()
param |
abstract String |
getSort()
param |
Map |
getSymbols()
Script symbols |
abstract org.apache.tapestry.IAsset |
getUpDisabledImage()
param |
abstract org.apache.tapestry.IAsset |
getUpImage()
param |
abstract org.apache.tapestry.form.ValidatableFieldSupport |
getValidatableFieldSupport()
Injected. |
boolean |
isDisabled()
Returns false. |
boolean |
isRequired()
|
boolean |
isSortUser()
Is user sort specified? |
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)
Renders form component |
protected void |
rewindFormComponent(org.apache.tapestry.IMarkupWriter writer,
org.apache.tapestry.IRequestCycle cycle)
Rewinds form component |
abstract void |
setAvailableColumn(PaletteColumn column)
|
abstract void |
setClientId(String clientId)
|
abstract void |
setForm(org.apache.tapestry.IForm form)
Sets form object |
abstract void |
setName(String name)
Sets form name |
abstract void |
setRequiredMessage(String message)
|
abstract void |
setSelected(List selected)
|
abstract void |
setSelectedColumn(PaletteColumn column)
|
Methods inherited from class org.apache.tapestry.BaseComponent |
---|
addOuter, finishLoad |
Methods inherited from class org.apache.tapestry.AbstractComponent |
---|
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, toString |
Methods inherited from class org.apache.hivemind.impl.BaseLocatable |
---|
getLocation, setLocation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.tapestry.form.ValidatableField |
---|
getValidators |
Methods inherited from interface org.apache.tapestry.form.IFormComponent |
---|
getClientId, getDisplayName, getForm, getName |
Methods inherited from interface org.apache.tapestry.IComponent |
---|
addAsset, 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, setProperty |
Methods inherited from interface org.apache.tapestry.IRender |
---|
render |
Methods inherited from interface org.apache.hivemind.LocationHolder |
---|
setLocation |
Methods inherited from interface org.apache.hivemind.Locatable |
---|
getLocation |
Constructor Detail |
---|
public Palette()
Method Detail |
---|
public abstract void setAvailableColumn(PaletteColumn column)
public abstract void setSelectedColumn(PaletteColumn column)
public abstract void setName(String name)
setName
in interface org.apache.tapestry.form.IFormComponent
public abstract void setForm(org.apache.tapestry.IForm form)
public abstract void setRequiredMessage(String message)
public abstract String getIdParameter()
public abstract void setClientId(String clientId)
protected void renderComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
renderComponent
in class org.apache.tapestry.BaseComponent
protected void renderFormComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
writer
- cycle
- protected void rewindFormComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
writer
- cycle
- protected void cleanupAfterRender(org.apache.tapestry.IRequestCycle cycle)
cleanupAfterRender
in class org.apache.tapestry.AbstractComponent
public 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 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.IFormComponent
public abstract List getSelected()
public abstract void setSelected(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.IFormComponent
AbstractFormComponent.isRequired()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |