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

    Constructors
    Constructor
    Description
    ContextButtonPad(ContextButtonManagerForPad contextButtonManagerForPad, IContextButtonPadDeclaration declaration, double zoomLevel, DiagramBehavior diagramBehavior, org.eclipse.gef.EditPart editPart, IResourceRegistry resourceRegistry)
    Creates a new ContextButtonPad and calls initialize().
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 in ITransparencyProvider.
    Returns the declaration, which provides the visual definition and the context buttons for this context button pad.
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getDeclaration

      public final IContextButtonPadDeclaration 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 (see getDeclaration()) 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

      public final DiagramBehavior 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 interface org.eclipse.draw2d.IFigure
      Overrides:
      addNotify in class org.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 interface org.eclipse.draw2d.IFigure
      Overrides:
      removeNotify in class org.eclipse.draw2d.Figure
    • outlineShape

      protected void outlineShape(org.eclipse.draw2d.Graphics graphics)
      Outlines this Shape on the given Graphics. This will draw the paths pathInnerLine, pathMiddleLine and pathOuterLine.
      Specified by:
      outlineShape in class org.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 calls super.paintFigure(graphics) to continue with the default painting mechanisms.
      Overrides:
      paintFigure in class org.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 path pathFill.
      Specified by:
      fillShape in class org.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 (see IContextButtonPadDeclaration.getOverlappingContainmentRectangles() ).
    • getContextButtonManagerForPad

      public ContextButtonManagerForPad 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 interface org.eclipse.draw2d.IFigure
      Overrides:
      containsPoint in class org.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 in ITransparencyProvider.
      Returns:
      The current transparency as described in ITransparencyProvider.