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 ClassesNested classes/interfaces inherited from class org.eclipse.draw2d.Figure
org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch, org.eclipse.draw2d.Figure.ReverseFigureChildrenIteratorNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
org.eclipse.draw2d.IFigure.NoInsets -
Field Summary
FieldsFields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTipFields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters the given listener as anActionButtonFigure.ButtonActionListener.voidvoidcalculateTextPosition(int width, int height) voiddispose()Dispose the resources on this figure.protected voidfireActionPerformed(int i) Notifies anyActionButtonFigure.ButtonActionListeneron this button that an action has been performed.getText()intprotected voidhookEventHandler(org.csstudio.swt.widgets.figures.ActionButtonFigure.ButtonEventHandler handler) Adds the givenActionButtonFigure.ButtonEventHandlerto this button.protected booleanisArmed()protected booleanbooleanisOpaque()booleanbooleanbooleanbooleanprotected voidpaintClientArea(org.eclipse.draw2d.Graphics graphics) Paints the area of this figure excluded by the borders.voidprotected voidsetArmed(boolean armed) Set the armed status of the button.voidvoidvoidsetEnabled(boolean value) voidvoidsetImagePath(String path) protected voidsetMousePressed(boolean mousePressed) voidsetRunMode(boolean runMode) voidsetSelected(boolean selected) voidSets the text for the Button.voidsetTextAlignment(int alignment) Sets the alignment of the buttons text.voidsetToggled(boolean toggled) voidsetToggleStyle(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, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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.ButtonActionListenerto add
-
dispose
public void dispose()Dispose the resources on this figure. -
fireActionPerformed
protected void fireActionPerformed(int i) Notifies anyActionButtonFigure.ButtonActionListeneron 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.ButtonEventHandlerto this button. AActionButtonFigure.ButtonEventHandlershould be a MouseListener, MouseMotionListener, KeyListener, and FocusListener. -
isArmed
protected boolean isArmed() -
isMousePressed
protected boolean isMousePressed() -
isOpaque
public boolean isOpaque()- Specified by:
isOpaquein interfaceorg.eclipse.draw2d.IFigure- Overrides:
isOpaquein 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:
paintClientAreain classorg.eclipse.draw2d.Figure
-
removeActionListener
-
setArmed
protected void setArmed(boolean armed) Set the armed status of the button. -
setCursor
- Specified by:
setCursorin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setCursorin classorg.eclipse.draw2d.Figure
-
setEnabled
public void setEnabled(boolean value) - Specified by:
setEnabledin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setEnabledin classorg.eclipse.draw2d.Figure
-
setFont
- Specified by:
setFontin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setFontin 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:
getTextin 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:
setBackgroundColorin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setBackgroundColorin classorg.eclipse.draw2d.Figure
-
getBeanInfo
- Specified by:
getBeanInfoin interfaceIntrospectable- Throws:
IntrospectionException
-