wicket.extensions.markup.html.form.palette
Class Palette

java.lang.Object
  extended bywicket.Component
      extended bywicket.MarkupContainer
          extended bywicket.markup.html.WebMarkupContainer
              extended bywicket.markup.html.WebMarkupContainerWithAssociatedMarkup
                  extended bywicket.markup.html.panel.Panel
                      extended bywicket.extensions.markup.html.form.palette.Palette
All Implemented Interfaces:
java.io.Serializable

public class Palette
extends wicket.markup.html.panel.Panel

Palette is a component that allows the user to easily select and order multiple items by moving them from one select box into another. 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") {...});
 

Author:
Igor Vaynberg ( ivaynberg )
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.HeaderPartContainer
 
Nested classes inherited from class wicket.Component
wicket.Component.ComponentModelChange, wicket.Component.EnabledChange, wicket.Component.IVisitor, wicket.Component.VisibilityChange
 
Field Summary
 
Fields inherited from class 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, wicket.model.IModel choicesModel, wicket.markup.html.form.IChoiceRenderer choiceRenderer, int rows, boolean allowOrder)
           
Palette(java.lang.String id, wicket.model.IModel model, wicket.model.IModel choicesModel, wicket.markup.html.form.IChoiceRenderer choiceRenderer, int rows, boolean allowOrder)
           
 
Method Summary
protected  java.lang.String buildJSCall(java.lang.String funcName)
          builds javascript handler call
 java.lang.String getAddOnClickJS()
           
 wicket.markup.html.form.IChoiceRenderer getChoiceRenderer()
           
 java.util.Collection getChoices()
           
 java.lang.String getChoicesOnFocusJS()
           
 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()
           
 java.util.Iterator getUnselectedChoices()
           
 java.lang.String getUpOnClickJS()
           
protected  void internalOnDetach()
           
 boolean isPaletteEnabled()
          Return true if the palette is enabled, false otherwise
protected  wicket.Component newAddComponent()
          factory method for the addcomponent
protected  wicket.Component newAvailableHeader(java.lang.String componentId)
          factory method for the available items header
protected  wicket.Component newChoicesComponent()
          factory method for the available items component
protected  wicket.Component newDownComponent()
          factory method for the move down component
protected  wicket.Component newRemoveComponent()
          factory method for the remove component
protected  wicket.Component newSelectedHeader(java.lang.String componentId)
          factory method for the selected items header
protected  wicket.Component newSelectionComponent()
          factory method for the selected items component
protected  wicket.Component newUpComponent()
          factory method for the move up component
protected  void updateModel()
          update the model upon form processing
 
Methods inherited from class wicket.markup.html.panel.Panel
onComponentTag, onComponentTagBody, renderHead
 
Methods inherited from class wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalAttach, internalDetach, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnAttach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMetaData, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Palette

public Palette(java.lang.String id,
               wicket.model.IModel choicesModel,
               wicket.markup.html.form.IChoiceRenderer choiceRenderer,
               int rows,
               boolean allowOrder)
Parameters:
id - component id
choicesModel - model representing collection of all available choices
choiceRenderer - render used to render choices
rows - number of choices to be visible on the screen with out scrolling
allowOrder - allow user to move selections up and down

Palette

public Palette(java.lang.String id,
               wicket.model.IModel model,
               wicket.model.IModel choicesModel,
               wicket.markup.html.form.IChoiceRenderer choiceRenderer,
               int rows,
               boolean allowOrder)
Parameters:
id - component id
model - model representing collection of user's selections
choicesModel - model representing collection of all available choices
choiceRenderer - render used to render choices
rows - number of choices to be visible on the screen with out scrolling
allowOrder - allow user to move selections up and down
Method Detail

isPaletteEnabled

public final boolean isPaletteEnabled()
Return true if the palette is enabled, false otherwise

Returns:
true if the palette is enabled, false otherwise

getSelectedChoices

public java.util.Iterator getSelectedChoices()
Returns:
iterator over selected choices

getUnselectedChoices

public java.util.Iterator getUnselectedChoices()
Returns:
iterator over unselected choices

newAvailableHeader

protected wicket.Component newAvailableHeader(java.lang.String componentId)
factory method for the available items header

Parameters:
componentId - component id of the returned header component
Returns:
available items component

newSelectedHeader

protected wicket.Component newSelectedHeader(java.lang.String componentId)
factory method for the selected items header

Parameters:
componentId - component id of the returned header component
Returns:
header component

newDownComponent

protected wicket.Component newDownComponent()
factory method for the move down component

Returns:
move down component

newUpComponent

protected wicket.Component newUpComponent()
factory method for the move up component

Returns:
move up component

newRemoveComponent

protected wicket.Component newRemoveComponent()
factory method for the remove component

Returns:
remove component

newAddComponent

protected wicket.Component newAddComponent()
factory method for the addcomponent

Returns:
add component

newSelectionComponent

protected wicket.Component newSelectionComponent()
factory method for the selected items component

Returns:
selected items component

newChoicesComponent

protected wicket.Component newChoicesComponent()
factory method for the available items component

Returns:
available items component

getRecorderComponent

public final Recorder getRecorderComponent()
Returns recorder component. Recorder component is a form component used to track the selection of the palette. It receives onchange javascript event whenever a change in selection occurs.

Returns:
recorder component

getChoices

public java.util.Collection getChoices()
Returns:
collection representing all available items

getModelCollection

public java.util.Collection getModelCollection()
Returns:
collection representing selected items

getChoiceRenderer

public wicket.markup.html.form.IChoiceRenderer getChoiceRenderer()
Returns:
choice renderer

getRows

public int getRows()
Returns:
items visible without scrolling

updateModel

protected final void updateModel()
update the model upon form processing


buildJSCall

protected java.lang.String buildJSCall(java.lang.String funcName)
builds javascript handler call

Parameters:
funcName - name of javascript function to call
Returns:
string representing the call tho the function with palette params

getChoicesOnFocusJS

public java.lang.String getChoicesOnFocusJS()
Returns:
choices component on focus javascript handler

getSelectionOnFocusJS

public java.lang.String getSelectionOnFocusJS()
Returns:
selection component on focus javascript handler

getAddOnClickJS

public java.lang.String getAddOnClickJS()
Returns:
add action javascript handler

getRemoveOnClickJS

public java.lang.String getRemoveOnClickJS()
Returns:
remove action javascript handler

getUpOnClickJS

public java.lang.String getUpOnClickJS()
Returns:
move up action javascript handler

getDownOnClickJS

public java.lang.String getDownOnClickJS()
Returns:
move down action javascript handler

internalOnDetach

protected void internalOnDetach()


Copyright © 2004-2008 Wicket developers. All Rights Reserved.