本文整理汇总了Java中org.eclipse.draw2d.PolylineConnection.add方法的典型用法代码示例。如果您正苦于以下问题:Java PolylineConnection.add方法的具体用法?Java PolylineConnection.add怎么用?Java PolylineConnection.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.PolylineConnection
的用法示例。
在下文中一共展示了PolylineConnection.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRoundArrow
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
private void createRoundArrow ( final Figure figure )
{
final PolylineConnection c = new PolylineConnection ();
c.setSourceAnchor ( new ChopboxAnchor ( this.sourceRect ) );
c.setTargetAnchor ( new ChopboxAnchor ( this.targetRect ) );
final PolygonDecoration dec = new PolygonDecoration ();
dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP );
c.setTargetDecoration ( dec );
final MidpointLocator typeLocator = new MidpointLocator ( c, 0 );
typeLocator.setRelativePosition ( PositionConstants.NORTH );
this.typeLabel = new Label ( "" ); //$NON-NLS-1$
c.add ( this.typeLabel, typeLocator );
figure.add ( c );
this.roundConnection = c;
}
示例2: createRelationshipConstraintFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
* This method creates and returns the figure for {@link Relation}s from type cyclic, total, acyclic, reflexive and
* irreflexive, which differs from relationshipConstraint to relationshipConstraint only in the
* text of the {@link Label}. A cyclic, total, acyclic, reflexive or irreflexive figure is dashed line with a
* {@link Label}.
*
* @return conn org.eclipse.draw2d.PolylineConnection
* */
private static Figure createRelationshipConstraintFigure(Relation relation, EditPart editpart) {
ORMRelationshipConstraintEditPart editP = (ORMRelationshipConstraintEditPart) editpart;
editP.getLabel().setText(relation.getName());
editP.setTextInitial(relation.getName());
PolylineConnection conn = new PolylineConnection();
conn.setAntialias(SWT.ON);
conn.setLineDash(new float[] {5.0f, 5.0f});
conn.setLineStyle(SWT.LINE_CUSTOM);
conn.setConnectionRouter(new BendpointConnectionRouter());
// add label to the connection
ConnectionLocator loc = new ConnectionLocator(conn, ConnectionLocator.MIDDLE);
loc.setRelativePosition(PositionConstants.SOUTH);
loc.setGap(5);
// this is needed, because when the label would be just added the label text could be seen in
// the rootModel
if (editP.getRoot().getContents() instanceof ORMCompartmentEditPart) {
conn.add(editP.getLabel(), loc);
}
return conn;
}
示例3: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
@Override
protected IFigure createFigure() {
final boolean bezier = getDiagram().getDiagramContents().getSettings().isUseBezierCurve();
final PolylineConnection connection = new ERDiagramConnection(bezier);
connection.setConnectionRouter(new BendpointConnectionRouter());
final ConnectionEndpointLocator targetLocator = new ConnectionEndpointLocator(connection, true);
this.targetLabel = new Label("");
connection.add(targetLabel, targetLocator);
return connection;
}
示例4: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
protected IFigure createFigure() {
PolylineConnection conn = new PolylineConnection();
conn.setTargetDecoration(new PolygonDecoration());
conn.setConnectionRouter(new BendpointConnectionRouter());
final Label label = new Label("Conn");
label.setOpaque(true);
conn.add(label, new MidpointLocator(conn, 0));
return conn;
}
示例5: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
protected IFigure createFigure() {
nodeConn = (MessageRoute)getModel();
PolylineConnection conn = new PolylineConnection();
conn.setTargetDecoration(new PolygonDecoration());
router = new CommonStyleRouter(nodeConn.getStyle());
conn.setConnectionRouter(router);
conn.setForegroundColor(ColorConstants.black);
label = new Label();
label.setText(nodeConn.getRouteId());
label.setOpaque(true);
conn.add(label, new MidpointLocator(conn, 0));
return conn;
}
示例6: createFulfillmentFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
* {@link Relation}s from type fulfillment have as figure a drawn through line with a
* {@link Label} at the connection end that contains the names of the {@link Shape}s from type
* roletype and rolegroup that are fulfilled from the source of this fulfillment and a black arrow
* tip at the target end of the connection.
*
* @return conn org.eclipse.draw2d.PolylineConnection
*/
private static Figure createFulfillmentFigure(Relation relation, EditPart editPart) {
PartFigure tooltipTarget = new PartFigure();
PolylineConnection conn = new PolylineConnection();
conn.setAntialias(SWT.ON);
// create the black arrow tip
PolygonDecoration poly = new PolygonDecoration();
poly.setAntialias(SWT.ON);
poly.setBackgroundColor(ColorConstants.black);
poly.setScale(5, 5);
// add the the black arrow tip
conn.setTargetDecoration(poly);
conn.setConnectionRouter(new BendpointConnectionRouter());
// add target Label
ConnectionEndpointLocator targetEndL = new ConnectionEndpointLocator(conn, true);
targetEndL.setVDistance(-1);
targetEndL.setUDistance(1);
// add to the targetLabel the initial roletype and the rolegroup names in the fulfilledrole list
Label label = new Label("<...>");
int roleCount = 0;
for (Shape role : relation.getReferencedRoles()) {
if (label.getText().equals("<...>")) {
label.setText(role.getName());
} else {
if (roleCount > 2) {
tooltipTarget.add(new Label(role.getName()));
} else {
label.setText(label.getText() + ", " + role.getName());
}
}
roleCount++;
}
label.setToolTip(tooltipTarget);
conn.add(label, targetEndL);
if (editPart instanceof ORMFulfillmentEditPart) {
((ORMFulfillmentEditPart) editPart).setTargetLabel(label);
((ORMFulfillmentEditPart) editPart).setTargetToolTip(tooltipTarget);
}
return conn;
}