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 SummaryNested ClassesNested classes/interfaces inherited from class org.eclipse.draw2d.Figureorg.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch, org.eclipse.draw2d.Figure.ReverseFigureChildrenIteratorNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigureorg.eclipse.draw2d.IFigure.NoInsets
- 
Field SummaryFieldsFields inherited from class org.eclipse.draw2d.FigurebgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTipFields inherited from interface org.eclipse.draw2d.IFigureMAX_DIMENSION, MIN_DIMENSION, NO_INSETS
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.Figureadd, 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.draw2d.IFigureadd, 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:
 
- 
FONTDefault label font.
 
- 
- 
Constructor Details- 
ActionButtonFigurepublic ActionButtonFigure(boolean runMode) 
- 
ActionButtonFigurepublic ActionButtonFigure()
 
- 
- 
Method Details- 
addActionListenerRegisters the given listener as anActionButtonFigure.ButtonActionListener.- Parameters:
- listener- The- ActionButtonFigure.ButtonActionListenerto add
 
- 
disposepublic void dispose()Dispose the resources on this figure.
- 
fireActionPerformedprotected void fireActionPerformed(int i) Notifies anyActionButtonFigure.ButtonActionListeneron this button that an action has been performed.
- 
getImagePath
- 
getTextAlignmentpublic int getTextAlignment()
- 
hookEventHandlerprotected 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.
- 
isArmedprotected boolean isArmed()
- 
isMousePressedprotected boolean isMousePressed()
- 
isOpaquepublic boolean isOpaque()- Specified by:
- isOpaquein interface- org.eclipse.draw2d.IFigure
- Overrides:
- isOpaquein class- org.eclipse.draw2d.Figure
 
- 
isRunModepublic boolean isRunMode()
- 
isSelectedpublic boolean isSelected()- Returns:
- true if the button is pushed down. false otherwise.
 
- 
isToggledpublic boolean isToggled()
- 
isToggleStylepublic boolean isToggleStyle()
- 
paintClientAreaprotected 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 class- org.eclipse.draw2d.Figure
 
- 
removeActionListener
- 
setArmedprotected void setArmed(boolean armed) Set the armed status of the button.
- 
setCursor- Specified by:
- setCursorin interface- org.eclipse.draw2d.IFigure
- Overrides:
- setCursorin class- org.eclipse.draw2d.Figure
 
- 
setEnabledpublic void setEnabled(boolean value) - Specified by:
- setEnabledin interface- org.eclipse.draw2d.IFigure
- Overrides:
- setEnabledin class- org.eclipse.draw2d.Figure
 
- 
setFont- Specified by:
- setFontin interface- org.eclipse.draw2d.IFigure
- Overrides:
- setFontin class- org.eclipse.draw2d.Figure
 
- 
setImagePath
- 
setMousePressedprotected void setMousePressed(boolean mousePressed) 
- 
setRunModepublic void setRunMode(boolean runMode) 
- 
setSelectedpublic void setSelected(boolean selected) 
- 
setTextSets the text for the Button.
- 
getText- Specified by:
- getTextin interface- ITextFigure
- Returns:
- the label text.
 
- 
setTextAlignmentpublic void setTextAlignment(int alignment) Sets the alignment of the buttons text. The parameter is aPositionConstants(LEFT, RIGHT, TOP, CENTER, BOTTOM)
- 
calculateTextPositionpublic void calculateTextPosition()
- 
calculateTextPositionpublic void calculateTextPosition(int width, int height) 
- 
setToggledpublic void setToggled(boolean toggled) 
- 
setToggleStylepublic void setToggleStyle(boolean style) Set the style of the Button.- Parameters:
- style- false = Push, true=Toggle.
 
- 
setBackgroundColor- Specified by:
- setBackgroundColorin interface- org.eclipse.draw2d.IFigure
- Overrides:
- setBackgroundColorin class- org.eclipse.draw2d.Figure
 
- 
getBeanInfo- Specified by:
- getBeanInfoin interface- Introspectable
- Throws:
- IntrospectionException
 
 
-