com.googlecode.wicket.jquery.ui.widget.tabs
Class TabsBehavior

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.widget.tabs.TabsBehavior
All Implemented Interfaces:
IJQueryAjaxAware, Serializable, org.apache.wicket.IComponentAwareEventSink, org.apache.wicket.markup.html.IComponentAwareHeaderContributor, org.apache.wicket.util.io.IClusterable

public abstract class TabsBehavior
extends JQueryBehavior
implements IJQueryAjaxAware

Provides a jQuery tabs behavior.
Note, this class has almost the same code as AccordionBehavior

Since:
1.2.1
Author:
Sebastien Briquet - sebfz1
See Also:
Serialized Form

Nested Class Summary
protected static class TabsBehavior.ActivateEvent
          Provides an event object that will be broadcasted by the JQueryAjaxBehavior 'activate' callback
protected static class TabsBehavior.ActivatingEvent
           
 
Field Summary
 
Fields inherited from class com.googlecode.wicket.jquery.core.JQueryBehavior
method, options, selector
 
Constructor Summary
TabsBehavior(String selector)
          Constructor
TabsBehavior(String selector, Options options)
          Constructor
 
Method Summary
 void activate(int index, org.apache.wicket.ajax.AjaxRequestTarget target)
          Activates the selected tab, identified by the index
 void bind(org.apache.wicket.Component component)
           
protected abstract  List<org.apache.wicket.extensions.markup.html.tabs.ITab> getTabs()
          Gets the reference list of tabs.
Usually the model object of the component on which this TabsBehavior is bound to.
 boolean isOnActivatingEventEnabled()
          Indicates whether the 'beforeActivate' event is enabled.
If true, the onActivating(AjaxRequestTarget, int, ITab) event will be triggered.
protected  JQueryAjaxBehavior newActivateEventBehavior()
          Gets a new JQueryAjaxBehavior that acts as the 'activate' javascript callback
protected  JQueryAjaxBehavior newActivatingEventBehavior()
          Gets a new JQueryAjaxBehavior that acts as the 'beforeActivate' javascript callback
 void onActivate(org.apache.wicket.ajax.AjaxRequestTarget target, int index, org.apache.wicket.extensions.markup.html.tabs.ITab tab)
          Triggered when a tab has been activated ('activate' event).
 void onActivating(org.apache.wicket.ajax.AjaxRequestTarget target, int index, org.apache.wicket.extensions.markup.html.tabs.ITab tab)
          Triggered when a tab is being activated ('beforeActivate' event).
 void onAjax(org.apache.wicket.ajax.AjaxRequestTarget target, JQueryEvent event)
           
 void onConfigure(org.apache.wicket.Component component)
           
 
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

TabsBehavior

public TabsBehavior(String selector)
Constructor

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

TabsBehavior

public TabsBehavior(String selector,
                    Options options)
Constructor

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

getTabs

protected abstract List<org.apache.wicket.extensions.markup.html.tabs.ITab> getTabs()
Gets the reference list of tabs.
Usually the model object of the component on which this TabsBehavior is bound to.

Returns:
a non-null List

bind

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

activate

public void activate(int index,
                     org.apache.wicket.ajax.AjaxRequestTarget target)
Activates the selected tab, identified by the index

Parameters:
target - the AjaxRequestTarget
index - the tab's index

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

newActivateEventBehavior

protected JQueryAjaxBehavior newActivateEventBehavior()
Gets a new JQueryAjaxBehavior that acts as the 'activate' javascript callback

Returns:
the JQueryAjaxBehavior

newActivatingEventBehavior

protected JQueryAjaxBehavior newActivatingEventBehavior()
Gets a new JQueryAjaxBehavior that acts as the 'beforeActivate' javascript callback

Returns:
the JQueryAjaxBehavior

isOnActivatingEventEnabled

public boolean isOnActivatingEventEnabled()
Indicates whether the 'beforeActivate' event is enabled.
If true, the onActivating(AjaxRequestTarget, int, ITab) event will be triggered.

Returns:
false by default

onActivating

public void onActivating(org.apache.wicket.ajax.AjaxRequestTarget target,
                         int index,
                         org.apache.wicket.extensions.markup.html.tabs.ITab tab)
Triggered when a tab is being activated ('beforeActivate' event).

Parameters:
target - the AjaxRequestTarget
index - the previously selected tab index
tab - the ITab that corresponds to the index

onActivate

public void onActivate(org.apache.wicket.ajax.AjaxRequestTarget target,
                       int index,
                       org.apache.wicket.extensions.markup.html.tabs.ITab tab)
Triggered when a tab has been activated ('activate' event).

Parameters:
target - the AjaxRequestTarget
index - the tab index that triggered this event
tab - the ITab that corresponds to the index


Copyright © 2013 7thWeb. All Rights Reserved.