Package org.csstudio.swt.widgets.figures
Class ActionButtonFigure
java.lang.Object
org.eclipse.draw2d.Figure
org.csstudio.swt.widgets.figures.ActionButtonFigure
- All Implemented Interfaces:
ITextFigure
,Introspectable
,org.eclipse.draw2d.IFigure
public class ActionButtonFigure
extends org.eclipse.draw2d.Figure
implements Introspectable, ITextFigure
A re-written action button figure which can pass mouse event state to action listener.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch, org.eclipse.draw2d.Figure.ReverseFigureChildrenIterator
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
org.eclipse.draw2d.IFigure.NoInsets
-
Field Summary
Fields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers the given listener as anActionButtonFigure.ButtonActionListener
.void
void
calculateTextPosition
(int width, int height) void
dispose()
Dispose the resources on this figure.protected void
fireActionPerformed
(int i) Notifies anyActionButtonFigure.ButtonActionListener
on this button that an action has been performed.getText()
int
protected void
hookEventHandler
(org.csstudio.swt.widgets.figures.ActionButtonFigure.ButtonEventHandler handler) Adds the givenActionButtonFigure.ButtonEventHandler
to this button.protected boolean
isArmed()
protected boolean
boolean
isOpaque()
boolean
boolean
boolean
boolean
protected void
paintClientArea
(org.eclipse.draw2d.Graphics graphics) Paints the area of this figure excluded by the borders.void
protected void
setArmed
(boolean armed) Set the armed status of the button.void
void
void
setEnabled
(boolean value) void
void
setImagePath
(String path) protected void
setMousePressed
(boolean mousePressed) void
setRunMode
(boolean runMode) void
setSelected
(boolean selected) void
Sets the text for the Button.void
setTextAlignment
(int alignment) Sets the alignment of the buttons text.void
setToggled
(boolean toggled) void
setToggleStyle
(boolean style) Set the style of the Button.Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintBorder, paintChildren, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setFlag, setFocusTraversable, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBorder, setBounds, setClippingStrategy, setConstraint, setFocusTraversable, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
-
Field Details
-
SWT_KEY_BEFORE_ACTION_RUNNABLE
- See Also:
-
FONT
Default label font.
-
-
Constructor Details
-
ActionButtonFigure
public ActionButtonFigure(boolean runMode) -
ActionButtonFigure
public ActionButtonFigure()
-
-
Method Details
-
addActionListener
Registers the given listener as anActionButtonFigure.ButtonActionListener
.- Parameters:
listener
- TheActionButtonFigure.ButtonActionListener
to add
-
dispose
public void dispose()Dispose the resources on this figure. -
fireActionPerformed
protected void fireActionPerformed(int i) Notifies anyActionButtonFigure.ButtonActionListener
on this button that an action has been performed. -
getImagePath
-
getTextAlignment
public int getTextAlignment() -
hookEventHandler
protected void hookEventHandler(org.csstudio.swt.widgets.figures.ActionButtonFigure.ButtonEventHandler handler) Adds the givenActionButtonFigure.ButtonEventHandler
to this button. AActionButtonFigure.ButtonEventHandler
should be a MouseListener, MouseMotionListener, KeyListener, and FocusListener. -
isArmed
protected boolean isArmed() -
isMousePressed
protected boolean isMousePressed() -
isOpaque
public boolean isOpaque()- Specified by:
isOpaque
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
isOpaque
in classorg.eclipse.draw2d.Figure
-
isRunMode
public boolean isRunMode() -
isSelected
public boolean isSelected()- Returns:
- true if the button is pushed down. false otherwise.
-
isToggled
public boolean isToggled() -
isToggleStyle
public boolean isToggleStyle() -
paintClientArea
protected void paintClientArea(org.eclipse.draw2d.Graphics graphics) Paints the area of this figure excluded by the borders. Induces a (1,1) pixel shift in the painting if the mouse is armed, giving it the pressed appearance.- Overrides:
paintClientArea
in classorg.eclipse.draw2d.Figure
-
removeActionListener
-
setArmed
protected void setArmed(boolean armed) Set the armed status of the button. -
setCursor
- Specified by:
setCursor
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setCursor
in classorg.eclipse.draw2d.Figure
-
setEnabled
public void setEnabled(boolean value) - Specified by:
setEnabled
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setEnabled
in classorg.eclipse.draw2d.Figure
-
setFont
- Specified by:
setFont
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setFont
in classorg.eclipse.draw2d.Figure
-
setImagePath
-
setMousePressed
protected void setMousePressed(boolean mousePressed) -
setRunMode
public void setRunMode(boolean runMode) -
setSelected
public void setSelected(boolean selected) -
setText
Sets the text for the Button. -
getText
- Specified by:
getText
in interfaceITextFigure
- Returns:
- the label text.
-
setTextAlignment
public void setTextAlignment(int alignment) Sets the alignment of the buttons text. The parameter is aPositionConstants
(LEFT, RIGHT, TOP, CENTER, BOTTOM) -
calculateTextPosition
public void calculateTextPosition() -
calculateTextPosition
public void calculateTextPosition(int width, int height) -
setToggled
public void setToggled(boolean toggled) -
setToggleStyle
public void setToggleStyle(boolean style) Set the style of the Button.- Parameters:
style
- false = Push, true=Toggle.
-
setBackgroundColor
- Specified by:
setBackgroundColor
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setBackgroundColor
in classorg.eclipse.draw2d.Figure
-
getBeanInfo
- Specified by:
getBeanInfo
in interfaceIntrospectable
- Throws:
IntrospectionException
-