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

The following examples show how to use org.eclipse.draw2d.PolylineConnection#setSourceDecoration() . 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: RelationEditPart.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@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()));
    }
}
 
Example 2
Source File: RelationEditPart.java    From erflute with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example 3
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 4
Source File: RelationEditPart.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void refreshVisuals() {
	super.refreshVisuals();

	ERDiagram diagram = this.getDiagram();

	if (diagram != null) {
		Relation relation = (Relation) this.getModel();

		PolylineConnection connection = (PolylineConnection) this
				.getConnectionFigure();

		String notation = diagram.getDiagramContents().getSettings()
				.getNotation();

		Decoration decoration = DecorationFactory.getDecoration(notation,
				relation.getParentCardinality(), relation
						.getChildCardinality());

		connection.setSourceDecoration(decoration.getSourceDecoration());
		connection.setTargetDecoration(decoration.getTargetDecoration());
		targetLabel.setText(Format.null2blank(decoration.getTargetLabel()));
	}

	this.calculateAnchorLocation();

	this.refreshBendpoints();
}