Java Code Examples for org.eclipse.draw2d.PolylineConnection#setForegroundColor()

The following examples show how to use org.eclipse.draw2d.PolylineConnection#setForegroundColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected IFigure createFigure() {
	Link link = (Link) getModel();
	link.editPart = this;
	SankeyDiagram editor = ((ProductSystemNode) link.sourceNode.parent).editor;
	PolylineConnection conn = new LinkFigure(link.getWidth(), editor);
	if (editor.isRouted()) {
		conn.setConnectionRouter(ROUTER);
	} else {
		conn.setConnectionRouter(ConnectionRouter.NULL);
	}
	link.figure = conn;
	conn.setTolerance(0);
	conn.setForegroundColor(link.getColor());
	return conn;
}
 
Example 2
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected IFigure createFigure() {
	PolylineConnection figure = new PolylineConnection();
	figure.setForegroundColor(Link.COLOR);
	figure.setConnectionRouter(getConnectionRouter());
	figure.setTargetDecoration(new PolygonDecoration());
	figure.setVisible(isVisible());
	getModel().figure = figure;
	return figure;
}
 
Example 3
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void setSelected(int value) {
	if (!getFigure().isVisible())
		return;
	PolylineConnection figure = (PolylineConnection) getFigure();
	if (value != EditPart.SELECTED_NONE) {
		figure.setLineWidth(2);
		figure.setForegroundColor(Link.HIGHLIGHT_COLOR);
	} else {
		figure.setLineWidth(1);
		figure.setForegroundColor(Link.COLOR);
	}
	super.setSelected(value);
}
 
Example 4
Source File: ProcessLinkCreatePolicy.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected Connection createDummyConnection(Request req) {
	PolylineConnection con = (PolylineConnection) super.createDummyConnection(req);
	con.setForegroundColor(Link.COLOR);
	if (!(req instanceof CreateConnectionRequest)) {
		con.setTargetDecoration(new PolygonDecoration());
		return con;
	}
	CreateLinkCommand cmd = (CreateLinkCommand) ((CreateConnectionRequest) req).getStartCommand();
	if (cmd.output != null)
		con.setTargetDecoration(new PolygonDecoration());
	else if (cmd.input != null)
		con.setSourceDecoration(new PolygonDecoration());
	return con;
}
 
Example 5
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void setSelected(int value) {
	PolylineConnection figure = (PolylineConnection) getFigure();
	Link link = ((Link) getModel());
	if (value != EditPart.SELECTED_NONE) {
		figure.setForegroundColor(Link.HIGHLIGHT_COLOR);
	} else {
		figure.setForegroundColor(link.getColor());
	}
	super.setSelected(value);
}