org.odlabs.wiquery.ui.selectable
Class SelectableBehavior

java.lang.Object
  extended by org.apache.wicket.behavior.Behavior
      extended by org.odlabs.wiquery.core.behavior.WiQueryAbstractBehavior
          extended by org.odlabs.wiquery.ui.selectable.SelectableBehavior
All Implemented Interfaces:
Serializable, org.apache.wicket.IClusterable, org.apache.wicket.IComponentAwareEventSink, org.apache.wicket.markup.html.IComponentAwareHeaderContributor, IWiQueryPlugin

public class SelectableBehavior
extends WiQueryAbstractBehavior

$Id$

Wicket behabior to use the JQuery UI Selectable behavior

* Example : Java code: List values = Arrays.asList( "Value 1", "Value 2", "Value 3", "Value 4", "Value 5"); ListView listView = new ListView("listView", values) {

Since:
1.0
Author:
Julien Roche
See Also:
Serialized Form

Nested Class Summary
static class SelectableBehavior.ToleranceEnum
          Enumeration for the tolerance option
 
Constructor Summary
SelectableBehavior()
          Default constructor
 
Method Summary
 JsStatement destroy()
          Method to destroy This will return the element back to its pre-init state.
 void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to destroy within the ajax request
 void detach(org.apache.wicket.Component component)
           
 JsStatement disable()
          Method to disable
 void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to disable within the ajax request
 JsStatement enable()
          Method to enable
 void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to enable within the ajax request
 String getCancel()
           
 int getDelay()
           
 int getDistance()
           
 String getFilter()
           
protected  Options getOptions()
          Method retrieving the options of the component
 SelectableBehavior.ToleranceEnum getTolerance()
           
 boolean isAutoRefresh()
           
 boolean isDisabled()
           
 void onBind()
          Called when the component was bound to it's host component.
 JsStatement refresh()
          Method to refresh
 void refresh(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to refresh within the ajax request
 void renderHead(org.apache.wicket.Component component, org.apache.wicket.markup.html.IHeaderResponse response)
           
 SelectableBehavior setAutoRefresh(boolean autoRefresh)
          This determines whether to refresh (recalculate) the position and size of each selected at the beginning of each select operation.
 SelectableBehavior setCancel(String cancel)
          Set's the prevent selecting if you start on elements matching the selector
 SelectableBehavior setDelay(int delay)
          Set's the delay (in milliseconds) to define when the selecting should start
 SelectableBehavior setDisabled(boolean disabled)
          Disables (true) or enables (false) the selectable.
 SelectableBehavior setDistance(int distance)
          Set's the tolerance in pixels
 SelectableBehavior setFilter(String filter)
          Set's the matching child to be selectable
 SelectableBehavior setSelectedEvent(JsScopeUiEvent selected)
          Set's the selected event This event is triggered at the end of the select operation, on each element added to the selection.
 SelectableBehavior setSelectingEvent(JsScopeUiEvent selecting)
          Set's the selecting event This event is triggered during the select operation, on each element added to the selection.
 SelectableBehavior setStartEvent(JsScopeUiEvent start)
          Set's the start event This event is triggered at the beginning of the select operation.
 SelectableBehavior setStopEvent(JsScopeUiEvent stop)
          Set's the stop event This event is triggered at the end of the select operation.
 SelectableBehavior setTolerance(SelectableBehavior.ToleranceEnum tolerance)
          Set's the tolerance fit: draggable overlaps the droppable entirely touch: draggable overlaps the droppable any amount
 SelectableBehavior setUnselectedEvent(JsScopeUiEvent unselected)
          Set's the unselected event This event is triggered at the end of the select operation, on each element removed from the selection.
 SelectableBehavior setUnselectingEvent(JsScopeUiEvent unselecting)
          Set's the unselecting event This event is triggered during the select operation, on each element removed from the selection.
 JsStatement statement()
          Returns the main JsStatement used to create the plugin.
 JsStatement widget()
          Method to returns the .ui-selectable element
 void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to returns the .ui-selectable element within the ajax request
 
Methods inherited from class org.odlabs.wiquery.core.behavior.WiQueryAbstractBehavior
bind, getComponent
 
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, canCallListenerInterface, canCallListenerInterface, getStatelessHint, isEnabled, isTemporary, onComponentTag, onConfigure, onEvent, onException, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectableBehavior

public SelectableBehavior()
Default constructor

Method Detail

onBind

public void onBind()
Description copied from class: WiQueryAbstractBehavior
Called when the component was bound to it's host component. You can get the bound host component by calling getComponent.

Overrides:
onBind in class WiQueryAbstractBehavior

detach

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

renderHead

public void renderHead(org.apache.wicket.Component component,
                       org.apache.wicket.markup.html.IHeaderResponse response)
Specified by:
renderHead in interface org.apache.wicket.markup.html.IComponentAwareHeaderContributor
Overrides:
renderHead in class org.apache.wicket.behavior.Behavior

getCancel

public String getCancel()
Returns:
the cancel option value

getDelay

public int getDelay()
Returns:
the delay option value

getDistance

public int getDistance()
Returns:
the distance option value

getFilter

public String getFilter()
Returns:
the cancel option value

getOptions

protected Options getOptions()
Method retrieving the options of the component

Returns:
the options

getTolerance

public SelectableBehavior.ToleranceEnum getTolerance()
Returns:
the tolerance option enum

isAutoRefresh

public boolean isAutoRefresh()
Returns:
the autoRefresh option enum

setAutoRefresh

public SelectableBehavior setAutoRefresh(boolean autoRefresh)
This determines whether to refresh (recalculate) the position and size of each selected at the beginning of each select operation. If you have many many items, you may want to set this to false and call the refresh method manually.

Parameters:
autoRefresh -
Returns:
instance of the current behavior

setDisabled

public SelectableBehavior setDisabled(boolean disabled)
Disables (true) or enables (false) the selectable. Can be set when initialising (first creating) the selectable.

Parameters:
disabled -
Returns:
instance of the current behavior

isDisabled

public boolean isDisabled()
Returns:
the disabled option

setCancel

public SelectableBehavior setCancel(String cancel)
Set's the prevent selecting if you start on elements matching the selector

Parameters:
cancel - Selector (default : ':input,option')
Returns:
instance of the current behavior

setDelay

public SelectableBehavior setDelay(int delay)
Set's the delay (in milliseconds) to define when the selecting should start

Parameters:
delay -
Returns:
instance of the current behavior

setDistance

public SelectableBehavior setDistance(int distance)
Set's the tolerance in pixels

Parameters:
distance -
Returns:
instance of the current behavior

setFilter

public SelectableBehavior setFilter(String filter)
Set's the matching child to be selectable

Parameters:
filter - Selector (default : '*')
Returns:
instance of the current behavior

setTolerance

public SelectableBehavior setTolerance(SelectableBehavior.ToleranceEnum tolerance)
Set's the tolerance
  • fit: draggable overlaps the droppable entirely
  • touch: draggable overlaps the droppable any amount

Parameters:
tolerance -
Returns:
instance of the current behavior

statement

public JsStatement statement()
Description copied from interface: IWiQueryPlugin
Returns the main JsStatement used to create the plugin.

Specified by:
statement in interface IWiQueryPlugin
Specified by:
statement in class WiQueryAbstractBehavior
Returns:
The JsStatement corresponding to this component.

setSelectedEvent

public SelectableBehavior setSelectedEvent(JsScopeUiEvent selected)
Set's the selected event This event is triggered at the end of the select operation, on each element added to the selection.

Parameters:
selected - Associated JsScopeUiEvent
Returns:
instance of the current behavior

setSelectingEvent

public SelectableBehavior setSelectingEvent(JsScopeUiEvent selecting)
Set's the selecting event This event is triggered during the select operation, on each element added to the selection.

Parameters:
selecting - Associated JsScopeUiEvent
Returns:
instance of the current behavior

setStartEvent

public SelectableBehavior setStartEvent(JsScopeUiEvent start)
Set's the start event This event is triggered at the beginning of the select operation.

Parameters:
start - Associated JsScopeUiEvent
Returns:
instance of the current behavior

setStopEvent

public SelectableBehavior setStopEvent(JsScopeUiEvent stop)
Set's the stop event This event is triggered at the end of the select operation.

Parameters:
stop - Associated JsScopeUiEvent
Returns:
instance of the current behavior

setUnselectedEvent

public SelectableBehavior setUnselectedEvent(JsScopeUiEvent unselected)
Set's the unselected event This event is triggered at the end of the select operation, on each element removed from the selection.

Parameters:
unselected - Associated JsScopeUiEvent
Returns:
instance of the current behavior

setUnselectingEvent

public SelectableBehavior setUnselectingEvent(JsScopeUiEvent unselecting)
Set's the unselecting event This event is triggered during the select operation, on each element removed from the selection.

Parameters:
unselecting - Associated JsScopeUiEvent
Returns:
instance of the current behavior

destroy

public JsStatement destroy()
Method to destroy This will return the element back to its pre-init state.

Returns:
the associated JsStatement

destroy

public void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to destroy within the ajax request

Parameters:
ajaxRequestTarget -

disable

public JsStatement disable()
Method to disable

Returns:
the associated JsStatement

disable

public void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to disable within the ajax request

Parameters:
ajaxRequestTarget -

enable

public JsStatement enable()
Method to enable

Returns:
the associated JsStatement

enable

public void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to enable within the ajax request

Parameters:
ajaxRequestTarget -

refresh

public JsStatement refresh()
Method to refresh

Returns:
the associated JsStatement

refresh

public void refresh(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to refresh within the ajax request

Parameters:
ajaxRequestTarget -

widget

public JsStatement widget()
Method to returns the .ui-selectable element

Returns:
the associated JsStatement

widget

public void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to returns the .ui-selectable element within the ajax request

Parameters:
ajaxRequestTarget -


Copyright © 2012. All Rights Reserved.