|
||||||||||
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.WebMarkupContainerWithAssociatedMarkup org.apache.wicket.markup.html.panel.Panel org.apache.wicket.extensions.markup.html.form.palette.Palette
public class Palette
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
recorder component can be retrieved via a call to getRecorderComponent()
.
Example:
Form form=new Form(...); Palette palette=new Palette(...); palette.getRecorderComponent().add(new AjaxFormComponentUpdatingBehavior("onchange") {...});
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange |
Field Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
Palette(java.lang.String id,
IModel choicesModel,
IChoiceRenderer choiceRenderer,
int rows,
boolean allowOrder)
|
|
Palette(java.lang.String id,
IModel model,
IModel choicesModel,
IChoiceRenderer choiceRenderer,
int rows,
boolean allowOrder)
|
Method Summary | |
---|---|
protected java.lang.String |
buildJSCall(java.lang.String funcName)
builds javascript handler call |
protected java.util.Map |
getAdditionalAttributesForChoices(java.lang.Object choice)
|
protected java.util.Map |
getAdditionalAttributesForSelection(java.lang.Object choice)
|
java.lang.String |
getAddOnClickJS()
|
IChoiceRenderer |
getChoiceRenderer()
|
java.util.Collection |
getChoices()
|
java.lang.String |
getChoicesOnFocusJS()
|
protected ResourceReference |
getCSS()
Returns the resource reference of the default stylesheet. |
java.lang.String |
getDownOnClickJS()
|
java.util.Collection |
getModelCollection()
|
Recorder |
getRecorderComponent()
Returns recorder component. |
java.lang.String |
getRemoveOnClickJS()
|
int |
getRows()
|
java.util.Iterator |
getSelectedChoices()
|
java.lang.String |
getSelectionOnFocusJS()
|
protected StyleSheetReference |
getStyleSheet()
Can be overridden by clients for custom style sheet |
java.util.Iterator |
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 |
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 |
---|
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 |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, 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(java.lang.String id, IModel choicesModel, IChoiceRenderer 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 model, IModel choicesModel, IChoiceRenderer 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 java.util.Iterator getSelectedChoices()
public java.util.Iterator getUnselectedChoices()
protected Recorder 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 getAdditionalAttributesForSelection(java.lang.Object choice)
org.apache.wicket.extensions.markup.html.form.palette.component
protected Component newChoicesComponent()
protected java.util.Map getAdditionalAttributesForChoices(java.lang.Object choice)
org.apache.wicket.extensions.markup.html.form.palette.component
public final Recorder getRecorderComponent()
onchange
javascript event whenever a
change in selection occurs.
public java.util.Collection getChoices()
public java.util.Collection getModelCollection()
public IChoiceRenderer getChoiceRenderer()
public int getRows()
protected 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.
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
response
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |