Class ContextButtonPad
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.draw2d.Shape
org.eclipse.graphiti.ui.internal.contextbuttons.ContextButtonPad
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure
public class ContextButtonPad
extends org.eclipse.draw2d.Shape
A Shape depicting a context button pad. The context button pad contains
several
ContextButton
as children. The visual definition of the
context button pad is provided mostly by the
IContextButtonPadDeclaration
, which is set in the constructor, and
not calculated in this class.-
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.Shape
lineStyle, lineWidth
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
ConstructorDescriptionContextButtonPad
(ContextButtonManagerForPad contextButtonManagerForPad, IContextButtonPadDeclaration declaration, double zoomLevel, DiagramBehavior diagramBehavior, org.eclipse.gef.EditPart editPart, IResourceRegistry resourceRegistry) Creates a new ContextButtonPad and callsinitialize()
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers the listeners, when the context button pad is shown (when it is added to its parent).boolean
containsPoint
(int x, int y) Returns true, if the given point is contained inside one of the visible parts of the context button pad.boolean
containsPointOverlapping
(int x, int y) Returns true, if the given point is contained inside the overlapping area of all visible parts of the context button pad.protected void
fillShape
(org.eclipse.draw2d.Graphics graphics) Fills this Shape on the given Graphics.double
Returns the current transparency as described inITransparencyProvider
.Returns the declaration, which provides the visual definition and the context buttons for this context button pad.final DiagramBehavior
Returns the container for which the context button pad belongs.final org.eclipse.gef.EditPart
Returns the edit-part for which the context button pad is showing.final double
Returns the zoom-level, which shall be used when rendering the context button pad.boolean
Returns true, if the mouse is in the overlapping area of the context button pad.protected void
outlineShape
(org.eclipse.draw2d.Graphics graphics) Outlines this Shape on the given Graphics.void
paintFigure
(org.eclipse.draw2d.Graphics graphics) First initializes the given Graphics with settings like alpha-value, antialias-value, ...void
Deregisters the listeners, when the context button pad is hidden (when it is removed from its parent).Methods inherited from class org.eclipse.draw2d.Shape
getAlpha, getAntialias, getLineAttributes, getLineCap, getLineDash, getLineDashOffset, getLineJoin, getLineMiterLimit, getLineStyle, getLineWidth, getLineWidthFloat, setAlpha, setAlpha, setAntialias, setAntialias, setFill, setFillXOR, setLineAttributes, setLineCap, setLineDash, setLineDashOffset, setLineJoin, setLineMiterLimit, setLineStyle, setLineWidth, setLineWidthFloat, setOutline, setOutlineXOR, setXOR
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, 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, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintBorder, paintChildren, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
-
Constructor Details
-
ContextButtonPad
public ContextButtonPad(ContextButtonManagerForPad contextButtonManagerForPad, IContextButtonPadDeclaration declaration, double zoomLevel, DiagramBehavior diagramBehavior, org.eclipse.gef.EditPart editPart, IResourceRegistry resourceRegistry) Creates a new ContextButtonPad and callsinitialize()
.- Parameters:
contextButtonManagerForPad
-declaration
- The context button pad declaration as described ingetDeclaration()
.zoomLevel
- The zoom-level as described ingetZoomLevel()
.container
- The container as described in#getContainer()
.editPart
- The edit-part as described ingetEditPart()
.resourceRegistry
-
-
-
Method Details
-
getDeclaration
Returns the declaration, which provides the visual definition and the context buttons for this context button pad. It is set in the constructor and not changed afterwards.- Returns:
- The declaration, which provides the visual definition and the context buttons for this context button pad.
-
getZoomLevel
public final double getZoomLevel()Returns the zoom-level, which shall be used when rendering the context button pad. It is set in the constructor and not changed afterwards. The values provided by the declaration (seegetDeclaration()
) are always using a zoom-level 1.0, so they have to be adjusted by the zoom-level.- Returns:
- The zoom-level, which shall be used when rendering the context button pad.
-
getDiagramBehavior
Returns the container for which the context button pad belongs. It can be used to access the environment. It is set in the constructor and not changed afterwards.- Returns:
- The container, which can be used to access the environment.
-
getEditPart
public final org.eclipse.gef.EditPart getEditPart()Returns the edit-part for which the context button pad is showing. It is used by the context buttons, which work on/with the edit-part. It is set in the constructor and not changed afterwards.- Returns:
- The container, which can be used to access the environment.
-
addNotify
public void addNotify()Registers the listeners, when the context button pad is shown (when it is added to its parent).- Specified by:
addNotify
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
addNotify
in classorg.eclipse.draw2d.Figure
-
removeNotify
public void removeNotify()Deregisters the listeners, when the context button pad is hidden (when it is removed from its parent).- Specified by:
removeNotify
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
removeNotify
in classorg.eclipse.draw2d.Figure
-
outlineShape
protected void outlineShape(org.eclipse.draw2d.Graphics graphics) Outlines this Shape on the given Graphics. This will draw the pathspathInnerLine
,pathMiddleLine
andpathOuterLine
.- Specified by:
outlineShape
in classorg.eclipse.draw2d.Shape
- Parameters:
graphics
- The Graphics on which to outline this Shape.
-
paintFigure
public void paintFigure(org.eclipse.draw2d.Graphics graphics) First initializes the given Graphics with settings like alpha-value, antialias-value, ... Afterwards callssuper.paintFigure(graphics)
to continue with the default painting mechanisms.- Overrides:
paintFigure
in classorg.eclipse.draw2d.Shape
- Parameters:
graphics
- The Graphics on which to paint.
-
fillShape
protected void fillShape(org.eclipse.draw2d.Graphics graphics) Fills this Shape on the given Graphics. This will draw and fill the pathpathFill
.- Specified by:
fillShape
in classorg.eclipse.draw2d.Shape
- Parameters:
graphics
- The Graphics on which to fill this Shape.
-
isMouseInOverlappingArea
public boolean isMouseInOverlappingArea()Returns true, if the mouse is in the overlapping area of the context button pad. The overlapping area is the union of all overlapping rectangles (seeIContextButtonPadDeclaration.getOverlappingContainmentRectangles()
). -
getContextButtonManagerForPad
-
containsPoint
public boolean containsPoint(int x, int y) Returns true, if the given point is contained inside one of the visible parts of the context button pad. Note, that this is a much smaller area than the bounds of this shape, because the bounds are the outer invisible rectangle around all visible parts of the context button pad.Technically this is the union of all containment rectangles (see
IContextButtonPadDeclaration.getContainmentRectangles()
).- Specified by:
containsPoint
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
containsPoint
in classorg.eclipse.draw2d.Figure
- Parameters:
x
- The x-coordinate of the point to check.y
- The y-coordinate of the point to check.- Returns:
- true, if the given point is contained inside one of the visible parts of the context button pad.
-
containsPointOverlapping
public boolean containsPointOverlapping(int x, int y) Returns true, if the given point is contained inside the overlapping area of all visible parts of the context button pad. Note, that this is a much smaller area than the bounds of this shape, because the bounds are the outer invisible rectangle around all visible parts of the context button pad.- Parameters:
x
- The x-coordinate of the point to check.y
- The y-coordinate of the point to check.- Returns:
- true, if the given point is contained inside the overlapping area of all visible parts of the context button pad.
-
getCurrentTransparency
public double getCurrentTransparency()Returns the current transparency as described inITransparencyProvider
.- Returns:
- The current transparency as described in
ITransparencyProvider
.
-