Java Code Examples for org.eclipse.draw2d.PolygonDecoration#setTemplate()

The following examples show how to use org.eclipse.draw2d.PolygonDecoration#setTemplate() . 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: 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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
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 12
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 13
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 14
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;
}