com.googlecode.wicket.jquery.ui.interaction.selectable
Class SelectableBehavior<T extends Serializable>

java.lang.Object
  extended by org.apache.wicket.behavior.Behavior
      extended by com.googlecode.wicket.jquery.core.JQueryAbstractBehavior
          extended by com.googlecode.wicket.jquery.core.JQueryBehavior
              extended by com.googlecode.wicket.jquery.ui.interaction.selectable.SelectableBehavior<T>
Type Parameters:
T -
All Implemented Interfaces:
IJQueryAjaxAware, Serializable, org.apache.wicket.IComponentAwareEventSink, org.apache.wicket.markup.html.IComponentAwareHeaderContributor, org.apache.wicket.util.io.IClusterable

public abstract class SelectableBehavior<T extends Serializable>
extends JQueryBehavior
implements IJQueryAjaxAware

Provides a jQuery selectable behavior

Author:
Sebastien Briquet - sebfz1
See Also:
Serialized Form

Nested Class Summary
protected static class SelectableBehavior.StopEvent
          Provides an event object that will be broadcasted by the JQueryAjaxBehavior 'stop' callback
 
Field Summary
 
Fields inherited from class com.googlecode.wicket.jquery.core.JQueryBehavior
method, options, selector
 
Constructor Summary
SelectableBehavior(String selector)
          Constructor
SelectableBehavior(String selector, Options options)
          Constructor
 
Method Summary
 void bind(org.apache.wicket.Component component)
           
protected abstract  List<T> getItemList()
          Gets the reference list of all selectable items.
Usually the model object of the component on which this SelectableBehavior is bound to.
protected abstract  String getItemSelector()
          Gets the selector that identifies the selectable item within a selectable item list
The selector should be the path from the selectable component to the item (for instance '#myUL LI', where '#myUL' is the selectable's selector)
protected  JQueryAjaxBehavior newOnStopBehavior()
          Gets the ajax behavior that will be triggered when the user has selected items
 void onAjax(org.apache.wicket.ajax.AjaxRequestTarget target, JQueryEvent event)
           
 void onConfigure(org.apache.wicket.Component component)
           
 void onSelect(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.JQueryBehavior
$, $, $, getOption, on, on, renderHead, setOption, setOptions
 
Methods inherited from class com.googlecode.wicket.jquery.core.JQueryAbstractBehavior
add, toString
 
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onComponentTag, onEvent, onException, onRemove, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SelectableBehavior

public SelectableBehavior(String selector)
Constructor

Parameters:
selector - the html selector (ie: "#myId")

SelectableBehavior

public SelectableBehavior(String selector,
                          Options options)
Constructor

Parameters:
selector - the html selector (ie: "#myId")
options - the Options
Method Detail

getItemList

protected abstract List<T> getItemList()
Gets the reference list of all selectable items.
Usually the model object of the component on which this SelectableBehavior is bound to.

Returns:
the List

getItemSelector

protected abstract String getItemSelector()
Gets the selector that identifies the selectable item within a selectable item list
The selector should be the path from the selectable component to the item (for instance '#myUL LI', where '#myUL' is the selectable's selector)

Returns:
"li" by default

bind

public void bind(org.apache.wicket.Component component)
Overrides:
bind in class org.apache.wicket.behavior.Behavior

onConfigure

public void onConfigure(org.apache.wicket.Component component)
Overrides:
onConfigure in class org.apache.wicket.behavior.Behavior

onAjax

public void onAjax(org.apache.wicket.ajax.AjaxRequestTarget target,
                   JQueryEvent event)
Specified by:
onAjax in interface IJQueryAjaxAware

newOnStopBehavior

protected JQueryAjaxBehavior newOnStopBehavior()
Gets the ajax behavior that will be triggered when the user has selected items

Returns:
the JQueryAjaxBehavior

onSelect

public void onSelect(org.apache.wicket.ajax.AjaxRequestTarget target,
                     List<T> items)
Triggered when a selection has been made (stops)

Parameters:
target - the AjaxRequestTarget
items - the List of selected items


Copyright © 2013 7thWeb. All Rights Reserved.