Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.gwtext.client.widgets
Class CycleButton

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.gwtext.client.widgets.Component
                  com.gwtext.client.widgets.Button
                      com.gwtext.client.widgets.SplitButton
                          com.gwtext.client.widgets.CycleButton

All Implemented Interfaces:
  com.google.gwt.user.client.EventListener, Observable

    public class CycleButton

extends SplitButton

A specialized SplitButton that contains a menu of `CheckItem` elements. The button automatically cycles through each menu item on click, raising the button's change event (or calling the button's changeHandler function, if supplied) for the active menu item. Clicking on the arrow section of the button displays the dropdown menu just like a normal SplitButton.

     CycleButtonConfig config = new CycleButtonConfig();
     config.setShowText(true);
     config.setPrependText("View as ");
     config.addItem(new CheckItem("text only", true));
     config.addItem(new CheckItem("HTML", false));

     config.setChangeHandler(new CycleButtonHandler() {
         public void execute(CycleButton self, CheckItem item) {
             MessageBox.alert("Change View", item.getText());
         }
     });

     CycleButton button = new CycleButton(config);

Field Summary

Fields inherited from class com.gwtext.client.widgets.Component
`config, id`

Constructor Summary
`CycleButton()` Create a new CycleButton.
`CycleButton(CycleButtonListener listener)` Create a new CycleButton.
`CycleButton(CycleButtonListener listener, java.lang.String icon)` Create a new CycleButton.
`CycleButton(com.google.gwt.core.client.JavaScriptObject jsObj)`

Method Summary
`void` | `addItem(CheckItem item)` Add a CheckItem config object to be used when creating the button's menu items.
`void` | `addListener(CycleButtonListener listener)` Add a CycleButton Listener.
`protected com.google.gwt.core.client.JavaScriptObject` | `create(com.google.gwt.core.client.JavaScriptObject config)`
`CheckItem` | `getActiveItem()` Gets the currently active menu item.
`java.lang.String` | `getPrependText()`
`java.lang.String` | `getShowText()`
`java.lang.String` | `getXType()` Gets the xtype for this component as registered with ComponentMgr.
`void` | `setActiveItem(CheckItem item)` Sets the button's active menu item.
`void` | `setActiveItem(CheckItem item, boolean supressEvent)` Sets the button's active menu item.
`void` | `setPrependText(java.lang.String prependText)` A static string to prepend before the active item's text when displayed as the button's text (only applies when showText = true, defaults to '').
`void` | `setShowText(boolean showText)` True to display the active item's text as the button text (defaults to false).
`void` | `toggleSelected()` This is normally called internally on button click, but can be called externally to advance the button's active item programmatically to the next one in the menu.

Methods inherited from class com.gwtext.client.widgets.SplitButton
`addListener, getArrowTooltip, setArrowTooltip`

Methods inherited from class com.gwtext.client.widgets.Button
`addListener, focus, getBindToForm, getButtonElement, getClickEvent, getConfigPrototype, getHandleMouseEvents, getIcon, getIconCls, getMenuAlign, getMinWidth, getTabIndex, getText, getToggleGroup, getTooltip, getTooltipType, getType, hasVisibleMenu, hideMenu, isDisabled, isEnableToggle, isPressed, isRepeat, setClickEvent, setEnableToggle, setFormBind, setHandleMouseEvents, setHidden, setIcon, setIconCls, setMenu, setMenuAlign, setMinWidth, setPressed, setRepeat, setRepeat, setTabIndex, setTemplate, setText, setToggleGroup, setTooltip, setTooltip, setTooltip, setTooltipType, setType, showMenu, toggle, toggle`

Methods inherited from class com.gwtext.client.widgets.Component
`addClass, addClassCreated, addEvent, addEvents, addListener, addListener, addListener, afterRender, beforeDestroy, check, cloneComponent, cloneComponent, cloneConfig, destroy, disable, enable, equals, error, focus, focus, getApplyTo, getAttribute, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAutoShow, getCls, getComponentJS, getConfig, getCtCls, getDisabledClass, getEl, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getStyle, getStyleElement, getTitle, getXTypes, hashCode, hide, initComponent, isCreated, isHidden, isRendered, isVisible, isXType, isXType, onDestroy, removeClass, render, render, render, render, render, render, setApplyTo, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoEl, setAutoShow, setCls, setCtCls, setDisabled, setDisabledClass, setEl, setEl, setHeight, setHideMode, setHideParent, setId, setRenderTo, setStateEvents, setStateId, setStyle, setTitle, setVisible, setWidth, show`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setElement`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, removeStyleDependentName, removeStyleName, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkEvents, toString, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CycleButton

    public CycleButton()

  Create a new CycleButton.

### CycleButton

    public CycleButton(CycleButtonListener listener)

  Create a new CycleButton.

  Parameters:
    `listener` - the button listener

### CycleButton

    public CycleButton(CycleButtonListener listener,
                       java.lang.String icon)

  Create a new CycleButton.

  Parameters:
    `listener` - the button listener
    `icon` - icon image path

### CycleButton

    public CycleButton(com.google.gwt.core.client.JavaScriptObject jsObj)

Method Detail

### getXType

    public java.lang.String getXType()

  Description copied from class: `Component`
  Gets the xtype for this component as registered with ComponentMgr. For a list of all available xtypes, see the Component javadocs.

       TextField field = new TextField();
       field.getXType() returns "textfield"

  Overrides:
    `getXType` in class `SplitButton`
  Returns:
    the xtype

### create

    protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)

  Overrides:
    `create` in class `SplitButton`

### getActiveItem

    public CheckItem getActiveItem()

  Gets the currently active menu item.

  Returns:
    the active menu item

### setActiveItem

    public void setActiveItem(CheckItem item)

  Sets the button's active menu item.

  Parameters:
    `item` - the item to activate

### setActiveItem

    public void setActiveItem(CheckItem item,
                              boolean supressEvent)

  Sets the button's active menu item.

  Parameters:
    `item` - the item to activate
    `supressEvent` - true to prevent the button's change event from firing (defaults to false)

### toggleSelected

    public void toggleSelected()

  This is normally called internally on button click, but can be called externally to advance the button's active item programmatically to the next one in the menu. If the current item is the last one in the menu the active item will be set to the first item in the menu.

### addListener

    public void addListener(CycleButtonListener listener)

  Add a CycleButton Listener.

  Parameters:
    `listener` - the listener

### addItem

    public void addItem(CheckItem item)
                 throws java.lang.IllegalStateException

  Add a CheckItem config object to be used when creating the button's menu items.

  Parameters:
    `item` - check item config
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setPrependText

    public void setPrependText(java.lang.String prependText)

  A static string to prepend before the active item's text when displayed as the button's text (only applies when showText = true, defaults to '').

  Parameters:
    `prependText` - the prepend text

### getPrependText

    public java.lang.String getPrependText()

  Returns:
    the prepend text

### setShowText

    public void setShowText(boolean showText)

  True to display the active item's text as the button text (defaults to false).

  Parameters:
    `showText` - true to display item's text

### getShowText

    public java.lang.String getShowText()

  Returns:
    the show text

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD