本文整理汇总了Java中org.eclipse.draw2d.PolylineConnection.setLineStyle方法的典型用法代码示例。如果您正苦于以下问题:Java PolylineConnection.setLineStyle方法的具体用法?Java PolylineConnection.setLineStyle怎么用?Java PolylineConnection.setLineStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.PolylineConnection
的用法示例。
在下文中一共展示了PolylineConnection.setLineStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: setConnectionState
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
* Set graphics attribute according to the connection state
*
* @param connection
* the connection to change
* @param state
* the state
*/
protected void setConnectionState ( final PolylineConnection connection, final boolean state )
{
final PolygonDecoration dec = new PolygonDecoration ();
dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP );
connection.setLineStyle ( state ? Graphics.LINE_SOLID : Graphics.LINE_DOT );
connection.setLineWidth ( state ? 2 : 1 );
connection.setTargetDecoration ( state ? dec : null );
}
示例7: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
@Override
protected IFigure createFigure() {
final PolylineConnection res = (PolylineConnection)super.createFigure();
res.setLineWidth(1);
// PolygonDecoration decoration = new PolygonDecoration();
// decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
// res.setTargetDecoration(decoration);
res.setLineStyle(SWT.LINE_SOLID);
res.setBackgroundColor(ColorConstants.listForeground);
return res;
}
示例8: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
@Override
protected IFigure createFigure() {
PolylineConnection connection = (PolylineConnection) super
.createFigure();
connection.addRoutingListener(RoutingAnimator.getDefault());
connection.setTargetDecoration(new PolygonDecoration());
connection.setLineStyle(getCastedModel().getLineStyle());
return connection;
}
示例9: 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.setLineStyle(SWTGraphics.LINE_DASH);
connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
return connection;
}
示例10: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
Relation relation = (Relation) getModel();
PolylineConnection connection = (PolylineConnection) super.createFigure();
connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
connection.addRoutingListener(RoutingAnimator.getDefault());
connection.setConnectionRouter(new BendpointConnectionRouter());
if (RelationType.SYNCHRONOUS_MESSAGE.equals(relation.getRelationType())) {
return connection;
} else if (RelationType.ASYNCHRONOUS_MESSAGE.equals(relation.getRelationType())) {
PolylineDecoration poly = new PolylineDecoration();
PointList p = new PointList();
p.addPoint(0, 0);
p.addPoint(-1, -1);
p.addPoint(-1, 1);
poly.setPoints(p);
poly.setScale(10, 5);
connection.setTargetDecoration(poly);
connection.setLineStyle(Graphics.LINE_SOLID);
return connection;
} else if (RelationType.REPLY_MESSAGE.equals(relation.getRelationType())) {
connection.setLineStyle(Graphics.LINE_DOT);
return connection;
} else if (RelationType.CREATE_MESSAGE.equals(relation.getRelationType())) {
return connection;
} else if (RelationType.DESTROY_MESSAGE.equals(relation.getRelationType())) {
return connection;
} else {
return connection;
}
}
示例11: 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());
connection.setLineStyle(SWT.LINE_DASH);
return connection;
}
示例12: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
* Creates a Connection and adds appropriate decorations.
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
protected IFigure createFigure() {
PolylineConnection connection = new PolylineConnection();
connection.setLineWidth(2);
connection.setLineStyle(SWT.LINE_DASH);
connection.setAntialias(GeneralPreferencePage.getAntialiasingPref());
return connection;
}
示例13: createFigure
import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
protected IFigure createFigure() {
PolylineConnection connection = (PolylineConnection) super
.createFigure();
connection.setTargetDecoration(new PolygonDecoration()); // arrow at
// target
// endpoint
connection.setLineStyle(getCastedModel().getLineStyle()); // line
// drawing
// style
return connection;
}
示例14: 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.addFigureListener(new FigureListener() {
/**
* @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure)
*/
@SuppressWarnings("unchecked")
public void figureMoved(IFigure source) {
Point sourcePoint = ((PolylineConnection) source).getStart();
Point targetPoint = ((PolylineConnection) source).getEnd();
RootEditPart rootEditPart = (RootEditPart) getParent();
List<EditPart> diagramEditparts = new ArrayList<EditPart>();
diagramEditparts = rootEditPart.getChildren();
List<EditPart> editParts = new ArrayList<EditPart>();
for (EditPart diagramEditPart : diagramEditparts) {
editParts = diagramEditPart.getChildren();
for (EditPart editpart : editParts) {
if (editpart.getModel() instanceof LabelNode) {
if (((LabelNode) editpart.getModel()).getOwner() == getModel())
if (editpart instanceof LabelNodeEditPart) {
((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint);
}
}
}
}
}
});
// PolygonDecoration polygonDecoreation = new PolygonDecoration();
// polygonDecoreation.setScale(10,5);
// connection.setTargetDecoration(polygonDecoreation);
// connection.setLineStyle(SWT.LINE_DOT);
// connection.addRoutingListener(RoutingAnimator.getDefault());
// connection.setConnectionRouter(new BendpointConnectionRouter());
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.setLineStyle(SWT.LINE_DOT);
connection.setTargetDecoration(polygonDecoreation);
connection.addRoutingListener(RoutingAnimator.getDefault());
connection.setConnectionRouter(new BendpointConnectionRouter());
return connection;
}
示例15: 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.setLineStyle(Graphics.LINE_DOT);
ArrowDecoration arrow = new ArrowDecoration();
connection.setTargetDecoration(arrow);
connection.addRoutingListener(RoutingAnimator.getDefault());
connection.setConnectionRouter(new BendpointConnectionRouter());
connection.addFigureListener(new FigureListener() {
/**
* @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure)
*/
@SuppressWarnings("unchecked")
public void figureMoved(IFigure source) {
Point sourcePoint = ((PolylineConnection) source).getStart();
Point targetPoint = ((PolylineConnection) source).getEnd();
RootEditPart rootEditPart = (RootEditPart) getParent();
List<EditPart> diagramEditparts = new ArrayList<EditPart>();
diagramEditparts = rootEditPart.getChildren();
List<EditPart> editParts = new ArrayList<EditPart>();
for (EditPart diagramEditPart : diagramEditparts) {
editParts = diagramEditPart.getChildren();
for (EditPart editpart : editParts) {
if (editpart.getModel() instanceof LabelNode) {
if (((LabelNode) editpart.getModel()).getOwner() == getModel())
if (editpart instanceof LabelNodeEditPart) {
((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint);
}
}
}
}
}
});
return connection;
}