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

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.Container<Button>
                      extended by com.extjs.gxt.ui.client.widget.button.ButtonBar
All Implemented Interfaces:
Observable, com.google.gwt.user.client.EventListener
Direct Known Subclasses:
StatusButtonBar

public class ButtonBar
extends Container<Button>

A horizontal row of buttons.

Events:
Select : ButtonBarEvent(container, item)
Fires when a button is selected.
BeforeAdd : ButtonEvent(container, item, index)
Fires before a widget is added or inserted. Listeners can set the doit field to false to cancel the action.
BeforeRemove : ButtonEvent(container, item)
Fires before a widget is removed. Listeners can set the doit field to false to cancel the action.
Add : ButtonEvent(container, item, index)
Fires after a widget has been added or inserted.
Remove : ButtonEvent(container, item)
Fires after a widget has been removed.
CSS:
.my-btn-bar (the button bar itself)


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
ButtonBar()
          Creates a left aligned button bar.
 
Method Summary
 boolean add(Button button)
          Adds a button to the bar.
 Style.HorizontalAlignment getButtonAlign()
          Returns the bar's horizontal alignment.
 Button getButtonById(java.lang.String buttonId)
          Returns the button with the specified button id.
 Button getButtonPressed()
          Returns the last button that was selected.
 int getButtonWidth()
           
 int getCellSpacing()
          Returns the cell spacing.
 boolean insert(Button button, int index)
          Inserts a button at the specified location.
 boolean remove(Button button)
          Removes a button from the bar.
 void setButtonAlign(Style.HorizontalAlignment buttonAlign)
          Sets the bar's horizontal alignment.
 void setButtonWidth(int buttonWidth)
           
 void setCellSpacing(int cellSpacing)
          Sets the cell spacing (pre-render).
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Container
disable, enable, findItem, getItem, getItemByItemId, getItemCount, getItems, getWidget, indexOf, iterator, removeAll, scrollIntoView
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
getBounds, getHeight, getHeight, getPosition, getShadow, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShim, setSize, setSize, setWidth, setWidth
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Component
addListener, addPlugin, addStyleName, addWidgetListener, disableEvents, disableTextSelection, el, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, getBaseStyle, getBorders, getData, getData, getElement, getId, getItemId, getModel, getState, getToolTip, hide, hideToolTip, isDisabledEvents, isEnabled, isRendered, isVisible, onBrowserEvent, onComponentEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeWidgetListener, render, render, saveState, setBorders, setData, setData, setElement, setEnabled, setEnableState, setId, setIntStyleAttribute, setItemId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, show, sinkEvents, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
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

ButtonBar

public ButtonBar()
Creates a left aligned button bar.

Method Detail

add

public boolean add(Button button)
Adds a button to the bar. Fires the BeforeAdd event before inserting, then fires the Add event after the widget has been inserted.

Parameters:
button - the button to be added
Returns:
true if the button was added

getButtonAlign

public Style.HorizontalAlignment getButtonAlign()
Returns the bar's horizontal alignment.

Returns:
the buttonAlign the alignment

getButtonById

public Button getButtonById(java.lang.String buttonId)
Returns the button with the specified button id.

Parameters:
buttonId - the button id
Returns:
the button or null if no match

getButtonPressed

public Button getButtonPressed()
Returns the last button that was selected.

Returns:
the last button or null

getButtonWidth

public int getButtonWidth()
Returns:
the buttonWidth

getCellSpacing

public int getCellSpacing()
Returns the cell spacing.

Returns:
the cell spacing

insert

public boolean insert(Button button,
                      int index)
Inserts a button at the specified location. Fires the BeforeAdd event before inserting, then fires the Add event after the widget has been inserted.

Parameters:
button - the button to be inserted
index - the insert location
Returns:
true if the button was added

remove

public boolean remove(Button button)
Removes a button from the bar.

Parameters:
button - the button to be removed
Returns:
true if the item was removed

setButtonAlign

public void setButtonAlign(Style.HorizontalAlignment buttonAlign)
Sets the bar's horizontal alignment.

Parameters:
buttonAlign - the alignment

setButtonWidth

public void setButtonWidth(int buttonWidth)
Parameters:
buttonWidth - the buttonWidth to set

setCellSpacing

public void setCellSpacing(int cellSpacing)
Sets the cell spacing (pre-render).

Parameters:
cellSpacing - the cell spacing