本文整理汇总了Java中org.eclipse.draw2d.PolylineConnection类的典型用法代码示例。如果您正苦于以下问题:Java PolylineConnection类的具体用法?Java PolylineConnection怎么用?Java PolylineConnection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PolylineConnection类属于org.eclipse.draw2d包,在下文中一共展示了PolylineConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createConnections
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
public void createConnections ( final Layer layer, final SymbolController controller, final EList<Connection> connections )
{
if ( connections == null )
{
return;
}
for ( final Connection connection : connections )
{
final Controller start = AdapterHelper.adapt ( controller.getElement ( connection.getStart () ), Controller.class );
final Controller end = AdapterHelper.adapt ( controller.getElement ( connection.getEnd () ), Controller.class );
if ( start != null && end != null )
{
final PolylineConnection c = new PolylineConnection ();
c.setSourceAnchor ( new ChopboxAnchor ( start.getFigure () ) );
c.setTargetAnchor ( new ChopboxAnchor ( end.getFigure () ) );
c.setAntialias ( SWT.ON );
layer.add ( c );
}
}
}
示例3: refresh
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
private void refresh(RuntimeModel model, RuntimeModel.Event<?> event) {
PandionJUI.executeUpdate(() -> {
if(event.type == RuntimeModel.Event.Type.NEW_STACK)
rebuildStack(model);
else if(event.type == RuntimeModel.Event.Type.REMOVE_FRAME) {
StackFrameModel f = (StackFrameModel) event.arg;
stackFig.removeFrame(f);
List<?> children = rootFig.getChildren();
for (IReferenceModel v : f.getReferenceVariables()) {
PolylineConnection c = pointersMap.remove(v);
if(c != null && children.contains(c))
rootFig.remove(c);
}
}
else if(event.type == RuntimeModel.Event.Type.NEW_FRAME) {
StackFrameModel frame = (StackFrameModel) event.arg;
if(!frame.isInstance())
stackFig.addFrame(frame, this, objectContainer, false);
}
stackFig.getLayoutManager().layout(stackFig);
updateLayout();
clearItem.setEnabled(model.isTerminated());
});
}
示例4: addPointerObserver
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
private void addPointerObserver(IReferenceModel ref, PolylineConnection pointer) {
ref.registerDisplayObserver(new ModelObserver<IEntityModel>() {
@Override
public void update(IEntityModel arg) {
IEntityModel target = ref.getModelTarget();
Point prevLoc = pointer.getTargetAnchor().getOwner().getBounds().getLocation();
PandionJFigure<?> targetFig = figProvider.getFigure(target);
if(!containsChild(pane, targetFig)) {
addEntityFigure(ref, targetFig, prevLoc);
y += targetFig.getPreferredSize().height + Constants.OBJECT_PADDING;
updateSize();
}
pointer.setTargetAnchor(new ChopboxAnchor(targetFig));
setPointerDecoration(target, pointer);
}
});
}
示例5: makeConnection
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
private PolylineConnection makeConnection(IFigure contents, IFigure source, NodeFigure target, Color color) {
PolylineConnection c = new PolylineConnection();
ConnectionAnchor targetAnchor = new ChopboxAnchor(target);
c.setTargetAnchor(targetAnchor);
c.setSourceAnchor(new ChopboxAnchor(source));
PolygonDecoration decoration = new PolygonDecoration();
decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
c.setTargetDecoration(decoration);
c.setForegroundColor(color);
ConnectionMouseListener listener = new ConnectionMouseListener(c);
c.addMouseMotionListener(listener);
c.addMouseListener(listener);
c.setCursor(Cursors.HAND);
contents.add(c);
connections.add(c);
return c;
}
示例6: decorateRelation
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
// @Override
// public void refreshVisuals() {
// super.refreshVisuals();
//
// }
@Override
protected void decorateRelation() {
final ERDiagram diagram = getDiagram();
if (diagram != null) {
final Relation relation = (Relation) getModel();
final PolylineConnection connection = (PolylineConnection) getConnectionFigure();
final String notation = diagram.getDiagramContents().getSettings().getNotation();
final Decoration decoration = DecorationFactory.getDecoration(notation, relation.getParentCardinality(), relation.getChildCardinality());
connection.setSourceDecoration(decoration.getSourceDecoration());
connection.setTargetDecoration(decoration.getTargetDecoration());
targetLabel.setText(Format.null2blank(decoration.getTargetLabel()));
}
}
示例7: setNameLabel
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#setNameLabel(nexcore.tool.uml.model.umldiagram.Relation,
* java.lang.String)
*/
@Override
protected IFigure setNameLabel(Relation relation, String name) {
PolylineConnection connection = (PolylineConnection) figure;
if (nameLabel != null) {
getFigure().remove(nameLabel);
}
nameLabel = new Label(name);
MessageLabelLocator nameLabelLocator = new MessageLabelLocator(connection, LabelType.LABEL, true);
figure.add(nameLabel, nameLabelLocator);
return figure;
}
示例8: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
PolylineConnection connection = new PolylineConnection() {
@Override
public void paintFigure(Graphics graphics) {
graphics.setAntialias(SWT.ON);
super.paintFigure(graphics);
}
};
connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
PolygonDecoration polygonDecoreation = new PolygonDecoration();
polygonDecoreation.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
polygonDecoreation.setScale(10, 5);
connection.setTargetDecoration(polygonDecoreation);
connection.addRoutingListener(RoutingAnimator.getDefault());
connection.setConnectionRouter(new BendpointConnectionRouter());
return connection;
}
示例9: refreshVisuals
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
@Override
protected void refreshVisuals() {
super.refreshVisuals();
final ERDiagram diagram = getDiagram();
if (diagram != null) {
final Relationship relation = (Relationship) getModel();
final PolylineConnection connection = (PolylineConnection) getConnectionFigure();
final String notation = diagram.getDiagramContents().getSettings().getNotation();
final Decoration decoration =
DecorationFactory.getDecoration(notation, relation.getParentCardinality(), relation.getChildCardinality());
connection.setSourceDecoration(decoration.getSourceDecoration());
connection.setTargetDecoration(decoration.getTargetDecoration());
targetLabel.setText(Format.null2blank(decoration.getTargetLabel()));
}
calculateAnchorLocation();
refreshBendpoints();
}
示例10: 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;
}
示例11: createRoleEquivalenceFigure
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
/**
* {@link Relation}s from type roleequivalence have as figure a dashed line with a white arrow
* tips at both connection ends.
*
* @return conn org.eclipse.draw2d.PolylineConnection
*/
private static Figure createRoleEquivalenceFigure() {
// create white arrow tip 1
PolygonDecoration poly1 = new PolygonDecoration();
poly1.setAntialias(SWT.ON);
poly1.setBackgroundColor(ColorConstants.white);
poly1.setScale(5, 5);
// create white arrow tip 2
PolygonDecoration poly2 = new PolygonDecoration();
poly2.setAntialias(SWT.ON);
poly2.setBackgroundColor(ColorConstants.white);
poly2.setScale(5, 5);
PolylineConnection conn = new PolylineConnection();
conn.setAntialias(SWT.ON);
conn.setLineDash(new float[] {5.0f, 5.0f});
conn.setLineStyle(SWT.LINE_CUSTOM);
// add white arrow tip 1
conn.setTargetDecoration(poly1);
// add white arrow tip 2
conn.setSourceDecoration(poly2);
conn.setConnectionRouter(new BendpointConnectionRouter());
return conn;
}
示例12: createRoleRelationshipImplicationFigure
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
/**
* {@link Relations}s from type roleimplication and relationshipimplication have as figure a
* dashed line with a white arrow tip at target end of this connection.
*
* @return conn org.eclipse.draw2d.PolylineConnection
*/
private static Figure createRoleRelationshipImplicationFigure() {
// create white arrow tip
PolygonDecoration poly = new PolygonDecoration();
poly.setAntialias(SWT.ON);
poly.setBackgroundColor(ColorConstants.white);
poly.setScale(5, 5);
PolylineConnection conn = new PolylineConnection();
conn.setAntialias(SWT.ON);
conn.setLineDash(new float[] {5.0f, 5.0f});
conn.setLineStyle(SWT.LINE_CUSTOM);
conn.setTargetDecoration(poly);
conn.setConnectionRouter(new BendpointConnectionRouter());
return conn;
}
示例13: createRoleRelationshipExclusionFigure
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
/**
*
* {@link Relations}s from type roleprohibition and relationshipexclusion have as figure a
* dashed line with a white arrow tip at target end of this connection.
*
* @return conn org.eclipse.draw2d.PolylineConnection
* */
private static Figure createRoleRelationshipExclusionFigure() {
// create white arrow tip
PolylineDecoration poly1 = new PolylineDecoration();
poly1.setTemplate(INVERTED_TRIANGLE_TIP);
poly1.setAntialias(SWT.ON);
poly1.setBackgroundColor(ColorConstants.black);
poly1.setScale(5, 5);
PolylineDecoration poly2 = new PolylineDecoration();
poly2.setTemplate(INVERTED_TRIANGLE_TIP);
poly2.setAntialias(SWT.ON);
poly2.setBackgroundColor(ColorConstants.black);
poly2.setScale(5, 5);
PolylineConnection conn = new PolylineConnection();
conn.setAntialias(SWT.ON);
conn.setLineDash(new float[] {5.0f, 5.0f});
conn.setLineStyle(SWT.LINE_CUSTOM);
conn.setTargetDecoration(poly1);
conn.setSourceDecoration(poly2);
conn.setConnectionRouter(new BendpointConnectionRouter());
return conn;
}
示例14: createRoleProhibitonFigure
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
/**
* {@link Relation}s from type roleprohibition have as figure a dased line with two inverted and
* open arrow tips at both ends of this connection.
*
* @return conn org.eclipse.draw2d.PolylineConnection
*/
private static Figure createRoleProhibitonFigure() {
PolylineDecoration poly1 = new PolylineDecoration();
poly1.setTemplate(INVERTED_TRIANGLE_TIP);
poly1.setAntialias(SWT.ON);
poly1.setBackgroundColor(ColorConstants.black);
poly1.setScale(5, 5);
PolylineDecoration poly2 = new PolylineDecoration();
poly2.setTemplate(INVERTED_TRIANGLE_TIP);
poly2.setAntialias(SWT.ON);
poly2.setBackgroundColor(ColorConstants.black);
poly2.setScale(5, 5);
PolylineConnection conn = new PolylineConnection();
conn.setAntialias(SWT.ON);
conn.setLineDash(new float[] {5.0f, 5.0f});
conn.setLineStyle(SWT.LINE_CUSTOM);
conn.setTargetDecoration(poly1);
conn.setSourceDecoration(poly2);
conn.setConnectionRouter(new BendpointConnectionRouter());
return conn;
}
示例15: setSelected
import org.eclipse.draw2d.PolylineConnection; //导入依赖的package包/类
public void setSelected(int value) {
super.setSelected(value);
if (value != EditPart.SELECTED_NONE)
{
((PolylineConnection) getFigure()).setLineWidth(2);
FunctionColumnModelEditPart source=(FunctionColumnModelEditPart) this.getSource();
source.getFigure().setBackgroundColor(ColorConstants.titleGradient);
FunctionColumnModelEditPart target=(FunctionColumnModelEditPart) this.getTarget();
target.getFigure().setBackgroundColor(ColorConstants.titleGradient);
}
else {
((PolylineConnection) getFigure()).setLineWidth(1);
source=(FunctionColumnModelEditPart) this.getSource();
target=(FunctionColumnModelEditPart) this.getTarget();
if(source!=null&&target!=null)
{
target.getFigure().setBackgroundColor(ColorConstants.white);
source.getFigure().setBackgroundColor(ColorConstants.white);
}
}
}