T - Type of model objectpublic class Palette<T> extends FormComponentPanel<Collection<T>>
When creating a Palette object make sure your IChoiceRenderer returns a specific ID, not the index.
Ajaxifying the palette: If you want to update a Palette with an
AjaxFormComponentUpdatingBehavior, you have to attach it to the contained
Recorder by overriding newRecorderComponent() and calling
FormComponent.processInput():
Palette palette=new Palette(...) {
protected Recorder newRecorderComponent()
{
Recorder recorder=super.newRecorderComponent();
recorder.add(new AjaxFormComponentUpdatingBehavior("change") {
processInput() // let palette process input too
...
});
return recorder;
}
}
You can add a DefaultTheme to style this component in a left to right fashion.FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, VALUE_SEPARATORENABLE, FLAG_AFTER_RENDERING, FLAG_INITIALIZED, FLAG_PREPARED_FOR_RENDER, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RENDERING, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING| Constructor and Description |
|---|
Palette(String id,
IModel<? extends Collection<T>> choicesModel,
IChoiceRenderer<? super T> choiceRenderer,
int rows,
boolean allowOrder) |
Palette(String id,
IModel<? extends Collection<T>> model,
IModel<? extends Collection<? extends T>> choicesModel,
IChoiceRenderer<? super T> choiceRenderer,
int rows,
boolean allowOrder) |
Palette(String id,
IModel<? extends Collection<T>> model,
IModel<? extends Collection<? extends T>> choicesModel,
IChoiceRenderer<? super T> choiceRenderer,
int rows,
boolean allowOrder,
boolean allowMoveAll)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildJSCall(String funcName)
builds javascript handler call
|
void |
convertInput() |
String |
getAddAllOnClickJS() |
protected Map<String,String> |
getAdditionalAttributesForChoices(Object choice) |
protected Map<String,String> |
getAdditionalAttributesForSelection(Object choice) |
String |
getAddOnClickJS() |
IChoiceRenderer<? super T> |
getChoiceRenderer() |
Collection<? extends T> |
getChoices() |
protected Component |
getChoicesComponent() |
String |
getChoicesOnFocusJS() |
String |
getDownOnClickJS() |
Collection<T> |
getModelCollection() |
Recorder<T> |
getRecorderComponent()
Returns recorder component.
|
String |
getRemoveAllOnClickJS() |
String |
getRemoveOnClickJS() |
int |
getRows() |
Iterator<T> |
getSelectedChoices() |
protected Component |
getSelectionComponent() |
String |
getSelectionOnFocusJS() |
Iterator<T> |
getUnselectedChoices() |
String |
getUpOnClickJS() |
boolean |
isPaletteEnabled()
Return true if the palette is enabled, false otherwise
|
protected boolean |
localizeDisplayValues()
Override this method if you do not want to localize the display values of
the generated options.
|
protected Component |
newAddAllComponent()
factory method for the addAll component
|
protected Component |
newAddComponent()
factory method for the addcomponent
|
protected Component |
newAvailableHeader(String componentId)
factory method for the available items header
|
protected Component |
newChoicesComponent()
factory method for the available items component
|
protected Component |
newDownComponent()
factory method for the move down component
|
protected Recorder<T> |
newRecorderComponent()
factory method to create the tracker component
|
protected Component |
newRemoveAllComponent()
factory method for the removeAll component
|
protected Component |
newRemoveComponent()
factory method for the remove component
|
protected Component |
newSelectedHeader(String componentId)
factory method for the selected items header
|
protected Component |
newSelectionComponent()
factory method for the selected items component
|
protected Component |
newUpComponent()
factory method for the move up component
|
protected void |
onBeforeRender() |
protected void |
onDetach() |
void |
renderHead(IHeaderResponse response)
Renders header contributions
|
void |
updateModel()
The model object is assumed to be a Collection, and it is modified in-place.
|
checkRequired, newMarkupSourcingStrategy, onComponentTagadd, add, clearInput, convertValue, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInput, getInputAsArray, getInputName, getModel, getModelObject, getModelValue, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, newValidationError, onDisabled, onInvalid, onRequired, onValid, processChildren, processInput, remove, reportRequiredError, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setRequired, setType, shouldTrimInput, trim, updateAutoLabels, updateCollectionModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrdergetLabelgetWebPage, getWebRequest, getWebResponse, getWebSessionadd, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findComponentToDequeue, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onAfterRenderChildren, onComponentTagBody, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildrenadd, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalPrepareForRender, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrapclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdequeue, getRegionMarkup, newDequeueContextpublic Palette(String id, IModel<? extends Collection<T>> choicesModel, IChoiceRenderer<? super T> choiceRenderer, int rows, boolean allowOrder)
id - Component idchoicesModel - Model representing collection of all available choiceschoiceRenderer - Render used to render choices. This must use unique IDs for the objects, not the
index.rows - Number of choices to be visible on the screen with out scrollingallowOrder - Allow user to move selections up and downpublic Palette(String id, IModel<? extends Collection<T>> model, IModel<? extends Collection<? extends T>> choicesModel, IChoiceRenderer<? super T> choiceRenderer, int rows, boolean allowOrder)
id - Component idmodel - Model representing collection of user's selectionschoicesModel - Model representing collection of all available choiceschoiceRenderer - Render used to render choices. This must use unique IDs for the objects, not the
index.rows - Number of choices to be visible on the screen with out scrollingallowOrder - Allow user to move selections up and downpublic Palette(String id, IModel<? extends Collection<T>> model, IModel<? extends Collection<? extends T>> choicesModel, IChoiceRenderer<? super T> choiceRenderer, int rows, boolean allowOrder, boolean allowMoveAll)
id - Component idchoicesModel - Model representing collection of all available choiceschoiceRenderer - Render used to render choices. This must use unique IDs for the objects, not the
index.rows - Number of choices to be visible on the screen with out scrollingallowOrder - Allow user to move selections up and downallowMoveAll - Allow user to add or remove all items at onceprotected void onBeforeRender()
onBeforeRender in class Componentpublic final boolean isPaletteEnabled()
public Iterator<T> getUnselectedChoices()
protected Recorder<T> newRecorderComponent()
protected Component newAvailableHeader(String componentId)
componentId - component id of the returned header componentprotected Component newSelectedHeader(String componentId)
componentId - component id of the returned header componentprotected Component newDownComponent()
protected Component newUpComponent()
protected Component newRemoveComponent()
protected Component newAddComponent()
protected Component newSelectionComponent()
protected Component newAddAllComponent()
protected Component newRemoveAllComponent()
protected Map<String,String> getAdditionalAttributesForSelection(Object choice)
choice - AbstractOptions.getAdditionalAttributes(Object)protected Component newChoicesComponent()
protected boolean localizeDisplayValues()
protected Map<String,String> getAdditionalAttributesForChoices(Object choice)
choice - AbstractOptions.getAdditionalAttributes(Object)protected Component getChoicesComponent()
protected Component getSelectionComponent()
public final Recorder<T> getRecorderComponent()
onchange javascript event whenever a
change in selection occurs.public Collection<? extends T> getChoices()
public Collection<T> getModelCollection()
public IChoiceRenderer<? super T> getChoiceRenderer()
public int getRows()
public void convertInput()
convertInput in class FormComponent<Collection<T>>public final void updateModel()
Model.setObject(Object) is called with the same instance: it allows the Model to be
notified of changes even when Model.getObject() returns a different
Collection at every invocation.updateModel in interface IFormModelUpdateListenerupdateModel in class FormComponent<Collection<T>>FormComponent.updateModel()protected String buildJSCall(String funcName)
funcName - name of javascript function to callpublic String getChoicesOnFocusJS()
public String getSelectionOnFocusJS()
public String getAddOnClickJS()
public String getRemoveOnClickJS()
public String getUpOnClickJS()
public String getDownOnClickJS()
public String getAddAllOnClickJS()
public String getRemoveAllOnClickJS()
protected void onDetach()
onDetach in class FormComponent<Collection<T>>public void renderHead(IHeaderResponse response)
renderHead in interface IHeaderContributorrenderHead in class Componentresponse - Copyright © 2006–2015 Apache Software Foundation. All rights reserved.