Class Selectable<T extends Serializable>
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- com.googlecode.wicket.jquery.core.JQueryContainer
-
- com.googlecode.wicket.jquery.core.JQueryGenericContainer<List<T>>
-
- com.googlecode.wicket.jquery.ui.interaction.selectable.Selectable<T>
-
- Type Parameters:
T- the type of the model object
- All Implemented Interfaces:
com.googlecode.wicket.jquery.core.IJQueryWidget,ISelectableListener<T>,Serializable,Iterable<org.apache.wicket.Component>,org.apache.wicket.event.IEventSink,org.apache.wicket.event.IEventSource,org.apache.wicket.feedback.IFeedbackContributor,org.apache.wicket.IConverterLocator,org.apache.wicket.IGenericComponent<List<T>,com.googlecode.wicket.jquery.core.JQueryGenericContainer<List<T>>>,org.apache.wicket.IMetadataContext<Serializable,org.apache.wicket.Component>,org.apache.wicket.markup.html.IHeaderContributor,org.apache.wicket.request.component.IRequestableComponent,org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>,org.apache.wicket.util.io.IClusterable
public class Selectable<T extends Serializable> extends com.googlecode.wicket.jquery.core.JQueryGenericContainer<List<T>> implements ISelectableListener<T>
Provides a jQuery UI selectableJQueryGenericContainer.
Children of that container can be selected using the mouse or by pressing ctrl+click
Usage:<ul wicket:id="selectable"> <li wicket:id="items"> <span wicket:id="item">[label]</span> </li> </ul> final Selectable<String> selectable = new Selectable<String>("selectable", list) { protected void onSelect(AjaxRequestTarget target) { //this.getModelObject(): gets the selected items } }; this.add(selectable);- Author:
- Sebastien Briquet - sebfz1
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Selectable(String id, List<T> items)ConstructorSelectable(String id, org.apache.wicket.model.IModel<? extends List<T>> items)ConstructorSelectable(String id, org.apache.wicket.model.IModel<? extends List<T>> model, List<T> items)ConstructorSelectable(String id, org.apache.wicket.model.IModel<? extends List<T>> model, org.apache.wicket.model.IModel<? extends List<T>> items)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Draggable<?>createDraggable(String id)Creates aDraggableobject that is related to thisSelectable.
Uses a default factory that will create aDraggablewith aui-icon-arrow-4-diagiconDraggable<?>createDraggable(String id, SelectableDraggableFactory factory)Creates aDraggableobject that is related to thisSelectableprotected List<T>getItemList()Gets the reference list of all selectable items.protected StringgetItemSelector()Gets the selector that identifies the selectable item within aSelectable
The selector should be the path from theSelectableto the item (for instance '#myUL LI', where '#myUL' is theSelectable's selector)protected com.googlecode.wicket.jquery.core.JQueryAbstractBehaviornewSelectedBehavior()Gets the JQueryAbstractBehavior in charge of selecting default items (matching model object)com.googlecode.wicket.jquery.core.JQueryBehaviornewWidgetBehavior(String selector)protected voidonConfigure()protected voidonDetach()voidonSelect(org.apache.wicket.ajax.AjaxRequestTarget target)Triggered when a selection has been made (stops)voidonSelect(org.apache.wicket.ajax.AjaxRequestTarget target, List<T> items)Triggered when a selection has been made (stops)-
Methods inherited from class com.googlecode.wicket.jquery.core.JQueryContainer
onBeforeRender, onConfigure, onInitialize
-
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
-
Methods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, 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, getMarkupTag, 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, internalOnModelChanged, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onComponentTag, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.IGenericComponent
getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObject
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
Selectable
public Selectable(String id, List<T> items)
Constructor- Parameters:
id- the markup iditems- the list theSelectableshould observe.
-
Selectable
public Selectable(String id, org.apache.wicket.model.IModel<? extends List<T>> items)
Constructor- Parameters:
id- the markup iditems- the list theSelectableshould observe.
-
Selectable
public Selectable(String id, org.apache.wicket.model.IModel<? extends List<T>> model, List<T> items)
Constructor- Parameters:
id- the markup idmodel- the list of selected itemsitems- the list theSelectableshould observe.
-
-
Method Detail
-
getItemList
protected List<T> getItemList()
Gets the reference list of all selectable items.- Returns:
- the list of all selectable items.
-
getItemSelector
protected String getItemSelector()
Gets the selector that identifies the selectable item within aSelectable
The selector should be the path from theSelectableto the item (for instance '#myUL LI', where '#myUL' is theSelectable's selector)- Returns:
- "li" by default
-
onConfigure
protected void onConfigure()
- Overrides:
onConfigurein classorg.apache.wicket.Component
-
onSelect
public void onSelect(org.apache.wicket.ajax.AjaxRequestTarget target)
Triggered when a selection has been made (stops)- Parameters:
target- theAjaxRequestTarget
-
onSelect
public final void onSelect(org.apache.wicket.ajax.AjaxRequestTarget target, List<T> items)Description copied from interface:ISelectableListenerTriggered when a selection has been made (stops)- Specified by:
onSelectin interfaceISelectableListener<T extends Serializable>- Parameters:
target- theAjaxRequestTargetitems- theListof selected items
-
onDetach
protected void onDetach()
- Overrides:
onDetachin classorg.apache.wicket.MarkupContainer
-
newSelectedBehavior
protected com.googlecode.wicket.jquery.core.JQueryAbstractBehavior newSelectedBehavior()
Gets the JQueryAbstractBehavior in charge of selecting default items (matching model object)- Returns:
- the
JQueryAbstractBehavior
-
newWidgetBehavior
public com.googlecode.wicket.jquery.core.JQueryBehavior newWidgetBehavior(String selector)
- Specified by:
newWidgetBehaviorin interfacecom.googlecode.wicket.jquery.core.IJQueryWidget
-
createDraggable
public Draggable<?> createDraggable(String id)
Creates aDraggableobject that is related to thisSelectable.
Uses a default factory that will create aDraggablewith aui-icon-arrow-4-diagicon- Parameters:
id- the markup id- Returns:
- the
Draggable
-
createDraggable
public Draggable<?> createDraggable(String id, SelectableDraggableFactory factory)
Creates aDraggableobject that is related to thisSelectable- Parameters:
id- the markup idfactory- theSelectableDraggableFactoryinstance- Returns:
- the
Draggable
-
-