org.eclipse.draw2d.PolygonDecoration Java Examples

The following examples show how to use org.eclipse.draw2d.PolygonDecoration. 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: RoundDetailsPart.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: CustomSequenceFlowEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @generated
 */
private RotatableDecoration createTargetDecoration() {
    final PolygonDecoration df = new PolygonDecoration();
    df.setFill(true);
    df.setBackgroundColor(ColorConstants.black);
    final PointList pl = new PointList();
    pl.addPoint(getMapMode().DPtoLP(0)
            , getMapMode().DPtoLP(0)
            );
    pl.addPoint(getMapMode().DPtoLP(-1)
            , getMapMode().DPtoLP(1)
            );
    pl.addPoint(getMapMode().DPtoLP(-1)
            , getMapMode().DPtoLP(-1)
            );
    pl.addPoint(getMapMode().DPtoLP(0)
            , getMapMode().DPtoLP(0)
            );
    df.setTemplate(pl);
    df.setScale(getMapMode().DPtoLP(7)
            , getMapMode().DPtoLP(3)
            );
    return df;
}
 
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: CursorTimingsLayer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public CursorConnection(CursorFigure sorce, CursorFigure target, Dimension distance) {
	fSorce = sorce;
	fTarget = target;
	setForegroundColor(ColorConstants.yellow);
	setLineStyle(SWT.LINE_DOT);

	setSourceAnchor(new CursorAnchor(sorce, distance.height()));
	setTargetAnchor(new CursorAnchor(target, distance.height()));
	setTargetDecoration(new PolygonDecoration());
	fCursorLabel = new CursorLabel(getDistanceAsText(sorce, target));
	add(fCursorLabel, new CursorConnectionLocator(this, distance.width()));
}
 
Example #5
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 #6
Source File: SequenceFlowEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @generated
 */
private RotatableDecoration createTargetDecoration() {
	PolygonDecoration df = new PolygonDecoration();
	df.setFill(true);
	df.setBackgroundColor(ColorConstants.black);
	PointList pl = new PointList();
	pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
	pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(1));
	pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(-1));
	pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
	df.setTemplate(pl);
	df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
	return df;
}
 
Example #7
Source File: MessageFlowEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @generated
 */
private RotatableDecoration createTargetDecoration() {
	PolygonDecoration df = new PolygonDecoration();
	df.setFill(true);
	df.setBackgroundColor(ColorConstants.white);
	PointList pl = new PointList();
	pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
	pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(1));
	pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(-1));
	pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
	df.setTemplate(pl);
	df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
	return df;
}
 
Example #8
Source File: CustomSequenceFlowEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private RotatableDecoration createConditionalSourceDecoration() {
    final PolygonDecoration df = new PolygonDecoration();
    df.setFill(true);
    df.setLineWidth(1);
    df.setBackgroundColor(ColorConstants.white);
    final PointList pl = new PointList();
    pl.addPoint(0, 0);
    pl.addPoint(-1, 1);
    pl.addPoint(-2, 0);
    pl.addPoint(-1, -1);
    df.setTemplate(pl);
    df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(5));
    return df;
}
 
Example #9
Source File: ColumnConnection.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public ColumnConnection( )
{
	this.setOutline( true );
	joinTypeIcon = new Label( "" ); //$NON-NLS-1$
	joinTypeIcon.setLabelAlignment( 1 );
	joinTypeIcon.setTextPlacement( 20 );
	joinTypeIcon.setIcon( UIHelper.getImage( BuilderConstants.IMAGE_JOINS ) );
	this.add( joinTypeIcon );
	this.setConnectionRouter( null );
	
	// Decoration to Indicate the Join Directrion
	joinDirection  = new PolygonDecoration();
	joinDirection.setForegroundColor(ColorConstants.darkBlue);
	this.setTargetDecoration(joinDirection);
}
 
Example #10
Source File: EntityFigureListener.java    From JDeodorant with MIT License 5 votes vote down vote up
public void mouseEntered(MouseEvent me) {

		List<JConnection> connections = figure.getOutgoingConnections();
		for(JConnection connection: connections){

			connection.setLineWidth(3);
			Label l = connection.getLabel();

			if(l != null){

				//String fontStyle = "Arial";
				ConnectionEndpointLocator locator = new ConnectionEndpointLocator(connection, true);

				if(connection.isWrite()){
					locator.setUDistance(95);
					locator.setVDistance(0);
				} else{
					locator.setUDistance(42);
					locator.setVDistance(0);
				}


				//l.setFont(new Font(null, fontStyle, 14 , SWT.BOLD));
				l.setFont(DecorationConstants.highlightFont);

				connection.add(l, locator);
			}

			PolygonDecoration decoration = new PolygonDecoration();
			decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
			decoration.setSize(20, 20);
			decoration.setBackgroundColor(connection.getForegroundColor());
			connection.setTargetDecoration(decoration);
		}
	}
 
Example #11
Source File: JConnection.java    From JDeodorant with MIT License 5 votes vote down vote up
public PolylineConnection setReadStyle(){
	PolygonDecoration decoration = new PolygonDecoration();
	decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
	decoration.setBackgroundColor(ColorConstants.black);
	this.setTargetDecoration(decoration);

	this.setForegroundColor(ColorConstants.darkBlue);

	return this;
}
 
Example #12
Source File: JConnection.java    From JDeodorant with MIT License 5 votes vote down vote up
public PolylineConnection setWriteStyle(){
	isWrite = true;
	PolygonDecoration decoration = new PolygonDecoration();
	decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
	decoration.setBackgroundColor(ColorConstants.red);
	this.setTargetDecoration(decoration);
	this.setForegroundColor(ColorConstants.red);

	return this;
}
 
Example #13
Source File: JConnection.java    From JDeodorant with MIT License 5 votes vote down vote up
public PolylineConnection setMethodToMethodStyle(){
	PolygonDecoration decoration = new PolygonDecoration();
	decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
	decoration.setBackgroundColor(DecorationConstants.methodToMethodColor);
	this.setTargetDecoration(decoration);

	this.setForegroundColor(DecorationConstants.methodToMethodColor);

	return this;
}
 
Example #14
Source File: TransitionFigure.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
private RotatableDecoration createTargetDecoration() {
	PolygonDecoration df = new PolygonDecoration();
	df.setFill(true);
	df.setLineWidth(getMapMode().DPtoLP(1));
	df.setTemplate(PolygonDecoration.TRIANGLE_TIP);
	return df;
}
 
Example #15
Source File: TaskOutputEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @generated
 */
private RotatableDecoration createTargetDecoration() {
	PolygonDecoration df = new PolygonDecoration();
	df.setFill(true);
	PointList pl = new PointList();
	pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
	pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2));
	pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2));
	pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
	df.setTemplate(pl);
	df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
	return df;
}
 
Example #16
Source File: StreamInputOfEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
private RotatableDecoration createTargetDecoration() {
	PolygonDecoration df = new PolygonDecoration();
	df.setFill(true);
	PointList pl = new PointList();
	pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
	pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2));
	pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2));
	pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
	df.setTemplate(pl);
	df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
	return df;
}
 
Example #17
Source File: InputScaleDetails.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void connect ( final IFigure figure, final IFigure source, final IFigure target )
{
    final PolylineConnection c = new PolylineConnection ();
    c.setSourceAnchor ( new ChopboxAnchor ( source ) );
    c.setTargetAnchor ( new ChopboxAnchor ( target ) );

    final PolygonDecoration dec = new PolygonDecoration ();
    dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP );
    dec.setBackgroundColor ( ColorConstants.black );
    c.setTargetDecoration ( dec );

    figure.add ( c );
}
 
Example #18
Source File: ManualOverride.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 );
}
 
Example #19
Source File: ColumnConnection.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @return Returns the joinDirection.
 */
public PolygonDecoration getJoinDirection() {
	return joinDirection;
}
 
Example #20
Source File: ColumnConnection.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param joinDirection The joinDirection to set.
 */
public void setJoinDirection(PolygonDecoration joinDirection) {
	this.joinDirection = joinDirection;
}