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
ConstructorDescriptionAbstractContextButtonPadDeclaration
(IContextButtonPadData contextButtonPadData) Creates a new AbstractContextButtonPadDeclaration. -
Method Summary
Modifier and TypeMethodDescriptionabstract PositionedContextButton
createButton
(IContextButtonEntry entry, Rectangle position) Creates aPositionedContextButton
for a given context button entry and position.Returns the rectangular bounds of the bottom pad.protected abstract int
Returns the padding between the generic and domain-specific context buttons.protected abstract int
Returns the size of the generic and domain-specific context buttons.protected final List<IContextButtonEntry>
Returns the combined list of the collapse button and the generic context button entries.protected final IContextButtonEntry
Returns the context button entry for the collapse/expand functionality.protected abstract int
Returns the padding between the collapse context button and the other generic context buttons.Returns the rectangular bounds around all visible areas of the context button pad.protected final List<IContextButtonEntry>
Returns the list of domain-specific context button entries.protected final List<IContextButtonEntry>
Returns the list of domain-specific context button entries, which are located in the bottom pad.protected final List<IContextButtonEntry>
Returns the list of domain-specific context button entries, which are located in the right pad.protected final List<IContextButtonEntry>
Returns the list of generic, domain-independent context button entries.protected final Rectangle
Returns the original reference rectangle around which the context button pad is aligned.Returns the overlapping rectangular bounds around all visible areas of the context button pad.protected abstract int
Returns the length of the pad appendage, which is shown if the neighboring pad does not exist.protected abstract int
Returns the horizontal overlap of the pads (top with right, right with bottom).protected abstract int
Returns the padding of the generic and domain-specific context buttons at the inside of the context button pad.protected abstract int
Returns the padding of the generic and domain-specific context buttons at the outside of the context button pad.protected final Rectangle
Returns the adjusted reference rectangle around which the context button pad is aligned.protected abstract int
Returns the vertical overlap of the pads (top with right, right with bottom).final List<PositionedContextButton>
Returns the list of all positioned context buttons.Returns the rectangular bounds of the right pad.Returns the right pad style.Returns the rectangular bounds of the top pad.Returns the top pad style.protected void
Determines the positions and sizes of all context buttons.protected void
Determines the containment rectangles.protected void
Determines which domain buttons shall be located in the right pad and which in the bottom pad.protected void
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
Creates a new AbstractContextButtonPadDeclaration.- Parameters:
referenceRectangle
- The original reference rectangle as described ingetOriginalReferenceRectangle()
contextButtonPadData
- The context button data containing theIContextButtonEntry
-
-
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
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
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
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
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
Returns the top pad style. It is calculated by the constructor ininitializeRectangles()
.- Specified by:
getTopPadStyle
in interfaceIContextButtonPadDeclaration
- Returns:
- The top pad style.
-
getRightPadStyle
Returns the right pad style. It is calculated by the constructor ininitializeRectangles()
.- Specified by:
getRightPadStyle
in interfaceIContextButtonPadDeclaration
- Returns:
- The right pad style.
-
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
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
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
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
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
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
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:
-
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:
-
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
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
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. -
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.
-