Interface IBinarySelectionGatewayFlowLabelHelper
-
public interface IBinarySelectionGatewayFlowLabelHelper
A flow label helper for binary selectiongateways
, i.e. gateways with two branches, usually an if and an else branch. Helps to position thelabels
for thenames
of the twoSequenceFlow
that emerge from the gateway.Assumptions:
- The two
sequence flow
lines
emanating from the gateway are perpendicular to each other, i.e. one is horizontal and the other is vertical. - Both labels for the flow lines are positioned inside the corner formed by the two lines.
- The
alignment items
for the consequent and alternate branch are placed next to each other. The alignment item for the consequent branch is at index 0, and the alignment item for the alternate branch is at index 1. - The gateway is placed next to the aligned body with the consequent and alternate branches. The alignment for the gateway is at index 0, and the alignment for the body is at index 1.
Horizontal layouts might look like this:
+----------------+ -------------------> | alternate | | +----------------+ | | | no | x yes +----------------+ x x x ---------------> | consequent | x +----------------+ gateway gateway x +----------------+ x x x ---------------> | consequent | x yes +----------------+ | | no | | | +----------------+ -------------------> | alternate | +----------------+ +----------------+ | alternate | <------------------- +----------------+ | | | no | | +----------------+ yes x | consequent | <--------------- x x x +----------------+ x gateway gateway +----------------+ x | consequent | <----------------x x x +----------------+ yes x | no | | | +----------------+ | | alternate | <----------------- - +----------------+
Vertical layouts might look like this:
gateway x x x x ------------------------ x no | | | | yes | | | | | | | | | | | | | v v +----------------+ +----------------+ | consequent | | alternate | +----------------+ +----------------+ gateway x ------------------------ x x x | no x | | | yes | | | | | | | | | | | | | v v +----------------+ +----------------+ | alternate | | consequent | +----------------+ +----------------+ +----------------+ +----------------+ | consequent | | alternate | +----------------+ +----------------+ ^ ^ | | | | | | | | | | | | | yes | | | x no | x x x ------------------------ x gateway +----------------+ +----------------+ | alternate | | consequent | +----------------+ +----------------+ ^ ^ | | | | | | | | | | | | | | | yes | | no x ------------------------ x x x x gateway
To create such a layout, you should proceed as follows:- To start, use
layouter.binarySelectionGatewayFlowLabelHelper()
to obtain a builder for configuring an instance of this interface. - Somehow create the
alignment items
for theGateway
and for the consequent and alternate branches. - Use one the alignment builders provided by the
layouter
, e.g.layouter.alignAtAxis()
orlayouter.alignAtPorts
, to align the alternate with the consequent, such as on top of each other. Make sure you passlabelHelper.branchesSpacingSelector()
tobuilder.spacingSelector()
. This will create the alignment item for the body. - Use one the alignment builders provided by the
layouter
, e.g.layouter.alignAtAxis()
orlayouter.alignAtPorts
, to align the gateway with the body, e.g. the body to the right of the gateway. Make sure you passlabelHelper.gatewayBodySpacingSelector()
tobuilder.spacingSelector()
. - Keep nesting alignment items to build the layout you want, then use
layouter.flatten
. This will create the flattened map of alignment items and compute the final positions for each constituent. - Use
flattened.flow()
.name(text, configurator)
to create theSequenceFlow
connecting the gateway to the consequent branch, passinglabelHelper.consequentText()
andlabelHelper.consequentConfigurator()
as arguments. This will add the "yes" label to the correct position on the sequence flow. - In a similar fashion, use
flattened.flow()
.name(text, configurator)
to create theSequenceFlow
connecting the gateway to the alternate branch, passinglabelHelper.alternateText()
andlabelHelper.alternateConfigurator()
as arguments. This will add the "no" label to the correct position on the sequence flow.
- Since:
- 8.4.0
- The two
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IWorkflowBpmnFlowEdgeNameConfigurator
alternateConfigurator()
The configurator for aligning the alternate text label, for use when you perform the alignment withlayouter.alignOnFlowSide
IWorkflowBpmnAlignmentItem<StyledBpmnLabel,?>
alternateText()
The alignment item for the alternate text label, i.e.IWorkflowBpmnCardinalAlignmentSpacingSelector
branchesSpacingSelector(int consequentIndex)
Gets the spacing selector when aligning the two branches of the gateway, i.e.IWorkflowBpmnCardinalAlignmentSpacingSelector
branchesSpacingSelector(Object consequentValue)
Gets the spacing selector when aligning the two branches of the gateway, i.e.IWorkflowBpmnFlowEdgeNameConfigurator
consequentConfigurator()
The configurator for aligning the consequent text label, for use when you perform the alignment withlayouter.alignOnFlowSide
.IWorkflowBpmnAlignmentItem<StyledBpmnLabel,?>
consequentText()
The alignment item for the consequent text label, i.e.IWorkflowBpmnCardinalAlignmentSpacingSelector
gatewayBodySpacingSelector(int divergingGatewayIndex)
Gets the spacing selector for aligning the gateway with thealignment item
representing the body, i.e.IWorkflowBpmnCardinalAlignmentSpacingSelector
gatewayBodySpacingSelector(Object divergingGatewayValue)
Gets the spacing selector for aligning the gateway with thealignment item
representing the body, i.e.
-
-
-
Method Detail
-
alternateConfigurator
IWorkflowBpmnFlowEdgeNameConfigurator alternateConfigurator()
The configurator for aligning the alternate text label, for use when you perform the alignment withlayouter.alignOnFlowSide
- Returns:
- The configurator for aligning the alternate text label
-
alternateText
IWorkflowBpmnAlignmentItem<StyledBpmnLabel,?> alternateText()
The alignment item for the alternate text label, i.e. the label for the "else" branch.- Returns:
- The alignment item for the alternate text label
-
branchesSpacingSelector
IWorkflowBpmnCardinalAlignmentSpacingSelector branchesSpacingSelector(int consequentIndex)
Gets the spacing selector when aligning the two branches of the gateway, i.e. the twoalignment items
represent the consequent and alternate parts. Intended to be used withIWorkflowBpmnLayouter.alignAtAxis()
.For example, for horizontal layouts, the two branches are often put on top of each other. If the labels are tall, the spacing needs to be adjusted to accommodate the height of the labels.
- Parameters:
consequentIndex
- The index of the alignment items representing the consequent ("if") part in the list of items to align. The alternate ("else") part must be the next item in the list. If you only align the consequent with the alternate (2 items), this should be 0.- Returns:
- The spacing selector for aligning the two alignment items for the two branches of the gateway.
-
branchesSpacingSelector
IWorkflowBpmnCardinalAlignmentSpacingSelector branchesSpacingSelector(Object consequentValue)
Gets the spacing selector when aligning the two branches of the gateway, i.e. the twoalignment items
represent the consequent and alternate parts. Intended to be used withIWorkflowBpmnLayouter.alignAtAxis()
.For example, for horizontal layouts, the two branches are often put on top of each other. If the labels are tall, the spacing needs to be adjusted to accommodate the height of the labels.
- Parameters:
consequentValue
- The value of the alignment items representing the consequent ("if") part in the list of items to align. The alternate ("else") part must be the next item in the list.- Returns:
- The spacing selector for aligning the two alignment items for the two branches of the gateway.
-
consequentConfigurator
IWorkflowBpmnFlowEdgeNameConfigurator consequentConfigurator()
The configurator for aligning the consequent text label, for use when you perform the alignment withlayouter.alignOnFlowSide
.- Returns:
- The configurator for aligning the consequent text label
-
consequentText
IWorkflowBpmnAlignmentItem<StyledBpmnLabel,?> consequentText()
The alignment item for the consequent text label, i.e. the label for the "if" branch.- Returns:
- The alignment item for the consequent text label
-
gatewayBodySpacingSelector
IWorkflowBpmnCardinalAlignmentSpacingSelector gatewayBodySpacingSelector(int divergingGatewayIndex)
Gets the spacing selector for aligning the gateway with thealignment item
representing the body, i.e. the consequent branch aligned with the alternate branch. Intended to be used withIWorkflowBpmnLayouter.alignAtAxis()
.For example, for west-to-east layouts, the body is often put to the right of the gateway. If the labels are wide, the spacing needs to be adjusted to accommodate the width of the labels.
- Parameters:
divergingGatewayIndex
- The index of the diverging gateway in the list of items to align. The body with the aligned branches must be the next item in the list. If you only align the gateway with the body (2 items), this should be 0.- Returns:
- The spacing selector for aligning the gateway with the body.
-
gatewayBodySpacingSelector
IWorkflowBpmnCardinalAlignmentSpacingSelector gatewayBodySpacingSelector(Object divergingGatewayValue)
Gets the spacing selector for aligning the gateway with thealignment item
representing the body, i.e. the consequent branch aligned with the alternate branch. Intended to be used withIWorkflowBpmnLayouter.alignAtAxis()
.For example, for west-to-east layouts, the body is often put to the right of the gateway. If the labels are wide, the spacing needs to be adjusted to accommodate the width of the labels.
- Parameters:
divergingGatewayValue
- The value of the diverging gateway in the list of items to align. The body with the aligned branches must be the next item in the list. If you only align the gateway with the body (2 items), this should be 0.- Returns:
- The spacing selector for aligning the gateway with the body.
-
-