Type: Fast Track
Target Milestone: Netbeans 6.5
The method AnchorShape.getCutDistance() specifies a point along the connection widget's path where the connection widget should stop painting. This feature was designed to stop rendering the connection at the edge of an anchor's shape. Custom AnchorShapes could be created to draw the shape at a distance away from the Anchor widgets. However, that would mean that users of the API would have to make a personal copy of the standard AnchorShapes to provide this functionality.
A second problem is how to determine the distance to translate the AnchorShape. In the case where an Annotation is placed between the AnchorShape and the Anchor Widget, the annocation may not be square, but instead a rectangle.
![]() |
Therefore, when the connection is horizontal the distance would be different than when the connection is vertical. To solve this problem an interface called AnchorShapeLocationResolver should be used to resove the distance between the Anchor widget and the AnchorShape.
UML needs to be able to create qualifier labels that are placed on the ends of associations. The association will still have AnchorShapes that represent Aggregation, Composition, and Navigability. See the image above for an example.
public interface AnchorShapeLocationResolver
{
public int getEndLocation();
}
/**
* Creates a proxy AnchorShape that is used to adjust the location of an AnchorShape.
* The associated AnchorShape will fit on the outside of the attached widget.
*/
public static AnchorShape createAdjustableAnchorShape(AnchorShape shape,
ConnectionWidget owner,
ConnectionEnd referencingEnd,
Widget attachedWidget)
/** * Creates a proxy AnchorShape that is used to adjust the location of an AnchorShape. * the location of the associated AnchorShape will be determined by a * AnchorShapeLocationResolver. */ public static AnchorShape createAdjustableAnchorShape(AnchorShape shape, AnchorShapeLocationResolver resolver)
When you use a resolver to move the anchor shape, other parts of the code may need to also be able to determine the location of the arrow head.
/**
* Creates a AnchorShapeLocationResolver that uses a widget to resolve the AnchorsShapes location.
*/
public static AnchorShapeLocationResolver createWidgetResolver(ConnectionWidget owner,
ConnectionEnd referencingEnd,
Widget attachedWidget)
The only API class that will be impacted is the AnchorShapeFactory. The factory will recieve three new methods.
<change>
<api name="general"/>
<summary>New Attachable AnchorShape.</summary>
<version major="2" minor="13"/>
<date day="22" month="4" year="2008"/>
<author login="tspiva"/>
<compatibility addition="yes"/>
<description>
The new anchor shape can wrap an existing anchor shape and provide
a new cut distance. One example of when an attachable anchor
shape would be used is when a label on a connection widget is
to be placed between the anchor shape and the related widget.
</description>
<class package="org.netbeans.api.visual.anchor" name="AnchorShapeFactory" link="yes"/>
<class package="org.netbeans.api.visual.anchor" name="AnchorShapeLocationResolver" link="yes"/>
<issue number="128348"/>
</change>
| NiceQualifier.png | ![]() |
14578 bytes |