org.odlabs.wiquery.ui.button
Class ButtonBehavior

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

public class ButtonBehavior
extends WiQueryAbstractBehavior

$Id$

Creates a jQuery UI button behavior to decorate a link or a button HTML markup.

The click event is not a part of the jQuery UI framework

Since:
1.1
Author:
Julien Roche, Ernesto Reinaldo
See Also:
Serialized Form

Constructor Summary
ButtonBehavior()
          Default constructor
 
Method Summary
 JsStatement destroy()
          Method to destroy the button This will return the element back to its pre-init state.
 void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to destroy the button within the ajax request
 void detach(org.apache.wicket.Component component)
           
 JsStatement disable()
          Method to disable the button
 void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to disable the button within the ajax request
 JsStatement enable()
          Method to enable the button
 void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to enable the button within the ajax request
 ButtonIcon getIcons()
           
 String getLabel()
           
protected  Options getOptions()
          Method retrieving the options of the component
 Boolean isDisabled()
           
 boolean isText()
           
 void onBind()
          Called when the component was bound to it's host component.
 void onComponentTag(org.apache.wicket.Component component, org.apache.wicket.markup.ComponentTag tag)
           
 void renderHead(org.apache.wicket.Component component, org.apache.wicket.markup.html.IHeaderResponse response)
           
 ButtonBehavior setDisabled(boolean disabled)
          Disables (true) or enables (false) the button.
 ButtonBehavior setIcons(ButtonIcon icons)
          Icons to display, with or without text (see text option).
 ButtonBehavior setIcons(UiIcon primary, UiIcon secondary)
          * Icons to display, with or without text (see text option).
 ButtonBehavior setLabel(org.apache.wicket.model.IModel<String> label)
          Text to show on the button.
 ButtonBehavior setLabel(String label)
          Text to show on the button.
 ButtonBehavior setText(boolean text)
          Whether to show any text - when set to false (display no text), icons (see icons option) must be enabled, otherwise it'll be ignored.
 JsStatement statement()
          Returns the main JsStatement used to create the plugin.
 JsStatement widget()
          Method to returns the .ui-autocomplete element
 void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to returns the .ui-autocomplete 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, onConfigure, onEvent, onException, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonBehavior

public ButtonBehavior()
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

getOptions

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

Returns:
the options

onComponentTag

public void onComponentTag(org.apache.wicket.Component component,
                           org.apache.wicket.markup.ComponentTag tag)
Overrides:
onComponentTag in class org.apache.wicket.behavior.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.

setDisabled

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

Parameters:
disabled -
Returns:
instance of the current behavior

isDisabled

public Boolean isDisabled()
Returns:
the disabled option

setText

public ButtonBehavior setText(boolean text)
Whether to show any text - when set to false (display no text), icons (see icons option) must be enabled, otherwise it'll be ignored.

Parameters:
text -
Returns:
the Button

isText

public boolean isText()
Returns:
the text option value

setIcons

public ButtonBehavior setIcons(ButtonIcon icons)
Icons to display, with or without text (see text option). The primary icon is displayed on the left of the label text, the secondary on the right. Value for the primary and secondary properties must be a classname (String), eg. "ui-icon-gear". For using only a primary icon: icons: {primary:'ui-icon-locked'}. For using both primary and secondary icon: icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}

Parameters:
icons -
Returns:
the button

setIcons

public ButtonBehavior setIcons(UiIcon primary,
                               UiIcon secondary)
* Icons to display, with or without text (see text option). The primary icon is displayed on the left of the label text, the secondary on the right. Value for the primary and secondary properties must be a classname (String), eg. "ui-icon-gear". For using only a primary icon: icons: {primary:'ui-icon-locked'}. For using both primary and secondary icon: icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}

Parameters:
primary - The primary icon (should be non-null)
secondary - The secondary icon (might be null).
Returns:

getIcons

public ButtonIcon getIcons()
Returns:
the icons value option

setLabel

public ButtonBehavior setLabel(String label)
Text to show on the button. When not specified (null), the element's html content is used, or its value attribute when it's an input element of type submit or reset; or the html content of the associated label element if its an input of type radio or checkbox

Parameters:
label -
Returns:
the button

setLabel

public ButtonBehavior setLabel(org.apache.wicket.model.IModel<String> label)
Text to show on the button. When not specified (null), the element's html content is used, or its value attribute when it's an input element of type submit or reset; or the html content of the associated label element if its an input of type radio or checkbox

Parameters:
label -
Returns:
the button

getLabel

public String getLabel()
Returns:
the label value option

destroy

public JsStatement destroy()
Method to destroy the button 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 the button within the ajax request

Parameters:
ajaxRequestTarget -

disable

public JsStatement disable()
Method to disable the button

Returns:
the associated JsStatement

disable

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

Parameters:
ajaxRequestTarget -

enable

public JsStatement enable()
Method to enable the button

Returns:
the associated JsStatement

enable

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

Parameters:
ajaxRequestTarget -

widget

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

Returns:
the associated JsStatement

widget

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

Parameters:
ajaxRequestTarget -


Copyright © 2012. All Rights Reserved.