Package org.eclipse.graphiti.internal.contextbuttons

# Class AbstractContextButtonPadDeclaration

java.lang.Object
org.eclipse.graphiti.internal.contextbuttons.AbstractContextButtonPadDeclaration

All Implemented Interfaces:
  `IContextButtonPadDeclaration`

Direct Known Subclasses:
  `SpecialContextButtonPadDeclaration`, `StandardContextButtonPadDeclaration`

public abstract class AbstractContextButtonPadDeclaration extends Object implements IContextButtonPadDeclaration
An implementation of `IContextButtonPadDeclaration`. The calculation of the visual definition of the context button pad is based on a reference rectangle (around which the context pad is aligned) and on the context button entries (which provided the functionality of the context buttons).

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.graphiti.internal.contextbuttons.IContextButtonPadDeclaration

`IContextButtonPadDeclaration.PadStyle`

## Constructor Summary

Constructors
Constructor
Description
`AbstractContextButtonPadDeclaration(IContextButtonPadData contextButtonPadData)`
Creates a new AbstractContextButtonPadDeclaration.

## Method Summary

Modifier and Type
Method
Description
`abstract PositionedContextButton`
`createButton(IContextButtonEntry entry, Rectangle position)`
Creates a `PositionedContextButton` for a given context button entry and position.
`Rectangle`
`getBottomPad()`
Returns the rectangular bounds of the bottom pad.
`protected abstract int`
`getButtonPadding()`
Returns the padding between the generic and domain-specific context buttons.
`protected abstract int`
`getButtonSize()`
Returns the size of the generic and domain-specific context buttons.
`protected final List<IContextButtonEntry>`
`getCollapseAndGenericButtons()`
Returns the combined list of the collapse button and the generic context button entries.
`protected final IContextButtonEntry`
`getCollapseButton()`
Returns the context button entry for the collapse/expand functionality.
`protected abstract int`
`getCollapseButtonPadding()`
Returns the padding between the collapse context button and the other generic context buttons.
`final List<Rectangle>`
`getContainmentRectangles()`
Returns the rectangular bounds around all visible areas of the context button pad.
`protected final List<IContextButtonEntry>`
`getDomainButtons()`
Returns the list of domain-specific context button entries.
`protected final List<IContextButtonEntry>`
`getDomainButtonsBottom()`
Returns the list of domain-specific context button entries, which are located in the bottom pad.
`protected final List<IContextButtonEntry>`
`getDomainButtonsRight()`
Returns the list of domain-specific context button entries, which are located in the right pad.
`protected final List<IContextButtonEntry>`
`getGenericButtons()`
Returns the list of generic, domain-independent context button entries.
`protected final Rectangle`
`getOriginalReferenceRectangle()`
Returns the original reference rectangle around which the context button pad is aligned.
`final List<Rectangle>`
`getOverlappingContainmentRectangles()`
Returns the overlapping rectangular bounds around all visible areas of the context button pad.
`protected abstract int`
`getPadAppendageLength()`
Returns the length of the pad appendage, which is shown if the neighboring pad does not exist.
`protected abstract int`
`getPadHorizontalOverlap()`
Returns the horizontal overlap of the pads (top with right, right with bottom).
`protected abstract int`
`getPadPaddingInside()`
Returns the padding of the generic and domain-specific context buttons at the inside of the context button pad.
`protected abstract int`
`getPadPaddingOutside()`
Returns the padding of the generic and domain-specific context buttons at the outside of the context button pad.
`protected final Rectangle`
`getPadReferenceRectangle()`
Returns the adjusted reference rectangle around which the context button pad is aligned.
`protected abstract int`
`getPadVerticalOverlap()`
Returns the vertical overlap of the pads (top with right, right with bottom).
`final List<PositionedContextButton>`
`getPositionedContextButtons()`
Returns the list of all positioned context buttons.
`Rectangle`
`getRightPad()`
Returns the rectangular bounds of the right pad.
`IContextButtonPadDeclaration.PadStyle`
`getRightPadStyle()`
Returns the right pad style.
`Rectangle`
`getTopPad()`
Returns the rectangular bounds of the top pad.
`IContextButtonPadDeclaration.PadStyle`
`getTopPadStyle()`
Returns the top pad style.
`protected void`
`initializeButtonPositions()`
Determines the positions and sizes of all context buttons.
`protected void`
`initializeContainmentRectangles()`
Determines the containment rectangles.
`protected void`
`initializeDomainButtonLists()`
Determines which domain buttons shall be located in the right pad and which in the bottom pad.
`protected void`
`initializeRectangles()`
Calculates the rectangular bounds for the top pad, right pad and bottom pad.

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

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

### Methods inherited from interface org.eclipse.graphiti.internal.contextbuttons.IContextButtonPadDeclaration

`getPadCornerRadius, getPadDefaultOpacity, getPadFillColor, getPadInnerLineColor, getPadLineWidth, getPadMiddleLineColor, getPadOuterLineColor`

## Constructor Details

### AbstractContextButtonPadDeclaration

public AbstractContextButtonPadDeclaration(IContextButtonPadData contextButtonPadData)
Creates a new AbstractContextButtonPadDeclaration.

Parameters:
  `contextButtonPadData` - The context button data containing the `IContextButtonEntry`
  `referenceRectangle` - The original reference rectangle as described in `getOriginalReferenceRectangle()`

## Method Details

### getButtonSize

protected abstract int getButtonSize()
Returns the size of the generic and domain-specific context buttons.

Returns:
  The size of the generic and domain-specific context buttons.

### getButtonPadding

protected abstract int getButtonPadding()
Returns the padding between the generic and domain-specific context buttons.

Returns:
  The padding between the generic and domain-specific context buttons.

### getCollapseButtonPadding

protected abstract int getCollapseButtonPadding()
Returns the padding between the collapse context button and the other generic context buttons.

Returns:
  The padding between the collapse context button and the other generic context buttons.

### getPadPaddingOutside

protected abstract int getPadPaddingOutside()
Returns the padding of the generic and domain-specific context buttons at the outside of the context button pad.

Returns:
  The padding of the generic and domain-specific context buttons at the outside of the context button pad.

### getPadPaddingInside

protected abstract int getPadPaddingInside()
Returns the padding of the generic and domain-specific context buttons at the inside of the context button pad.

Returns:
  The padding of the generic and domain-specific context buttons at the inside of the context button pad.

### getPadHorizontalOverlap

protected abstract int getPadHorizontalOverlap()
Returns the horizontal overlap of the pads (top with right, right with bottom).

Returns:
  The horizontal overlap of the pads (top with right, right with bottom).

### getPadVerticalOverlap

protected abstract int getPadVerticalOverlap()
Returns the vertical overlap of the pads (top with right, right with bottom).

Returns:
  The vertical overlap of the pads (top with right, right with bottom).

### getPadAppendageLength

protected abstract int getPadAppendageLength()
Returns the length of the pad appendage, which is shown if the neighboring pad does not exist.

Returns:
  The length of the pad appendage, which is shown if the neighboring pad does not exist.

### createButton

public abstract PositionedContextButton createButton(IContextButtonEntry entry, Rectangle position)
Creates a `PositionedContextButton` for a given context button entry and position. This method can be implemented to set all the visual attributes of the context buttons (line-width, color, opacity, ...).

### getTopPad

public Rectangle getTopPad()
Returns the rectangular bounds of the top pad. The rectangular bounds were calculated by the constructor in `initializeRectangles()`. It can be null.

Specified by:
  `getTopPad` in interface `IContextButtonPadDeclaration`
Returns:
  The rectangular bounds of the top pad.

### getRightPad

public Rectangle getRightPad()
Returns the rectangular bounds of the right pad. The rectangular bounds were calculated by the constructor in `initializeRectangles()`. It can be null.

Specified by:
  `getRightPad` in interface `IContextButtonPadDeclaration`
Returns:
  The rectangular bounds of the right pad.

### getBottomPad

public Rectangle getBottomPad()
Returns the rectangular bounds of the bottom pad. The rectangular bounds were calculated by the constructor in `initializeRectangles()`. It can be null.

Specified by:
  `getBottomPad` in interface `IContextButtonPadDeclaration`
Returns:
  The rectangular bounds of the bottom pad.

### getTopPadStyle

public IContextButtonPadDeclaration.PadStyle getTopPadStyle()
Returns the top pad style. It is calculated by the constructor in `initializeRectangles()`.

Specified by:
  `getTopPadStyle` in interface `IContextButtonPadDeclaration`
Returns:
  The top pad style.

### getRightPadStyle

public IContextButtonPadDeclaration.PadStyle getRightPadStyle()
Returns the right pad style. It is calculated by the constructor in `initializeRectangles()`.

Specified by:
  `getRightPadStyle` in interface `IContextButtonPadDeclaration`
Returns:
  The right pad style.

### getOriginalReferenceRectangle

protected final Rectangle getOriginalReferenceRectangle()
Returns the original reference rectangle around which the context button pad is aligned. It was given in the constructor. Typically these are the bounds of the shape around which the context button pad shall appear. It must not be null.

Returns:
  The original reference rectangle around which the context button pad is aligned.

### getPadReferenceRectangle

protected final Rectangle getPadReferenceRectangle()
Returns the adjusted reference rectangle around which the context button pad is aligned. It was calculated in the constructor from the original reference rectangle. For example the original rectangle could be expanded to achieve a distance between the context button pad and the original reference rectangle. It must not be null.

Returns:
  The adjusted reference rectangle around which the context button pad is aligned.

### getGenericButtons

protected final List<IContextButtonEntry> getGenericButtons()
Returns the list of generic, domain-independent context button entries. It was given in the constructor. The generic buttons will be located in the top pad. It must not be null but it can be empty.

Returns:
  The list of generic, domain-independent context button entries.

### getCollapseButton

protected final IContextButtonEntry getCollapseButton()
Returns the context button entry for the collapse/expand functionality. It was given in the constructor. It can be null.

Returns:
  The context button entry for the collapse/expand functionality. It was given in the constructor. It can be null.

### getCollapseAndGenericButtons

protected final List<IContextButtonEntry> getCollapseAndGenericButtons()
Returns the combined list of the collapse button and the generic context button entries. Those will be located in the top pad. It must not be null but it can be empty. See `getCollapseButton()` and `getGenericButtons()`.

Returns:
  The combined list of the collapse button and the generic context button entries.

### getDomainButtons

protected final List<IContextButtonEntry> getDomainButtons()
Returns the list of domain-specific context button entries. It was given in the constructor. The domain-specific buttons will be located in the right pad and bottom pad. It must not be null but it can be empty.

Returns:
  The list of domain-specific context button entries.

### getDomainButtonsRight

protected final List<IContextButtonEntry> getDomainButtonsRight()
Returns the list of domain-specific context button entries, which are located in the right pad. It is calculated in `initializeDomainButtonLists()`. It must not be null but it can be empty.

Returns:
  The list of domain-specific context button entries, which are located in the right pad.
See Also:
  - `getDomainButtons()`

### getDomainButtonsBottom

protected final List<IContextButtonEntry> getDomainButtonsBottom()
Returns the list of domain-specific context button entries, which are located in the bottom pad. It is calculated in `initializeDomainButtonLists()`. It must not be null but it can be empty.

Returns:
  The list of domain-specific context button entries, which are located in the bottom pad.
See Also:
  - `getDomainButtons()`

### getPositionedContextButtons

public final List<PositionedContextButton> getPositionedContextButtons()
Returns the list of all positioned context buttons. It must not be null but it can be empty. It is calculated in `initializeButtonPositions()`.

Specified by:
  `getPositionedContextButtons` in interface `IContextButtonPadDeclaration`
Returns:
  The list of all positioned context buttons.

### getContainmentRectangles

public final List<Rectangle> getContainmentRectangles()
Returns the rectangular bounds around all visible areas of the context button pad.

Specified by:
  `getContainmentRectangles` in interface `IContextButtonPadDeclaration`
Returns:
  The rectangular bounds around all visible areas of the context button pad.

### getOverlappingContainmentRectangles

public final List<Rectangle> getOverlappingContainmentRectangles()
Returns the overlapping rectangular bounds around all visible areas of the context button pad.

Specified by:
  `getOverlappingContainmentRectangles` in interface `IContextButtonPadDeclaration`
Returns:
  The overlapping rectangular bounds around all visible areas of the context button pad.

### initializeDomainButtonLists

protected void initializeDomainButtonLists()
Determines which domain buttons shall be located in the right pad and which in the bottom pad. The algorithm first calculates how many buttons fit into the height of the adjusted reference rectangle and locates those in the right pad. Any further buttons are located in the bottom pad.

See Also:
  - `getDomainButtonsRight()`
  - `getDomainButtonsBottom()`

### initializeRectangles

protected void initializeRectangles()
Calculates the rectangular bounds for the top pad, right pad and bottom pad.

### initializeButtonPositions

protected void initializeButtonPositions()
Determines the positions and sizes of all context buttons.

### initializeContainmentRectangles

protected void initializeContainmentRectangles()
Determines the containment rectangles.

See Also:
  - `getContainmentRectangles()`
  - `getOverlappingContainmentRectangles()`