|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Component org.apache.wicket.MarkupContainer org.apache.wicket.markup.html.WebMarkupContainer 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; } }
Field Summary |
---|
Fields inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
PANEL |
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
Palette(java.lang.String id,
IModel<? extends java.util.Collection<? extends T>> choicesModel,
IChoiceRenderer<T> choiceRenderer,
int rows,
boolean allowOrder)
|
|
Palette(java.lang.String id,
IModel<? extends java.util.List<? extends T>> model,
IModel<? extends java.util.Collection<? extends T>> choicesModel,
IChoiceRenderer<T> choiceRenderer,
int rows,
boolean allowOrder)
|
Method Summary | |
---|---|
protected java.lang.String |
buildJSCall(java.lang.String funcName)
builds javascript handler call |
protected java.util.Map<java.lang.String,java.lang.String> |
getAdditionalAttributesForChoices(java.lang.Object choice)
|
protected java.util.Map<java.lang.String,java.lang.String> |
getAdditionalAttributesForSelection(java.lang.Object choice)
|
java.lang.String |
getAddOnClickJS()
|
IChoiceRenderer<T> |
getChoiceRenderer()
|
java.util.Collection<? extends T> |
getChoices()
|
protected Component |
getChoicesComponent()
|
java.lang.String |
getChoicesOnFocusJS()
|
protected ResourceReference |
getCSS()
Returns the resource reference of the default stylesheet. |
java.lang.String |
getDownOnClickJS()
|
java.util.Collection<T> |
getModelCollection()
|
Recorder<T> |
getRecorderComponent()
Returns recorder component. |
java.lang.String |
getRemoveOnClickJS()
|
int |
getRows()
|
java.util.Iterator<T> |
getSelectedChoices()
|
protected Component |
getSelectionComponent()
|
java.lang.String |
getSelectionOnFocusJS()
|
java.util.Iterator<T> |
getUnselectedChoices()
|
java.lang.String |
getUpOnClickJS()
|
boolean |
isPaletteEnabled()
Return true if the palette is enabled, false otherwise |
protected Component |
newAddComponent()
factory method for the addcomponent |
protected Component |
newAvailableHeader(java.lang.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(java.lang.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 |
---|
newMarkupSourcingStrategy |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Palette(java.lang.String id, IModel<? extends java.util.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(java.lang.String id, IModel<? extends java.util.List<? extends T>> model, IModel<? extends java.util.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
protected ResourceReference getCSS()
public final boolean isPaletteEnabled()
public java.util.Iterator<T> getSelectedChoices()
public java.util.Iterator<T> getUnselectedChoices()
protected Recorder<T> newRecorderComponent()
protected Component newAvailableHeader(java.lang.String componentId)
componentId
- component id of the returned header component
protected Component newSelectedHeader(java.lang.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 java.util.Map<java.lang.String,java.lang.String> getAdditionalAttributesForSelection(java.lang.Object choice)
choice
-
AbstractOptions.getAdditionalAttributes(Object)
protected Component newChoicesComponent()
protected java.util.Map<java.lang.String,java.lang.String> getAdditionalAttributesForChoices(java.lang.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 java.util.Collection<? extends T> getChoices()
public java.util.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 java.lang.String buildJSCall(java.lang.String funcName)
funcName
- name of javascript function to call
public java.lang.String getChoicesOnFocusJS()
public java.lang.String getSelectionOnFocusJS()
public java.lang.String getAddOnClickJS()
public java.lang.String getRemoveOnClickJS()
public java.lang.String getUpOnClickJS()
public java.lang.String getDownOnClickJS()
protected void onDetach()
Component
onDetach
in class Component
public void renderHead(IHeaderResponse response)
renderHead
in interface IHeaderContributor
renderHead
in class Component
response
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |