javax.rad.genui.component
Class AbstractUIButton<C extends IButton>

java.lang.Object
  extended by javax.rad.genui.UIResource<C>
      extended by javax.rad.genui.UIComponent<C>
          extended by javax.rad.genui.component.AbstractUIActionComponent<C>
              extended by javax.rad.genui.component.AbstractUIButton<C>
Type Parameters:
C - instance of IButton
All Implemented Interfaces:
ITranslatable, IActionComponent, IButton, IIcon, ILabel, IAlignmentConstants, IComponent, IResource, INamedObject
Direct Known Subclasses:
AbstractUIToggleButton, UIButton

public abstract class AbstractUIButton<C extends IButton>
extends AbstractUIActionComponent<C>
implements IButton

Platform and technology independent button. It is designed for use with AWT, Swing, SWT, JSP, JSF, ... .


Field Summary
 
Fields inherited from class javax.rad.genui.UIComponent
lLastTranslationModified, parent
 
Fields inherited from class javax.rad.genui.UIResource
uiResource
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
protected AbstractUIButton(C pButton)
          Creates a new instance of AbstractUIButton.
 
Method Summary
 int getHorizontalTextPosition()
          Returns the horizontal position of the text relative to the icon.
 int getImageTextGap()
          Returns the amount of space between the text and the icon displayed in this button.
 IImage getMouseOverImage()
          Gets the image for the button when the mouse is over.
 IImage getPressedImage()
          Gets the image for the button when the button is pressed.
 int getVerticalTextPosition()
          Returns the vertical position of the text relative to the icon.
 boolean isBorderOnMouseEntered()
          Gets, if the border should only be shown on mouse entered.
 boolean isBorderPainted()
          Gets whether the border will be painted.
 boolean isDefaultButton()
          Gets the value of the defaultButton property, which if true means that this button is the current default button.
 void setBorderOnMouseEntered(boolean pBorderOnMouseEntered)
          Sets, if the border should only be shown on mouse entered.
 void setBorderPainted(boolean pBorderPainted)
          Sets whether the border will be painted.
 void setDefaultButton(boolean pDefault)
          Sets the defaultButton property.
 void setHorizontalTextPosition(int pHorizontalPosition)
          Sets the horizontal position of the text relative to the icon.
 void setImageTextGap(int pImageTextGap)
          If both the icon and text properties are set, this property defines the space between them.
 void setMouseOverImage(IImage pImage)
          Sets the image for the button when the mouse is over.
 void setPressedImage(IImage pImage)
          Sets the image for the button when the button is pressed.
 void setVerticalTextPosition(int pVerticalPosition)
          Sets the vertical position of the text relative to the icon.
 
Methods inherited from class javax.rad.genui.component.AbstractUIActionComponent
eventAction, getAccelerator, getActionCommand, getHorizontalAlignment, getImage, getMargins, getText, getVerticalAlignment, setAccelerator, setActionCommand, setHorizontalAlignment, setImage, setMargins, setMargins, setText, setVerticalAlignment, updateTranslation
 
Methods inherited from class javax.rad.genui.UIComponent
addNotify, beforeAddNotify, capture, createCellFormatter, createNodeFormatter, debug, error, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getComponentUIResource, getCurrentTranslation, getCursor, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getResource, getSize, getToolTipText, getTranslation, info, invokeAndWait, invokeAndWait, invokeInThread, invokeInThread, invokeLater, invokeLater, isBackgroundSet, isBeforeNotified, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isNotified, isPreferredSizeSet, isTranslationChanged, isTranslationEnabled, isVisible, removeNotify, requestFocus, setBackground, setBounds, setBounds, setCursor, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocation, setLocationRelativeTo, setMaximumSize, setMaximumSize, setMinimumSize, setMinimumSize, setName, setParent, setPreferredSize, setPreferredSize, setSize, setSize, setToolTipText, setTranslation, setTranslationEnabled, setVisible, translate
 
Methods inherited from class javax.rad.genui.UIResource
equals, getUIResource, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.ui.component.IActionComponent
eventAction, getAccelerator, getActionCommand, getMargins, setAccelerator, setActionCommand, setMargins
 
Methods inherited from interface javax.rad.ui.component.IIcon
getImage, setImage
 
Methods inherited from interface javax.rad.ui.component.ILabel
getText, setText
 
Methods inherited from interface javax.rad.ui.IComponent
capture, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, requestFocus, setBackground, setBounds, setCursor, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setToolTipText, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 
Methods inherited from interface javax.rad.ui.IAlignmentConstants
getHorizontalAlignment, getVerticalAlignment, setHorizontalAlignment, setVerticalAlignment
 

Constructor Detail

AbstractUIButton

protected AbstractUIButton(C pButton)
Creates a new instance of AbstractUIButton.

Parameters:
pButton - the IButton.
See Also:
IButton
Method Detail

getImageTextGap

public int getImageTextGap()
Returns the amount of space between the text and the icon displayed in this button.

Specified by:
getImageTextGap in interface IButton
Returns:
an int equal to the number of pixels between the text and the icon.
See Also:
IButton.setImageTextGap(int)

setImageTextGap

public void setImageTextGap(int pImageTextGap)
If both the icon and text properties are set, this property defines the space between them.

The default value of this property is 4 pixels.

This is a JavaBeans bound property.

Specified by:
setImageTextGap in interface IButton
Parameters:
pImageTextGap - the image gap
See Also:
IButton.getImageTextGap()

setVerticalTextPosition

public void setVerticalTextPosition(int pVerticalPosition)
Sets the vertical position of the text relative to the icon.

Specified by:
setVerticalTextPosition in interface IButton
Parameters:
pVerticalPosition - one of the following values:
  • IAlignmentConstants.CENTER
  • IAlignmentConstants.TOP
  • IAlignmentConstants.BOTTOM

getVerticalTextPosition

public int getVerticalTextPosition()
Returns the vertical position of the text relative to the icon.

Specified by:
getVerticalTextPosition in interface IButton
Returns:
one of the following values:
  • IAlignmentConstants.CENTER
  • IAlignmentConstants.TOP
  • IAlignmentConstants.BOTTOM

setHorizontalTextPosition

public void setHorizontalTextPosition(int pHorizontalPosition)
Sets the horizontal position of the text relative to the icon.

Specified by:
setHorizontalTextPosition in interface IButton
Parameters:
pHorizontalPosition - one of the following values:
  • IAlignmentConstants.CENTER
  • IAlignmentConstants.LEFT
  • IAlignmentConstants.RIGHT

getHorizontalTextPosition

public int getHorizontalTextPosition()
Returns the horizontal position of the text relative to the icon.

Specified by:
getHorizontalTextPosition in interface IButton
Returns:
one of the following values:
  • IAlignmentConstants.CENTER
  • IAlignmentConstants.LEFT
  • IAlignmentConstants.RIGHT

isBorderOnMouseEntered

public boolean isBorderOnMouseEntered()
Gets, if the border should only be shown on mouse entered.

Specified by:
isBorderOnMouseEntered in interface IButton
Returns:
true, if the border should only be shown on mouse entered.

setBorderOnMouseEntered

public void setBorderOnMouseEntered(boolean pBorderOnMouseEntered)
Sets, if the border should only be shown on mouse entered.

Specified by:
setBorderOnMouseEntered in interface IButton
Parameters:
pBorderOnMouseEntered - true, if the border should only be shown on mouse entered.

setBorderPainted

public void setBorderPainted(boolean pBorderPainted)
Sets whether the border will be painted. If true, the border will be painted. The default value is that the border will be painted.

Specified by:
setBorderPainted in interface IButton
Parameters:
pBorderPainted - true to paint the border, otherwise false

isBorderPainted

public boolean isBorderPainted()
Gets whether the border will be painted.

Specified by:
isBorderPainted in interface IButton
Returns:
true when the border will be painted, otherwise false

setMouseOverImage

public void setMouseOverImage(IImage pImage)
Sets the image for the button when the mouse is over.

Specified by:
setMouseOverImage in interface IButton
Parameters:
pImage - the mouse over image

getMouseOverImage

public IImage getMouseOverImage()
Gets the image for the button when the mouse is over.

Specified by:
getMouseOverImage in interface IButton
Returns:
the mouse over image

setPressedImage

public void setPressedImage(IImage pImage)
Sets the image for the button when the button is pressed.

Specified by:
setPressedImage in interface IButton
Parameters:
pImage - the mouse pressed image

getPressedImage

public IImage getPressedImage()
Gets the image for the button when the button is pressed.

Specified by:
getPressedImage in interface IButton
Returns:
the mouse pressed image

setDefaultButton

public void setDefaultButton(boolean pDefault)
Sets the defaultButton property. The default button is the button which will be activated when a UI-defined activation event (typically the Enter key) occurs, regardless of whether or not the button has keyboard focus (unless there is another component within which consumes the activation event) For default activation to work, the button must be enabled.

Specified by:
setDefaultButton in interface IButton
Parameters:
pDefault - true to set this button as default button, otherwise false
See Also:
IButton.isDefaultButton()

isDefaultButton

public boolean isDefaultButton()
Gets the value of the defaultButton property, which if true means that this button is the current default button.

Specified by:
isDefaultButton in interface IButton
Returns:
true if this button is defined as default button, otherwise false
See Also:
IButton.setDefaultButton(boolean)


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.