net.sf.jzeno.echo.databinding
Class AbstractButton

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by net.sf.jzeno.echo.components.CustomComponent
          extended by net.sf.jzeno.echo.databinding.AbstractButton
All Implemented Interfaces:
Borderable, MouseCursorable, java.io.Serializable, java.util.EventListener, BindingTarget, PropertyComponent, RebindableComponent, EventSink, EventSource, Precreation, Component, ActionListener, FastComponent, FastComponentContainer
Direct Known Subclasses:
DynaConfirmButton

public abstract class AbstractButton
extends CustomComponent
implements ActionListener, FastComponent, Borderable, MouseCursorable, Precreation

Dynamicaly wired up pushbutton. This button will automatically register with the screen it is a child of. In a normal situation this will be an AbstractScreen, which will then auto-dispatch the event to a method with the name of the actionCommand. Also supports icon buttons.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface echopoint.positionable.Borderable
Borderable.NestedStyleInfo
 
Nested classes/interfaces inherited from interface echopoint.positionable.MouseCursorable
MouseCursorable.NestedStyleInfo
 
Field Summary
static int BOTTOM
           
static int CENTER
           
static int LEFT
           
static int RIGHT
           
protected  boolean save
           
static int TOP
           
 
Fields inherited from interface echopoint.positionable.Borderable
BORDER_DASHED, BORDER_DOTTED, BORDER_DOUBLE, BORDER_GROOVE, BORDER_INSET, BORDER_NONE, BORDER_OUTSET, BORDER_RIDGE, BORDER_SOLID, borderStyleSymbolics, STYLE_BORDER_COLOR, STYLE_BORDER_SIZE, STYLE_BORDER_STYLE, STYLE_BOTTOM_BORDER_COLOR, STYLE_BOTTOM_BORDER_SIZE, STYLE_BOTTOM_BORDER_STYLE, STYLE_LEFT_BORDER_COLOR, STYLE_LEFT_BORDER_SIZE, STYLE_LEFT_BORDER_STYLE, STYLE_RIGHT_BORDER_COLOR, STYLE_RIGHT_BORDER_SIZE, STYLE_RIGHT_BORDER_STYLE, STYLE_TOP_BORDER_COLOR, STYLE_TOP_BORDER_SIZE, STYLE_TOP_BORDER_STYLE
 
Fields inherited from interface echopoint.positionable.MouseCursorable
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
AbstractButton()
           Creates an unbound component.
AbstractButton(java.lang.Class beanClass, java.lang.String property, java.lang.String constructionHints)
           Creates a button that is databound.
 
Method Summary
 void actionPerformed(ActionEvent arg0)
           Used internally.
 void applyStyle(Style style)
          Sets stylistic properties of this component based on a Style object.
protected abstract  PushButton createButton()
           
 Color getBackground()
          Returns the background color of the component.
 Color getBorderColor()
           
 int getBorderSize()
           
 int getBorderStyle()
           Gets the border style of the button.
 Color getBottomBorderColor()
           
 int getBottomBorderSize()
           
 int getBottomBorderStyle()
           
 Font getFont()
          Returns the font.
 Color getForeground()
          Returns the foreground of the component.
 int getHeight()
           Sets a fixed height for the button.
 ImageReference getIcon()
           
 java.lang.String getIconName()
           
 Color getLeftBorderColor()
           
 int getLeftBorderSize()
           
 int getLeftBorderStyle()
           
 int getMouseCursor()
          Returns the current mouse cursor in use.
 java.lang.String getMouseCursorURI()
           
 Color getRightBorderColor()
           
 int getRightBorderSize()
           
 int getRightBorderStyle()
           
 java.lang.String getText()
           Returns the label that is shown on the button.
 java.lang.String getToolTipText()
           Gets the tooltip displayed when hovering over the button.
 Color getTopBorderColor()
           
 int getTopBorderSize()
           
 int getTopBorderStyle()
           
 int getWidth()
           Gets the fixed width of the button, or returns 0 if no fixed width was specified.
 boolean isAsync()
           
 boolean isReadOnly()
           Returns whether or not this button is read-only.
 void setAsync(boolean async)
           
 void setBackground(Color background)
          Sets the background color of the component.
 void setBorderColor(Color borderColor)
          Sets the Color of the Borderable's border.
 void setBorderSize(int borderSize)
          Sets the size of the Borderables's border.
 void setBorderStyle(int style)
           Sets the border style of the button.
 void setBottomBorderColor(Color borderColor)
          Sets the Color of the Borderable's bottom border.
 void setBottomBorderSize(int borderSize)
          Sets the size of the Borderables's bottom border.
 void setBottomBorderStyle(int borderStyle)
          Sets the border style of the Borderables's bottom border.
 void setButtonWidth(int width)
          Deprecated. use setWidth
 void setFocused(boolean focused)
           Gets the fixed height specification of the button.
 void setFont(Font font)
          Sets the font of the component.
 void setForeground(Color foreground)
          Sets the foreground color of the component.
 void setHeight(int height)
           
 void setIcon(ImageReference imageReference)
           
 void setIconName(java.lang.String iconName)
           If you want this button to visualize as an image, instead of a regular button, set this property to the filename of the gif/jpg/png/... you want to use.
 void setLeftBorderColor(Color borderColor)
          Sets the Color of the Borderable's left border.
 void setLeftBorderSize(int borderSize)
          Sets the size of the Borderables's left border.
 void setLeftBorderStyle(int borderStyle)
          Sets the border style of the Borderables's left border.
 void setMouseCursor(int mouseCursor)
          Sets the mouse cursor to use.
 void setMouseCursorURI(java.lang.String mouseCursorURI)
          Sets the URI to a custom platform mouse cursor.
 void setReadOnly(boolean readOnly)
           Sets this button as read-only, or as read-write.
 void setRightBorderColor(Color borderColor)
          Sets the Color of the Borderable's right border.
 void setRightBorderSize(int borderSize)
          Sets the size of the Borderables's right border.
 void setRightBorderStyle(int borderStyle)
          Sets the border style of the Borderables's right border.
 void setText(java.lang.String text)
           Sets the label on the button.
 void setToolTipText(java.lang.String toolTipText)
           Sets the tooltip to display when hovering over the button.
 void setTopBorderColor(Color borderColor)
          Sets the Color of the Borderable's top border.
 void setTopBorderSize(int borderSize)
          Sets the size of the Borderables's top border.
 void setTopBorderStyle(int borderStyle)
          Sets the border style of the Borderables's top border.
 void setWidth(int width)
           Sets a fixed width for the button.
 
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getActionCommand, getBean, getBeanClass, getDecorator, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isRequired, isValid, markInvalid, markValid, preRender, rebind, removeValidator, setActionCommand, setBean, setBeanClass, setDecorator, setNullObject, setProperty, setRequired, setValue, traceValue, validate
 
Methods inherited from class nextapp.echo.AbstractComponent
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getClientId, getComponent, getComponentCount, getComponents, getEchoInstance, getIdentifier, getListenerList, getLocale, getParent, indexOf, init, isAncestorOf, isDifferent, isEnabled, isFocused, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setClientId, setEnabled, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jzeno.echo.Precreation
applyContext
 

Field Detail

save

protected boolean save

TOP

public static final int TOP
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

AbstractButton

public AbstractButton()

Creates an unbound component.


AbstractButton

public AbstractButton(java.lang.Class beanClass,
                      java.lang.String property,
                      java.lang.String constructionHints)

Creates a button that is databound. This can be handy if your button appears in a list, let's say inside a DynaTable component. In this case the button is created with databinding on a javabean (corresponding to a row in the DynaTable). In an event handler you can retrieve the row that was clicked by calling the PropertyComponent.getValue() method on the button.

Method Detail

setIconName

public void setIconName(java.lang.String iconName)

If you want this button to visualize as an image, instead of a regular button, set this property to the filename of the gif/jpg/png/... you want to use. All images should be stored in the images folder in the root of your web application.


getIconName

public java.lang.String getIconName()

getIcon

public ImageReference getIcon()

setIcon

public void setIcon(ImageReference imageReference)

isReadOnly

public boolean isReadOnly()

Returns whether or not this button is read-only. In the case of a button that means the button will be disabled (and grayed out) on the screen. Users will not be able to click the button.

Specified by:
isReadOnly in interface PropertyComponent
Overrides:
isReadOnly in class CustomComponent

setReadOnly

public void setReadOnly(boolean readOnly)

Sets this button as read-only, or as read-write. In the case of a button read-only means the button will be disabled (and grayed out) on the screen. Users will not be able to click the button.

Specified by:
setReadOnly in interface PropertyComponent
Overrides:
setReadOnly in class CustomComponent

actionPerformed

public void actionPerformed(ActionEvent arg0)

Used internally.

Specified by:
actionPerformed in interface ActionListener
Parameters:
arg0 - The event describing the action.

setText

public void setText(java.lang.String text)

Sets the label on the button. Obviously if you configure an image to display on the label (setIconName(String)), using this method has no more effect.


getText

public java.lang.String getText()

Returns the label that is shown on the button.


setToolTipText

public void setToolTipText(java.lang.String toolTipText)

Sets the tooltip to display when hovering over the button.


getToolTipText

public java.lang.String getToolTipText()

Gets the tooltip displayed when hovering over the button.


setBorderStyle

public void setBorderStyle(int style)

Sets the border style of the button. (See the Borderable interface in EchoPoint).

Specified by:
setBorderStyle in interface Borderable

getBorderStyle

public int getBorderStyle()

Gets the border style of the button.

Specified by:
getBorderStyle in interface Borderable
Returns:
int the current border style

setButtonWidth

public void setButtonWidth(int width)
Deprecated. use setWidth


setWidth

public void setWidth(int width)

Sets a fixed width for the button. Value 0 removes the width specification.


getWidth

public int getWidth()

Gets the fixed width of the button, or returns 0 if no fixed width was specified.


setHeight

public void setHeight(int height)

getHeight

public int getHeight()

Sets a fixed height for the button. Value 0 removes the height specification.


setFocused

public void setFocused(boolean focused)

Gets the fixed height specification of the button. If 0 is returned, no fixed height was specified.

Specified by:
setFocused in interface Component
Overrides:
setFocused in class AbstractComponent
Parameters:
focused - True if the component is to be focused.

getBorderSize

public int getBorderSize()
Specified by:
getBorderSize in interface Borderable
Returns:
The size of the Borderables's border.

getBottomBorderColor

public Color getBottomBorderColor()
Specified by:
getBottomBorderColor in interface Borderable
Returns:
The Color of the Borderable's bottom border.

getBottomBorderSize

public int getBottomBorderSize()
Specified by:
getBottomBorderSize in interface Borderable
Returns:
The size of the Borderables's bottom border.

getBottomBorderStyle

public int getBottomBorderStyle()
Specified by:
getBottomBorderStyle in interface Borderable
Returns:
The style of the Borderables's bottom border.
See Also:
Borderable.getBorderStyle()

getLeftBorderColor

public Color getLeftBorderColor()
Specified by:
getLeftBorderColor in interface Borderable
Returns:
The Color of the Borderable's left border.

getLeftBorderSize

public int getLeftBorderSize()
Specified by:
getLeftBorderSize in interface Borderable
Returns:
The size of the Borderables's left border.

getLeftBorderStyle

public int getLeftBorderStyle()
Specified by:
getLeftBorderStyle in interface Borderable
Returns:
The style of the Borderables's left border.
See Also:
Borderable.getBorderStyle()

getRightBorderColor

public Color getRightBorderColor()
Specified by:
getRightBorderColor in interface Borderable
Returns:
The Color of the Borderable's right border.

getRightBorderSize

public int getRightBorderSize()
Specified by:
getRightBorderSize in interface Borderable
Returns:
The size of the Borderables's right border.

getRightBorderStyle

public int getRightBorderStyle()
Specified by:
getRightBorderStyle in interface Borderable
Returns:
The style of the Borderables's right border.
See Also:
Borderable.getBorderStyle()

getTopBorderColor

public Color getTopBorderColor()
Specified by:
getTopBorderColor in interface Borderable
Returns:
The Color of the Borderable's top border.

getTopBorderSize

public int getTopBorderSize()
Specified by:
getTopBorderSize in interface Borderable
Returns:
The size of the Borderables's top border.

getTopBorderStyle

public int getTopBorderStyle()
Specified by:
getTopBorderStyle in interface Borderable
Returns:
The style of the Borderables's top border.
See Also:
Borderable.getBorderStyle()

setBorderSize

public void setBorderSize(int borderSize)
Description copied from interface: Borderable
Sets the size of the Borderables's border. This will also set the left, top, right and bottom border size.

Specified by:
setBorderSize in interface Borderable

setBottomBorderColor

public void setBottomBorderColor(Color borderColor)
Description copied from interface: Borderable
Sets the Color of the Borderable's bottom border.

Specified by:
setBottomBorderColor in interface Borderable

setBottomBorderSize

public void setBottomBorderSize(int borderSize)
Description copied from interface: Borderable
Sets the size of the Borderables's bottom border.

Specified by:
setBottomBorderSize in interface Borderable

setBottomBorderStyle

public void setBottomBorderStyle(int borderStyle)
Description copied from interface: Borderable
Sets the border style of the Borderables's bottom border.

Specified by:
setBottomBorderStyle in interface Borderable
See Also:
Borderable.setBorderStyle(int)

setLeftBorderColor

public void setLeftBorderColor(Color borderColor)
Description copied from interface: Borderable
Sets the Color of the Borderable's left border.

Specified by:
setLeftBorderColor in interface Borderable

setLeftBorderSize

public void setLeftBorderSize(int borderSize)
Description copied from interface: Borderable
Sets the size of the Borderables's left border.

Specified by:
setLeftBorderSize in interface Borderable

setLeftBorderStyle

public void setLeftBorderStyle(int borderStyle)
Description copied from interface: Borderable
Sets the border style of the Borderables's left border.

Specified by:
setLeftBorderStyle in interface Borderable
See Also:
Borderable.setBorderStyle(int)

setRightBorderColor

public void setRightBorderColor(Color borderColor)
Description copied from interface: Borderable
Sets the Color of the Borderable's right border.

Specified by:
setRightBorderColor in interface Borderable

setRightBorderSize

public void setRightBorderSize(int borderSize)
Description copied from interface: Borderable
Sets the size of the Borderables's right border.

Specified by:
setRightBorderSize in interface Borderable

setRightBorderStyle

public void setRightBorderStyle(int borderStyle)
Description copied from interface: Borderable
Sets the border style of the Borderables's right border.

Specified by:
setRightBorderStyle in interface Borderable
See Also:
Borderable.setBorderStyle(int)

setTopBorderColor

public void setTopBorderColor(Color borderColor)
Description copied from interface: Borderable
Sets the Color of the Borderable's top border.

Specified by:
setTopBorderColor in interface Borderable

setTopBorderSize

public void setTopBorderSize(int borderSize)
Description copied from interface: Borderable
Sets the size of the Borderables's top border.

Specified by:
setTopBorderSize in interface Borderable

setTopBorderStyle

public void setTopBorderStyle(int borderStyle)
Description copied from interface: Borderable
Sets the border style of the Borderables's top border.

Specified by:
setTopBorderStyle in interface Borderable
See Also:
Borderable.setBorderStyle(int)

getMouseCursor

public int getMouseCursor()
Description copied from interface: MouseCursorable
Returns the current mouse cursor in use. This will be one of the following values.

Specified by:
getMouseCursor in interface MouseCursorable
Returns:
The current mouse cursor in use.

getMouseCursorURI

public java.lang.String getMouseCursorURI()
Specified by:
getMouseCursorURI in interface MouseCursorable
Returns:
The custom URI for the mouse cursor or null

setMouseCursor

public void setMouseCursor(int mouseCursor)
Description copied from interface: MouseCursorable
Sets the mouse cursor to use. This will be one of the following values.

Specified by:
setMouseCursor in interface MouseCursorable
Parameters:
mouseCursor - - the mouse cursor to use

setMouseCursorURI

public void setMouseCursorURI(java.lang.String mouseCursorURI)
Description copied from interface: MouseCursorable
Sets the URI to a custom platform mouse cursor. This will only be used if the mosue cusor is set to CURSOR_CUSTOM.

Specified by:
setMouseCursorURI in interface MouseCursorable
Parameters:
mouseCursorURI - the URI to a custom platform mouse cursor.

setForeground

public void setForeground(Color foreground)
Description copied from interface: Component
Sets the foreground color of the component.

Specified by:
setForeground in interface Component
Overrides:
setForeground in class AbstractComponent
Parameters:
foreground - The new foreground color of the component.

getForeground

public Color getForeground()
Description copied from interface: Component
Returns the foreground of the component.

Specified by:
getForeground in interface Component
Overrides:
getForeground in class AbstractComponent
Returns:
The foreground of the component.

setBackground

public void setBackground(Color background)
Description copied from interface: Component
Sets the background color of the component.

Specified by:
setBackground in interface Component
Overrides:
setBackground in class AbstractComponent
Parameters:
background - The new background color of the component.

getBackground

public Color getBackground()
Description copied from interface: Component
Returns the background color of the component.

Specified by:
getBackground in interface Component
Overrides:
getBackground in class AbstractComponent
Returns:
The background color of the component.

setBorderColor

public void setBorderColor(Color borderColor)
Description copied from interface: Borderable
Sets the Color of the Borderable's border. This will also set the left, top, right and bottom border color.

Specified by:
setBorderColor in interface Borderable

getBorderColor

public Color getBorderColor()
Specified by:
getBorderColor in interface Borderable
Returns:
The Color of the Borderable's border.

applyStyle

public void applyStyle(Style style)
Description copied from interface: Component
Sets stylistic properties of this component based on a Style object. The version of this method in Component will set foreground and background colors and the font from the style if they are present. Components should override this method if they allow more properties to be set from a style object, and should call super.applyStyle() if necessary.

Specified by:
applyStyle in interface Borderable
Specified by:
applyStyle in interface MouseCursorable
Specified by:
applyStyle in interface Component
Overrides:
applyStyle in class AbstractComponent
Parameters:
style - The style object from which to retrieve properties for this Component.
See Also:
Component.applyStyle(nextapp.echo.Style)

createButton

protected abstract PushButton createButton()

isAsync

public boolean isAsync()

setAsync

public void setAsync(boolean async)

setFont

public void setFont(Font font)
Description copied from interface: Component
Sets the font of the component.

Specified by:
setFont in interface Component
Overrides:
setFont in class AbstractComponent
Parameters:
font - The new font of the component.

getFont

public Font getFont()
Description copied from interface: Component
Returns the font.

Specified by:
getFont in interface Component
Overrides:
getFont in class AbstractComponent
Returns:
The font of the component.