com.extjs.gxt.ui.client.widget.button
Class ToggleButton

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.BoxComponent
                  extended by com.extjs.gxt.ui.client.widget.button.Button
                      extended by com.extjs.gxt.ui.client.widget.button.ToggleButton
All Implemented Interfaces:
Observable, IconSupport, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener

public class ToggleButton
extends Button

A 2-state toggle button.

Events:
Toggle : ButtonEvent(button)
Fires when the "pressed" state of this button changes.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
ToggleButton()
          Creates a new toggle button.
ToggleButton(java.lang.String text)
          Creates a new toggle button.
ToggleButton(java.lang.String text, com.google.gwt.user.client.ui.AbstractImagePrototype icon)
          Creates a new toggle button with the given text and icon.
ToggleButton(java.lang.String text, SelectionListener<ButtonEvent> listener)
          Creates a new toggle button.
 
Method Summary
 java.lang.String getToggleGroup()
          Returns the toggle group name.
 boolean isAllowDepress()
           
 boolean isPressed()
          Returns true if the button is pressed.
 void setAllowDepress(boolean allowDepress)
          True to allow a toggle item to be depressed (default to true).
 void setToggleGroup(java.lang.String toggleGroup)
          Optionally, set the the button's toggle group name.
 void toggle()
          Toggles the current state.
 void toggle(boolean state)
          Sets the current pressed state.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.button.Button
addSelectionListener, getArrowAlign, getIcon, getIconAlign, getMenu, getMenuAlign, getMinWidth, getMouseEvents, getScale, getText, getType, hideMenu, onComponentEvent, removeSelectionListener, setArrowAlign, setIcon, setIconAlign, setIconStyle, setMenu, setMenuAlign, setMinWidth, setMouseEvents, setScale, setTabIndex, setText, setType, showMenu
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
getBounds, getHeight, getHeight, getPosition, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShadowOffset, setShadowPosition, setShim, setSize, setSize, setWidth, setWidth, sync, syncSize
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Component
addListener, addPlugin, addStyleName, addWidgetListener, clearState, disable, disableEvents, disableTextSelection, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, getBaseStyle, getBorders, getContextMenu, getData, getElement, getHideMode, getId, getItemId, getListeners, getModel, getState, getStateId, getToolTip, hasListeners, hasListeners, hide, hideToolTip, isDisabledEvents, isEnabled, isRendered, isStateful, isVisible, mask, mask, mask, onBrowserEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setBorders, setContextMenu, setData, setElement, setEnabled, setHideMode, setId, setIntStyleAttribute, setItemId, setStateful, setStateId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, setZIndex, show, sinkEvents, swallowEvent, swallowEvent, toString, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
fireEvent, getParent, isAttached
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ToggleButton

public ToggleButton()
Creates a new toggle button.


ToggleButton

public ToggleButton(java.lang.String text)
Creates a new toggle button.

Parameters:
text - the button text

ToggleButton

public ToggleButton(java.lang.String text,
                    SelectionListener<ButtonEvent> listener)
Creates a new toggle button.

Parameters:
text - the button text
listener - a selection listener

ToggleButton

public ToggleButton(java.lang.String text,
                    com.google.gwt.user.client.ui.AbstractImagePrototype icon)
Creates a new toggle button with the given text and icon.

Parameters:
text - the button text
icon - the icon
Method Detail

getToggleGroup

public java.lang.String getToggleGroup()
Returns the toggle group name.

Returns:
the toggle group name

isAllowDepress

public boolean isAllowDepress()

isPressed

public boolean isPressed()
Returns true if the button is pressed.

Returns:
the pressed state

toggle

public void toggle()
Toggles the current state.


toggle

public void toggle(boolean state)
Sets the current pressed state.

Parameters:
state - true to set pressed state

setAllowDepress

public void setAllowDepress(boolean allowDepress)
True to allow a toggle item to be depressed (default to true).

Parameters:
allowDepress - true to allow depressing

setToggleGroup

public void setToggleGroup(java.lang.String toggleGroup)
Optionally, set the the button's toggle group name.

Parameters:
toggleGroup - the toggle group name