|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
org.apache.wicket.markup.html.panel.Panel
org.apache.wicket.extensions.markup.html.form.palette.Palette<T>
T
- Type of model objectpublic class Palette<T>
Palette is a component that allows the user to easily select and order multiple items by moving them from one select box into another.
When creating a Palette object make sure your IChoiceRenderer returns a specific ID, not the index.
Ajaxifying the palette: The palette itself cannot be ajaxified because it is a
panel and therefore does not receive any javascript events. Instead ajax behaviors can be
attached to the recorder component which supports the javascript onchange
event. The
behavior should be attached by overriding newRecorderComponent()
Example:
Form form=new Form(...); Palette palette=new Palette(...) { protected Recorder newRecorderComponent() { Recorder recorder=super.newRecorderComponent(); recorder.add(new AjaxFormComponentUpdatingBehavior("onchange") {...}); return recorder; } }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange |
Field Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
Palette(String id,
IModel<? extends Collection<? extends T>> choicesModel,
IChoiceRenderer<T> choiceRenderer,
int rows,
boolean allowOrder)
|
|
Palette(String id,
IModel<List<T>> model,
IModel<? extends Collection<? extends T>> choicesModel,
IChoiceRenderer<T> choiceRenderer,
int rows,
boolean allowOrder)
|
Method Summary | |
---|---|
protected String |
buildJSCall(String funcName)
builds javascript handler call |
protected Map<String,String> |
getAdditionalAttributesForChoices(Object choice)
|
protected Map<String,String> |
getAdditionalAttributesForSelection(Object choice)
|
String |
getAddOnClickJS()
|
IChoiceRenderer<T> |
getChoiceRenderer()
|
Collection<? extends T> |
getChoices()
|
protected Component |
getChoicesComponent()
|
String |
getChoicesOnFocusJS()
|
protected ResourceReference |
getCSS()
Returns the resource reference of the default stylesheet. |
String |
getDownOnClickJS()
|
Collection<T> |
getModelCollection()
|
Recorder<T> |
getRecorderComponent()
Returns recorder component. |
String |
getRemoveOnClickJS()
|
int |
getRows()
|
Iterator<T> |
getSelectedChoices()
|
protected Component |
getSelectionComponent()
|
String |
getSelectionOnFocusJS()
|
protected StyleSheetReference |
getStyleSheet()
Can be overridden by clients for custom style sheet |
Iterator<T> |
getUnselectedChoices()
|
String |
getUpOnClickJS()
|
boolean |
isPaletteEnabled()
Return true if the palette is enabled, false otherwise |
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 |
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()
Called just before a component is rendered. |
protected void |
onDetach()
Called to allow a component to detach resources after use. |
void |
renderHead(IHeaderResponse response)
Renders header contributions |
protected void |
updateModel()
The model object is assumed to be a Collection, and it is modified in-place. |
Methods inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
onComponentTag, onComponentTagBody, renderHead |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup |
---|
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getMarkupType, getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onAfterRenderChildren, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Palette(String id, IModel<? extends Collection<? extends T>> choicesModel, IChoiceRenderer<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<List<T>> model, IModel<? extends Collection<? extends T>> choicesModel, IChoiceRenderer<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 downMethod Detail |
---|
protected void onBeforeRender()
Component
NOTE: If you override this, you *must* call super.onBeforeRender() within
your implementation.
Because this method is responsible for cascading Component.onBeforeRender()
call to its
children it is strongly recommended that super call is made at the end of the override.
onBeforeRender
in class Component
Component.callOnBeforeRenderIfNotVisible()
protected ResourceReference getCSS()
protected StyleSheetReference getStyleSheet()
public final boolean isPaletteEnabled()
public Iterator<T> getSelectedChoices()
public Iterator<T> getUnselectedChoices()
protected Recorder<T> newRecorderComponent()
protected Component newAvailableHeader(String componentId)
componentId
- component id of the returned header component
protected Component newSelectedHeader(String componentId)
componentId
- component id of the returned header component
protected Component newDownComponent()
protected Component newUpComponent()
protected Component newRemoveComponent()
protected Component newAddComponent()
protected Component newSelectionComponent()
protected Map<String,String> getAdditionalAttributesForSelection(Object choice)
AbstractOptions.getAdditionalAttributes(Object)
protected Component newChoicesComponent()
protected Map<String,String> getAdditionalAttributesForChoices(Object 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<T> getChoiceRenderer()
public int getRows()
protected final void updateModel()
IModel.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.
FormComponent.updateModel()
protected String buildJSCall(String funcName)
funcName
- name of javascript function to call
public String getChoicesOnFocusJS()
public String getSelectionOnFocusJS()
public String getAddOnClickJS()
public String getRemoveOnClickJS()
public String getUpOnClickJS()
public String getDownOnClickJS()
protected void onDetach()
Component
onDetach
in class Component
public void renderHead(IHeaderResponse response)
renderHead
in interface IHeaderContributor
response
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |