com.yworks.yfiles.bpmn.view
Class ChoreographyLabelModel

java.lang.Object
  extended bycom.yworks.yfiles.bpmn.view.ChoreographyLabelModel
All Implemented Interfaces:
NodeLabelModel

public class ChoreographyLabelModel
extends Object
implements NodeLabelModel

Label model for BPMN choreography nodes. A choreography node can have any number of participants labels at the top and bottom and one label for its name in the middle or on the upper left corner below the top participants.

Serialization and deserialization of the model and its parameter is done in the inner class ChoreographyLabelModel.Handler. An instance of this class must be registered with the GraphMLIOHandler used for reading/writing BPMN diagrams that contains choreography labels unless BpmnGraphMLIOHandler is used.

Important: Dragging labels of choreography nodes does not work well. Therefore the method createModelParameter(y.geom.OrientedRectangle, y.layout.NodeLayout) returns the default model parameter and label dragging is turned off in the BPMN edit mode BpmnView.BpmnEditMode.

 

Nested Class Summary
static class ChoreographyLabelModel.Handler
          Handles serialization and deserialization of the model and its parameter.
 
Field Summary
static byte NAME_CENTER
          Position specifier for name labels that are horizontally centered.
static byte NAME_TOP_LEFT
          Position specifier for name labels that are left aligned.
static byte PARTICIPANT_BOTTOM
          Position specifier for participant labels that are positioned at the top of a choreography node.
static byte PARTICIPANT_TOP
          Position specifier for participant labels that are positioned at the top of a choreography node.
 
Constructor Summary
ChoreographyLabelModel()
           
 
Method Summary
 Object createModelParameter(OrientedRectangle labelBounds, NodeLayout nodeLayout)
          Returns the default model parameter.
static NodeLabel createNameLabel(NodeRealizer realizer, byte position)
          Sets and returns the name label of the given node realizer for the given position.
static NodeLabel createParticipantLabel(NodeRealizer realizer, byte position)
          Adds and returns a new participant label to the given node realizer for the given position.
 Object getDefaultParameter()
          Returns the model parameter for the centered name.
 YList getLabelCandidates(NodeLabelLayout nl, NodeLayout nodeLayout)
          Returns a list of possible label candidates.
 OrientedRectangle getLabelPlacement(YDimension labelSize, NodeLayout nodeLayout, Object param)
          Returns the placement of a label with the given model parameter.
static NodeLabel getNameLabel(NodeRealizer realizer)
          Returns the name label of given node realizer.
static List getParticipantLabels(NodeRealizer realizer, byte position)
          Returns all participant labels of the given position.
static byte getPosition(Object modelParameter)
          Returns the positions specifier encoded in the specified model parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARTICIPANT_TOP

public static final byte PARTICIPANT_TOP
Position specifier for participant labels that are positioned at the top of a choreography node.

See Also:
createParticipantLabel(y.view.NodeRealizer, byte), Constant Field Values

PARTICIPANT_BOTTOM

public static final byte PARTICIPANT_BOTTOM
Position specifier for participant labels that are positioned at the top of a choreography node.

See Also:
createParticipantLabel(y.view.NodeRealizer, byte), Constant Field Values

NAME_CENTER

public static final byte NAME_CENTER
Position specifier for name labels that are horizontally centered.

See Also:
createNameLabel(y.view.NodeRealizer, byte), Constant Field Values

NAME_TOP_LEFT

public static final byte NAME_TOP_LEFT
Position specifier for name labels that are left aligned.

See Also:
createNameLabel(y.view.NodeRealizer, byte), Constant Field Values
Constructor Detail

ChoreographyLabelModel

public ChoreographyLabelModel()
Method Detail

createModelParameter

public Object createModelParameter(OrientedRectangle labelBounds,
                                   NodeLayout nodeLayout)
Returns the default model parameter. It is recommended not to use this method.

Specified by:
createModelParameter in interface NodeLabelModel

getDefaultParameter

public Object getDefaultParameter()
Returns the model parameter for the centered name.

Specified by:
getDefaultParameter in interface NodeLabelModel

getLabelPlacement

public OrientedRectangle getLabelPlacement(YDimension labelSize,
                                           NodeLayout nodeLayout,
                                           Object param)
Returns the placement of a label with the given model parameter.

Specified by:
getLabelPlacement in interface NodeLabelModel

getLabelCandidates

public YList getLabelCandidates(NodeLabelLayout nl,
                                NodeLayout nodeLayout)
Returns a list of possible label candidates.

Specified by:
getLabelCandidates in interface NodeLabelModel

getPosition

public static byte getPosition(Object modelParameter)
Returns the positions specifier encoded in the specified model parameter.

Parameters:
modelParameter - the model parameter from which the position specifier has to be extracted.
Returns:
the positions specifier encoded in the specified model parameter.
Throws:
IllegalArgumentException - if the specified model parameter is not valid for this model.
See Also:
NAME_CENTER, NAME_TOP_LEFT, PARTICIPANT_BOTTOM, PARTICIPANT_TOP

getNameLabel

public static NodeLabel getNameLabel(NodeRealizer realizer)
Returns the name label of given node realizer.

Returns:
the name label of given node realizer or null if there is no name label.

getParticipantLabels

public static List getParticipantLabels(NodeRealizer realizer,
                                        byte position)
Returns all participant labels of the given position.

Parameters:
position - either ChoreographyLabelModel.PARTICIPANT_TOP or ChoreographyLabelModel.PARTICIPANT_BOTTOM.
Returns:
a list of all participant labels at the specified position.
Throws:
IllegalArgumentException - if the specified position does not equal any of the position constants defined by this class.

createParticipantLabel

public static NodeLabel createParticipantLabel(NodeRealizer realizer,
                                               byte position)
Adds and returns a new participant label to the given node realizer for the given position.

Parameters:
position - either ChoreographyLabelModel.PARTICIPANT_TOP or ChoreographyLabelModel.PARTICIPANT_BOTTOM.
Returns:
a properly configured node label.
Throws:
IllegalArgumentException - if the specified position does not equal any of the position constants defined by this class.

createNameLabel

public static NodeLabel createNameLabel(NodeRealizer realizer,
                                        byte position)
Sets and returns the name label of the given node realizer for the given position. An existing name label will be removed, because a choreography realizer may have at most one name label.

Parameters:
position - either ChoreographyLabelModel.NAME_CENTER or ChoreographyLabelModel.NAME_TOP_LEFT.
Returns:
a properly configured node label.
Throws:
IllegalArgumentException - if the specified position does not equal any of the position constants defined by this class.


© Copyright 2010-2014,
yWorks GmbH.
All rights reserved.