Search in sources :

Example 1 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project cogtool by cogtool.

the class DesignEditorMouseState method ensureDynamicTransition.

protected void ensureDynamicTransition(int startX, int startY) {
    if (potentialTransition == null) {
        potentialTransition = new PolylineConnection();
        endPtDecoration = new PolygonDecoration();
        endPtDecoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
        potentialTransition.setStart(new Point(startX, startY));
        ui.getViewEditor().addInteractionFigure(potentialTransition);
    } else if (!potentialTransition.isVisible()) {
        potentialTransition.setVisible(true);
        potentialTransition.setStart(new Point(startX, startY));
    }
}
Also used : PolygonDecoration(org.eclipse.draw2d.PolygonDecoration) Point(org.eclipse.draw2d.geometry.Point) DoublePoint(edu.cmu.cs.hcii.cogtool.model.DoublePoint) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 2 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class ConnectionPerformanceEditPart method refreshVisuals.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
     */
@Override
protected void refreshVisuals() {
    SimpleHtmlFigure htmlFigure = (SimpleHtmlFigure) getFigure();
    ConnectionPerformance pefModel = (ConnectionPerformance) getModel();
    ConnectionPart parent = (ConnectionPart) getParent();
    PolylineConnection connFigure = (PolylineConnection) parent.getFigure();
    htmlFigure.setText(pefModel.getLabel());
    Point offset = pefModel.getOffset();
    //$NON-NLS-1$
    ConnLabelConstraint constraint = new ConnLabelConstraint(htmlFigure.getPreferredSize(), "middle", offset, connFigure);
    parent.setLayoutConstraint(this, htmlFigure, constraint);
}
Also used : Point(org.eclipse.draw2d.geometry.Point) SimpleHtmlFigure(org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 3 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class MonitorConnectionLabelPart method refreshVisuals.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
     */
@Override
protected void refreshVisuals() {
    String text = ((MonitorConnectionLabel) getModel()).getLabelText();
    Label figure = (Label) getFigure();
    // figure.setIcon(null); //TODO add icon to it
    figure.setText(text);
    figure.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
    ConnectionPart parent = (ConnectionPart) getParent();
    PolylineConnection connFigure = (PolylineConnection) parent.getFigure();
    //$NON-NLS-1$
    MonitorConnectionLabelConstraint constraint = new MonitorConnectionLabelConstraint(text, "center", null, connFigure);
    parent.setLayoutConstraint(this, getFigure(), constraint);
}
Also used : Label(org.eclipse.draw2d.Label) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 4 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class LookupConnectionRouter method route.

public void route(Connection conn) {
    PointList points = conn.getPoints();
    points.removeAllPoints();
    Point p;
    Point startPoint = getStartPoint(conn);
    Point endPoint = getEndPoint(conn);
    conn.translateToRelative(p = startPoint);
    points.addPoint(p);
    if (conn instanceof PolylineConnection) {
        PolylineConnection polylineConn = (PolylineConnection) conn;
    // polylineConn.getta
    }
    // conn.getTargetDecoration()
    conn.translateToRelative(p = getReferrencedPoint(startPoint));
    points.addPoint(p);
    conn.translateToRelative(p = getReferrencedPoint(endPoint));
    points.addPoint(p);
    conn.translateToRelative(p = endPoint);
    points.addPoint(p);
    conn.setPoints(points);
}
Also used : PointList(org.eclipse.draw2d.geometry.PointList) Point(org.eclipse.draw2d.geometry.Point) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 5 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class ConnectionEditPart method createFigure.

@Override
protected IFigure createFigure() {
    PolylineConnection connection = new PolylineConnection();
    connection.setTargetDecoration(new PolygonDecoration());
    curvrRouter = new CurveConnectionRouter();
    connection.setForegroundColor(ColorConstants.gray);
    connection.setLineWidth(2);
    connection.setConnectionRouter(curvrRouter);
    return connection;
}
Also used : PolygonDecoration(org.eclipse.draw2d.PolygonDecoration) CurveConnectionRouter(org.talend.designer.gefabstractmap.figures.routers.CurveConnectionRouter) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Aggregations

PolylineConnection (org.eclipse.draw2d.PolylineConnection)41 Point (org.eclipse.draw2d.geometry.Point)11 PolygonDecoration (org.eclipse.draw2d.PolygonDecoration)9 BendpointConnectionRouter (org.eclipse.draw2d.BendpointConnectionRouter)6 IFigure (org.eclipse.draw2d.IFigure)6 Label (org.eclipse.draw2d.Label)5 BaseConnectionEditPart (org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)5 Edge (org.eclipse.draw2d.graph.Edge)3 MapperTablePart (org.talend.designer.gefabstractmap.part.MapperTablePart)3 ArrayList (java.util.ArrayList)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)2 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)2 Dimension (org.eclipse.draw2d.geometry.Dimension)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 Node (org.eclipse.draw2d.graph.Node)2 NodeList (org.eclipse.draw2d.graph.NodeList)2 ConnectionEditPart (org.eclipse.gef.ConnectionEditPart)2 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)2 CurveConnectionRouter (org.talend.designer.gefabstractmap.figures.routers.CurveConnectionRouter)2 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2