Package org.eclipse.graphiti.internal.contextbuttons

## Class PositionedContextButton

- java.lang.Object
- - org.eclipse.graphiti.internal.contextbuttons.PositionedContextButton

    public class PositionedContextButton
    extends java.lang.Object

A positioned context button is a container for an `IContextButtonEntry` and several graphical attributes used to paint a context button.

### Constructor Summary

Constructors
`PositionedContextButton​(IContextButtonEntry contextButtonEntry, java.awt.Rectangle position)` Creates a new PositionedContextbutton.

### Method Summary

All Methods Instance Methods Concrete Methods
`IContextButtonEntry` `getContextButtonEntry()` Returns the context button entry, which contains the logical definition of the context button.
`int` `getCornerRadius()` Returns the corner radius of the context button outline(s).
`double` `getDefaultOpacity()` Returns the default opacity of the context button.
`IColorConstant` `getFillColor()` Returns the fill color of the context button.
`int` `getLineWidth()` Returns the line-width of the context button outline(s).
`IColorConstant` `getMiddleLineColor()` Returns the color of the middle line of the context button.
`double` `getMouseDownOpacity()` Returns the mouse-down opacity of the context button.
`double` `getMouseOverOpacity()` Returns the mouse-over opacity of the context button.
`IColorConstant` `getOuterLineColor()` Returns the color of the outer line of the context button.
`java.awt.Rectangle` `getPosition()` Returns the position (location and size) of the context button.
`void` `setColors​(IColorConstant outerLineColor, IColorConstant middleLineColor, IColorConstant fillColor)` Sets the graphical color attributes.
`void` `setLine​(int lineWidth, int cornerRadius)` Sets the graphical attributes for the line(s).
`void` `setOpacity​(double defaultOpacity, double mouseOverOpacity, double mouseDownOpacity)` Sets the graphical opacity attributes.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PositionedContextButton

    public PositionedContextButton​(IContextButtonEntry contextButtonEntry,
                                   java.awt.Rectangle position)

Creates a new PositionedContextbutton.

Parameters:
  `contextButtonEntry` - The context button entry as defined in `getContextButtonEntry()`.
  `position` - The position as described in `getPosition()`.

### Method Detail

#### setLine

    public final void setLine​(int lineWidth,
                              int cornerRadius)

Sets the graphical attributes for the line(s).

Parameters:
  `lineWidth` - The line-width as described in `getLineWidth()`.
  `cornerRadius` - The corner radius as described in `getCornerRadius()`.

#### setColors

    public final void setColors​(IColorConstant outerLineColor,
                                IColorConstant middleLineColor,
                                IColorConstant fillColor)

Sets the graphical color attributes.

Parameters:
  `outerLineColor` - The color of the outer line as described in `getOuterLineColor()`.
  `middleLineColor` - The color of the middle line as described in `getMiddleLineColor()`.
  `fillColor` - The fill color as described in `getFillColor()`.

#### setOpacity

    public final void setOpacity​(double defaultOpacity,
                                 double mouseOverOpacity,
                                 double mouseDownOpacity)

Sets the graphical opacity attributes.

Parameters:
  `defaultOpacity` - The default opacity as described in `getDefaultOpacity()`.
  `mouseOverOpacity` - The mouse-over opacity as described in `getMouseOverOpacity()`.
  `mouseDownOpacity` - The mouse-down opacity as described in `getMouseDownOpacity()`.

#### getContextButtonEntry

    public final IContextButtonEntry getContextButtonEntry()

Returns the context button entry, which contains the logical definition of the context button. The context button entry is set in the constructor and can not be changed afterwards.

Returns:
  The context button entry, which contains the logical definition of the context button.

#### getPosition

    public final java.awt.Rectangle getPosition()

Returns the position (location and size) of the context button. The position is defined in absolute coordinates. It is not adjusted to the current zoom-level. The position is set in the constructor and can not be changed afterwards.

Returns:
  The position (location and size) of the context button.

#### getLineWidth

    public final int getLineWidth()

Returns the line-width of the context button outline(s). It is not adjusted to the current zoom-level.

Returns:
  The line-width of the context button outline(s).

#### getCornerRadius

    public final int getCornerRadius()

Returns the corner radius of the context button outline(s). It is not adjusted to the current zoom-level.

Returns:
  The corner radius of the context button outline(s).

#### getOuterLineColor

    public final IColorConstant getOuterLineColor()

Returns the color of the outer line of the context button. Directly inside this outer line the middle line is painted (see `getMiddleLineColor()`).

Returns:
  The color of the outer line of the context button.

#### getMiddleLineColor

    public final IColorConstant getMiddleLineColor()

Returns the color of the middle line of the context button. It is painted directly inside the outer line (see `getOuterLineColor()`).

Returns:
  The color of the middle line of the context button.

#### getFillColor

    public final IColorConstant getFillColor()

Returns the fill color of the context button.

Returns:
  The fill color of the context button.

#### getDefaultOpacity

    public final double getDefaultOpacity()

Returns the default opacity of the context button. Values are between 0.0 (invisible) and 1.0 (opaque).

Returns:
  The default opacity of the context button.

#### getMouseOverOpacity

    public final double getMouseOverOpacity()

Returns the mouse-over opacity of the context button. Values are between 0.0 (invisible) and 1.0 (opaque).

The mouse-over opacity is used when the mouse is over the context button, to give visual feedback to the user.

Returns:
  The mouse-over opacity of the context button.

#### getMouseDownOpacity

    public final double getMouseDownOpacity()

Returns the mouse-down opacity of the context button. Values are between 0.0 (invisible) and 1.0 (opaque).

The mouse-down opacity is used when the context button is pressed, to give visual feedback to the user.

Returns:
  The mouse-down opacity of the context button.