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 java.lang.Object implements IContextButtonPadDeclaration
An implementation ofIContextButtonPadDeclaration
. 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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract PositionedContextButton
createButton(IContextButtonEntry entry, java.awt.Rectangle position)
Creates aPositionedContextButton
for a given context button entry and position.java.awt.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 java.util.List<IContextButtonEntry>
getCollapseAndGenericButtons()
Returns the combined list of the collapse button and the generic context button entries.protected 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.java.util.List<java.awt.Rectangle>
getContainmentRectangles()
Returns the rectangular bounds around all visible areas of the context button pad.protected java.util.List<IContextButtonEntry>
getDomainButtons()
Returns the list of domain-specific context button entries.protected java.util.List<IContextButtonEntry>
getDomainButtonsBottom()
Returns the list of domain-specific context button entries, which are located in the bottom pad.protected java.util.List<IContextButtonEntry>
getDomainButtonsRight()
Returns the list of domain-specific context button entries, which are located in the right pad.protected java.util.List<IContextButtonEntry>
getGenericButtons()
Returns the list of generic, domain-independent context button entries.protected java.awt.Rectangle
getOriginalReferenceRectangle()
Returns the original reference rectangle around which the context button pad is aligned.java.util.List<java.awt.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 java.awt.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).java.util.List<PositionedContextButton>
getPositionedContextButtons()
Returns the list of all positioned context buttons.java.awt.Rectangle
getRightPad()
Returns the rectangular bounds of the right pad.IContextButtonPadDeclaration.PadStyle
getRightPadStyle()
Returns the right pad style.java.awt.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 Detail
-
AbstractContextButtonPadDeclaration
public AbstractContextButtonPadDeclaration(IContextButtonPadData contextButtonPadData)
Creates a new AbstractContextButtonPadDeclaration.- Parameters:
referenceRectangle
- The original reference rectangle as described ingetOriginalReferenceRectangle()
contextButtonPadData
- The context button data containing theIContextButtonEntry
-
-
Method Detail
-
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, java.awt.Rectangle position)
Creates aPositionedContextButton
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 java.awt.Rectangle getTopPad()
Returns the rectangular bounds of the top pad. The rectangular bounds were calculated by the constructor ininitializeRectangles()
. It can be null.- Specified by:
getTopPad
in interfaceIContextButtonPadDeclaration
- Returns:
- The rectangular bounds of the top pad.
-
getRightPad
public java.awt.Rectangle getRightPad()
Returns the rectangular bounds of the right pad. The rectangular bounds were calculated by the constructor ininitializeRectangles()
. It can be null.- Specified by:
getRightPad
in interfaceIContextButtonPadDeclaration
- Returns:
- The rectangular bounds of the right pad.
-
getBottomPad
public java.awt.Rectangle getBottomPad()
Returns the rectangular bounds of the bottom pad. The rectangular bounds were calculated by the constructor ininitializeRectangles()
. It can be null.- Specified by:
getBottomPad
in interfaceIContextButtonPadDeclaration
- Returns:
- The rectangular bounds of the bottom pad.
-
getTopPadStyle
public IContextButtonPadDeclaration.PadStyle getTopPadStyle()
Returns the top pad style. It is calculated by the constructor ininitializeRectangles()
.- Specified by:
getTopPadStyle
in interfaceIContextButtonPadDeclaration
- Returns:
- The top pad style.
-
getRightPadStyle
public IContextButtonPadDeclaration.PadStyle getRightPadStyle()
Returns the right pad style. It is calculated by the constructor ininitializeRectangles()
.- Specified by:
getRightPadStyle
in interfaceIContextButtonPadDeclaration
- Returns:
- The right pad style.
-
getOriginalReferenceRectangle
protected final java.awt.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 java.awt.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 java.util.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 java.util.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. SeegetCollapseButton()
andgetGenericButtons()
.- Returns:
- The combined list of the collapse button and the generic context button entries.
-
getDomainButtons
protected final java.util.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 java.util.List<IContextButtonEntry> getDomainButtonsRight()
Returns the list of domain-specific context button entries, which are located in the right pad. It is calculated ininitializeDomainButtonLists()
. 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 java.util.List<IContextButtonEntry> getDomainButtonsBottom()
Returns the list of domain-specific context button entries, which are located in the bottom pad. It is calculated ininitializeDomainButtonLists()
. 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 java.util.List<PositionedContextButton> getPositionedContextButtons()
Returns the list of all positioned context buttons. It must not be null but it can be empty. It is calculated ininitializeButtonPositions()
.- Specified by:
getPositionedContextButtons
in interfaceIContextButtonPadDeclaration
- Returns:
- The list of all positioned context buttons.
-
getContainmentRectangles
public final java.util.List<java.awt.Rectangle> getContainmentRectangles()
Returns the rectangular bounds around all visible areas of the context button pad.- Specified by:
getContainmentRectangles
in interfaceIContextButtonPadDeclaration
- Returns:
- The rectangular bounds around all visible areas of the context button pad.
-
getOverlappingContainmentRectangles
public final java.util.List<java.awt.Rectangle> getOverlappingContainmentRectangles()
Returns the overlapping rectangular bounds around all visible areas of the context button pad.- Specified by:
getOverlappingContainmentRectangles
in interfaceIContextButtonPadDeclaration
- 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.
-
-