com.sencha.gxt.cell.core.client
Class ButtonCell<C>

java.lang.Object
  extended by com.google.gwt.cell.client.AbstractCell<C>
      extended by com.sencha.gxt.cell.core.client.AbstractEventCell<C>
          extended by com.sencha.gxt.cell.core.client.ResizeCell<C>
              extended by com.sencha.gxt.cell.core.client.ButtonCell<C>
All Implemented Interfaces:
Cell<C>, HasSafeHtml, HasHTML, HasText, DisableCell, FocusableCell, ResizableCell, ArrowSelectEvent.HasArrowSelectHandlers, BeforeSelectEvent.HasBeforeSelectHandlers, SelectEvent.HasSelectHandlers, HasIcon
Direct Known Subclasses:
TextButtonCell, ToggleButtonCell

public class ButtonCell<C>
extends ResizeCell<C>
implements BeforeSelectEvent.HasBeforeSelectHandlers, SelectEvent.HasSelectHandlers, ArrowSelectEvent.HasArrowSelectHandlers, HasHTML, HasIcon, HasSafeHtml, FocusableCell, DisableCell


Nested Class Summary
static class ButtonCell.ButtonArrowAlign
          Button arrow alignment enum.
static interface ButtonCell.ButtonCellAppearance<C>
           
static class ButtonCell.ButtonScale
          ButtonScale enum.
static class ButtonCell.IconAlign
          Icon alignment enum.
 
Nested classes/interfaces inherited from interface com.google.gwt.cell.client.Cell
Cell.Context
 
Constructor Summary
ButtonCell()
           
ButtonCell(ButtonCell.ButtonCellAppearance<C> appearance)
           
 
Method Summary
 HandlerRegistration addArrowSelectHandler(ArrowSelectEvent.ArrowSelectHandler handler)
          Adds a ArrowSelectEvent.ArrowSelectHandler handler for ArrowSelectEvent events.
 HandlerRegistration addBeforeSelectHandler(BeforeSelectEvent.BeforeSelectHandler handler)
          Adds a BeforeSelectEvent.BeforeSelectHandler handler for BeforeSelectEvent events.
 HandlerRegistration addSelectHandler(SelectEvent.SelectHandler handler)
          Adds a SelectEvent.SelectHandler handler for SelectEvent events.
 void disable(Cell.Context context, Element parent)
           
 void enable(Cell.Context context, Element parent)
           
 ButtonCell.ButtonCellAppearance<C> getAppearance()
          Returns the button's appearance.
 ButtonCell.ButtonArrowAlign getArrowAlign()
          Returns the button's arrow alignment.
 XElement getFocusElement(XElement parent)
           
 java.lang.String getHTML()
           
 ImageResource getIcon()
          Returns the icon.
 ButtonCell.IconAlign getIconAlign()
          Returns the button's icon alignment.
 Menu getMenu()
          Returns the button's menu (if it has one).
 Style.AnchorAlignment getMenuAlign()
          Returns the button's menu alignment.
 int getMinWidth()
          Returns the button's minimum width.
 boolean getMouseEvents()
          Returns false if mouse over effect is disabled.
 ButtonCell.ButtonScale getScale()
          Returns the button's scale.
 java.lang.String getText()
           
 void hideMenu()
          Hide this button's menu (if it has one).
 void onBrowserEvent(Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater)
           
 boolean redrawOnResize()
          Determines if the cell should be redrawn when resized by @link CellComponent.
 void render(Cell.Context context, C value, SafeHtmlBuilder sb)
           
 void setArrowAlign(ButtonCell.ButtonArrowAlign arrowAlign)
          Sets the arrow alignment (defaults to RIGHT).
 void setHTML(SafeHtml html)
           
 void setHTML(java.lang.String html)
           
 void setIcon(ImageResource icon)
          Sets the icon.
 void setIconAlign(ButtonCell.IconAlign iconAlign)
          Sets the icon alignment (defaults to LEFT).
 void setMenu(Menu menu)
          Sets the button's menu.
 void setMenuAlign(Style.AnchorAlignment menuAlign)
          Sets the position to align the menu to, see XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int[]) for more details (defaults to 'tl-bl?', pre-render).
 void setMinWidth(int minWidth)
          Sets he minimum width for this button (used to give a set of buttons a common width)
 void setMouseEvents(boolean handleMouseEvents)
          False to disable visual cues on mouseover, mouseout and mousedown (defaults to true).
 void setScale(ButtonCell.ButtonScale scale)
          Sets the button's scale.
 void setText(java.lang.String text)
           
 void showMenu(Element target)
          Show this button's menu (if it has one).
 
Methods inherited from class com.sencha.gxt.cell.core.client.ResizeCell
getHeight, getWidth, setHeight, setSize, setSize, setWidth
 
Methods inherited from class com.sencha.gxt.cell.core.client.AbstractEventCell
addHandler, fireEvent, isDisableEvents, setDisableEvents
 
Methods inherited from class com.google.gwt.cell.client.AbstractCell
dependsOnSelection, getConsumedEvents, handlesSelection, isEditing, resetFocus, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonCell

public ButtonCell()

ButtonCell

public ButtonCell(ButtonCell.ButtonCellAppearance<C> appearance)
Method Detail

addArrowSelectHandler

public HandlerRegistration addArrowSelectHandler(ArrowSelectEvent.ArrowSelectHandler handler)
Description copied from interface: ArrowSelectEvent.HasArrowSelectHandlers
Adds a ArrowSelectEvent.ArrowSelectHandler handler for ArrowSelectEvent events.

Specified by:
addArrowSelectHandler in interface ArrowSelectEvent.HasArrowSelectHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addBeforeSelectHandler

public HandlerRegistration addBeforeSelectHandler(BeforeSelectEvent.BeforeSelectHandler handler)
Description copied from interface: BeforeSelectEvent.HasBeforeSelectHandlers
Adds a BeforeSelectEvent.BeforeSelectHandler handler for BeforeSelectEvent events.

Specified by:
addBeforeSelectHandler in interface BeforeSelectEvent.HasBeforeSelectHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addSelectHandler

public HandlerRegistration addSelectHandler(SelectEvent.SelectHandler handler)
Description copied from interface: SelectEvent.HasSelectHandlers
Adds a SelectEvent.SelectHandler handler for SelectEvent events.

Specified by:
addSelectHandler in interface SelectEvent.HasSelectHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

disable

public void disable(Cell.Context context,
                    Element parent)
Specified by:
disable in interface DisableCell

enable

public void enable(Cell.Context context,
                   Element parent)
Specified by:
enable in interface DisableCell

getAppearance

public ButtonCell.ButtonCellAppearance<C> getAppearance()
Returns the button's appearance.

Returns:
the apperance

getArrowAlign

public ButtonCell.ButtonArrowAlign getArrowAlign()
Returns the button's arrow alignment.

Returns:
the arrow alignment

getFocusElement

public XElement getFocusElement(XElement parent)
Specified by:
getFocusElement in interface FocusableCell

getHTML

public java.lang.String getHTML()
Specified by:
getHTML in interface HasHTML

getIcon

public ImageResource getIcon()
Description copied from interface: HasIcon
Returns the icon.

Specified by:
getIcon in interface HasIcon
Returns:
the icon

getIconAlign

public ButtonCell.IconAlign getIconAlign()
Returns the button's icon alignment.

Returns:
the icon alignment

getMenu

public Menu getMenu()
Returns the button's menu (if it has one).

Returns:
the menu

getMenuAlign

public Style.AnchorAlignment getMenuAlign()
Returns the button's menu alignment.

Returns:
the menu alignment

getMinWidth

public int getMinWidth()
Returns the button's minimum width.

Returns:
the minWidth the minimum width

getMouseEvents

public boolean getMouseEvents()
Returns false if mouse over effect is disabled.

Returns:
false if mouse effects disabled

getScale

public ButtonCell.ButtonScale getScale()
Returns the button's scale.

Returns:
the button scale

getText

public java.lang.String getText()
Specified by:
getText in interface HasText

hideMenu

public void hideMenu()
Hide this button's menu (if it has one).


onBrowserEvent

public void onBrowserEvent(Cell.Context context,
                           Element parent,
                           C value,
                           NativeEvent event,
                           ValueUpdater<C> valueUpdater)
Specified by:
onBrowserEvent in interface Cell<C>
Overrides:
onBrowserEvent in class AbstractCell<C>

redrawOnResize

public boolean redrawOnResize()
Description copied from interface: ResizableCell
Determines if the cell should be redrawn when resized by @link CellComponent. If true, CellComponent.redraw() will be called.

Specified by:
redrawOnResize in interface ResizableCell
Overrides:
redrawOnResize in class ResizeCell<C>
Returns:
true to force a redraw

render

public void render(Cell.Context context,
                   C value,
                   SafeHtmlBuilder sb)
Specified by:
render in interface Cell<C>
Specified by:
render in class AbstractCell<C>

setArrowAlign

public void setArrowAlign(ButtonCell.ButtonArrowAlign arrowAlign)
Sets the arrow alignment (defaults to RIGHT).

Parameters:
arrowAlign - the arrow alignment

setHTML

public void setHTML(SafeHtml html)
Specified by:
setHTML in interface HasSafeHtml

setHTML

public void setHTML(java.lang.String html)
Specified by:
setHTML in interface HasHTML

setIcon

public void setIcon(ImageResource icon)
Description copied from interface: HasIcon
Sets the icon.

Specified by:
setIcon in interface HasIcon
Parameters:
icon - the icon

setIconAlign

public void setIconAlign(ButtonCell.IconAlign iconAlign)
Sets the icon alignment (defaults to LEFT).

Parameters:
iconAlign - the icon alignment

setMenu

public void setMenu(Menu menu)
Sets the button's menu.

Parameters:
menu - the menu

setMenuAlign

public void setMenuAlign(Style.AnchorAlignment menuAlign)
Sets the position to align the menu to, see XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int[]) for more details (defaults to 'tl-bl?', pre-render).

Parameters:
menuAlign - the menu alignment

setMinWidth

public void setMinWidth(int minWidth)
Sets he minimum width for this button (used to give a set of buttons a common width)

Parameters:
minWidth - the minimum width

setMouseEvents

public void setMouseEvents(boolean handleMouseEvents)
False to disable visual cues on mouseover, mouseout and mousedown (defaults to true).

Parameters:
handleMouseEvents - false to disable mouse over changes

setScale

public void setScale(ButtonCell.ButtonScale scale)
Sets the button's scale.

Parameters:
scale - the button scale

setText

public void setText(java.lang.String text)
Specified by:
setText in interface HasText

showMenu

public void showMenu(Element target)
Show this button's menu (if it has one).

Parameters:
target - the element to align to


Copyright © 2012. All Rights Reserved.