Modeling T-Connections Using Edge Labels

Tips & Tricks

Summary

T-style connections like they are described in modeling notations such as UML can be easily realized using edge labels.
For a better user experience, please go to the integrated documentation viewer to read this article.

Description

T-style connections as shown in the below figure can be modeled using an edge label having an additional line that visually links the label box to its edge.

T-connection

Tutorial demo application YLabelConfigurationDemo.java presents the setup for a label configuration that uses a customized implementation for the YLabel.Painter interface which draws a light gray line between the edge and the label. A special helper class ensures that the line is drawn perpendicular to the edge's path.

When used in conjuction with a layout algorithm that provides support for integrated edge labeling, like, e.g., orthogonal layout, the edge label is placed near its edge and the T-style connection can be nicely observed.

Please note that the scheme presented in YLabelConfigurationDemo only suits for modeling annotations that belong to a single edge. Tutorial demo application EdgeConnectorDemo.java shows a solution that allows to model annotations belonging to multiple edges.

Categories this article belongs to:
yFiles for Java > yFiles Viewer > Displaying and Editing Graphs > Realizer-Related Features
Applies to:
yFiles for Java 2: 2.5, 2.6, 2.7, 2.8, 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18
Keywords:
T-connector - T-connection - edge - label - EdgeLabel - BPMN - UML - link - notation - modeling - configuration - painter - integrated - labeling