|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
public class CycleButton
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);
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.gwtext.client.widgets.Component |
---|
config, id |
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
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 |
getForceIcon()
A css class which sets an image to be used as the static icon for this button. |
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 |
setForceIcon(java.lang.String forceIcon)
A css class which sets an image to be used as the static icon for this button. |
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, getOwnerCt, 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.google.gwt.user.client.ui.Widget |
---|
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, setElement, setPixelSize, setSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CycleButton()
public CycleButton(CycleButtonListener listener)
listener
- the button listenerpublic CycleButton(CycleButtonListener listener, java.lang.String icon)
listener
- the button listenericon
- icon image pathpublic CycleButton(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail |
---|
public java.lang.String getXType()
Component
TextField field = new TextField();
field.getXType() returns "textfield"
getXType
in class SplitButton
protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
create
in class SplitButton
public CheckItem getActiveItem()
public void setActiveItem(CheckItem item)
item
- the item to activatepublic void setActiveItem(CheckItem item, boolean supressEvent)
item
- the item to activatesupressEvent
- true to prevent the button's change event from firing (defaults to false)public void toggleSelected()
public void addListener(CycleButtonListener listener)
listener
- the listenerpublic void addItem(CheckItem item) throws java.lang.IllegalStateException
item
- check item config
java.lang.IllegalStateException
- this property cannot be changed after the Component has been renderedpublic void setForceIcon(java.lang.String forceIcon)
forceIcon
- the forceIcon
java.lang.IllegalStateException
- this property cannot be changed after the Component has been renderedpublic java.lang.String getForceIcon()
public void setPrependText(java.lang.String prependText)
prependText
- the prepend textpublic java.lang.String getPrependText()
public void setShowText(boolean showText)
showText
- true to display item's textpublic java.lang.String getShowText()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |