Search in sources :

Example 11 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project dbeaver by serge-rider.

the class DummyEdgePart method createFigure.

/**
	 * @see org.eclipse.gef.editparts.AbstractConnectionEditPart#createFigure()
	 */
protected IFigure createFigure() {
    PolylineConnection conn = new PolylineConnection();
    conn.setConnectionRouter(new BendpointConnectionRouter());
    conn.setVisible(true);
    return conn;
}
Also used : BendpointConnectionRouter(org.eclipse.draw2d.BendpointConnectionRouter) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 12 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project cubrid-manager by CUBRID.

the class Host2ChildConnectionPart method createFigure.

/**
	 * create figure used by edit part.
	 * 
	 * @return IFigure connectin figure
	 */
protected IFigure createFigure() {
    PolylineConnection conn = new PolylineConnection();
    conn.setLineStyle(SWT.LINE_DASH);
    conn.setConnectionRouter(new ManhattanConnectionRouter());
    conn.setSourceAnchor(getSourceConnectionAnchor());
    conn.setTargetAnchor(getTargetConnectionAnchor());
    conn.setForegroundColor(CONNECTION_DEFAULT_COLOR);
    return conn;
}
Also used : ManhattanConnectionRouter(org.eclipse.draw2d.ManhattanConnectionRouter) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 13 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project knime-core by knime.

the class WorkflowMarqueeSelectionTool method calculateNewSelection.

private void calculateNewSelection(final Collection<GraphicalEditPart> newSelections, final Collection<GraphicalEditPart> deselections) {
    Rectangle marqueeRect = getMarqueeSelectionRectangle();
    for (Iterator<GraphicalEditPart> itr = getAllChildren().iterator(); itr.hasNext(); ) {
        GraphicalEditPart child = itr.next();
        IFigure figure = child.getFigure();
        if (!child.isSelectable() || child.getTargetEditPart(MARQUEE_REQUEST) != child || !isFigureVisible(figure) || !figure.isShowing()) {
            continue;
        }
        if (!(child instanceof NodeContainerEditPart || child instanceof ConnectionContainerEditPart || child instanceof AbstractWorkflowPortBarEditPart || child instanceof AnnotationEditPart)) {
            continue;
        }
        Rectangle r = figure.getBounds().getCopy();
        figure.translateToAbsolute(r);
        boolean included = false;
        if (child instanceof ConnectionEditPart && marqueeRect.intersects(r)) {
            Rectangle relMarqueeRect = Rectangle.SINGLETON;
            figure.translateToRelative(relMarqueeRect.setBounds(marqueeRect));
            included = ((PolylineConnection) figure).getPoints().intersects(relMarqueeRect);
        } else if (child instanceof AnnotationEditPart) {
            // select WorkflowAnnotations only if they are fully included in the selection
            if (figure instanceof WorkflowAnnotationFigure) {
                included = marqueeRect.contains(r);
            }
        } else if (marqueeBehavior == BEHAVIOR_NODES_AND_CONNECTIONS_TOUCHED) {
            included = marqueeRect.intersects(r);
        } else {
            included = marqueeRect.contains(r);
        }
        if (included) {
            if (isToggle()) {
                if (wasSelected(child)) {
                    deselections.add(child);
                } else {
                    newSelections.add(child);
                }
            } else {
                newSelections.add(child);
            }
        } else if (isToggle()) {
            // readded if it was in the selection before
            if (wasSelected(child)) {
                newSelections.add(child);
            } else {
                deselections.add(child);
            }
        }
    }
    if (marqueeBehavior == BEHAVIOR_NODES_AND_CONNECTIONS_TOUCHED) {
        calculateConnections(newSelections, deselections);
    }
}
Also used : NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) ConnectionContainerEditPart(org.knime.workbench.editor2.editparts.ConnectionContainerEditPart) AnnotationEditPart(org.knime.workbench.editor2.editparts.AnnotationEditPart) WorkflowAnnotationFigure(org.knime.workbench.editor2.figures.WorkflowAnnotationFigure) AbstractWorkflowPortBarEditPart(org.knime.workbench.editor2.editparts.AbstractWorkflowPortBarEditPart) ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IFigure(org.eclipse.draw2d.IFigure) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 14 with PolylineConnection

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

the class DummyEdgePart method createFigure.

/**
 * @see org.eclipse.gef.editparts.AbstractConnectionEditPart#createFigure()
 */
protected IFigure createFigure() {
    PolylineConnection conn = new PolylineConnection();
    conn.setConnectionRouter(new BendpointConnectionRouter());
    conn.setVisible(true);
    return conn;
}
Also used : BendpointConnectionRouter(org.eclipse.draw2d.BendpointConnectionRouter) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 15 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project archi by archimatetool.

the class GraphConnection method doUpdateFigure.

private void doUpdateFigure(Connection connection) {
    if (connection == null || this.isDisposed()) {
        return;
    }
    Shape connectionShape = (Shape) connection;
    connectionShape.setLineStyle(getLineStyle());
    if (this.getText() != null || this.getImage() != null) {
        // Label l = new Label(this.getText(), this.getImage());
        if (this.getImage() != null) {
            this.connectionLabel.setIcon(this.getImage());
        }
        if (this.getText() != null) {
            this.connectionLabel.setText(this.getText());
        }
        this.connectionLabel.setFont(this.getFont());
    }
    if (highlighted) {
        connectionShape.setForegroundColor(getHighlightColor());
        connectionShape.setLineWidth(getLineWidth() * 2);
    } else {
        connectionShape.setForegroundColor(getLineColor());
        connectionShape.setLineWidth(getLineWidth());
    }
    if (connection instanceof PolylineArcConnection) {
        PolylineArcConnection arcConnection = (PolylineArcConnection) connection;
        arcConnection.setDepth(curveDepth);
    }
    if ((connectionStyle & ZestStyles.CONNECTIONS_DIRECTED) > 0) {
        PolygonDecoration decoration = new PolygonDecoration();
        if (getLineWidth() < 3) {
            decoration.setScale(9, 3);
        } else {
            double logLineWith = getLineWidth() / 2.0;
            decoration.setScale(7 * logLineWith, 3 * logLineWith);
        }
        ((PolylineConnection) connection).setTargetDecoration(decoration);
    }
    IFigure toolTip;
    if (this.getTooltip() == null && getText() != null && getText().length() > 0 && hasCustomTooltip == false) {
        toolTip = new Label();
        ((Label) toolTip).setText(getText());
    } else {
        toolTip = this.getTooltip();
    }
    connection.setToolTip(toolTip);
}
Also used : Shape(org.eclipse.draw2d.Shape) PolygonDecoration(org.eclipse.draw2d.PolygonDecoration) Label(org.eclipse.draw2d.Label) PolylineArcConnection(org.eclipse.zest.core.widgets.internal.PolylineArcConnection) PolylineConnection(org.eclipse.draw2d.PolylineConnection) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

PolylineConnection (org.eclipse.draw2d.PolylineConnection)43 Point (org.eclipse.draw2d.geometry.Point)11 PolygonDecoration (org.eclipse.draw2d.PolygonDecoration)10 IFigure (org.eclipse.draw2d.IFigure)8 BendpointConnectionRouter (org.eclipse.draw2d.BendpointConnectionRouter)6 Label (org.eclipse.draw2d.Label)6 BaseConnectionEditPart (org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)5 Edge (org.eclipse.draw2d.graph.Edge)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 CurveConnectionRouter (org.talend.designer.gefabstractmap.figures.routers.CurveConnectionRouter)2 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2 InputTablePart (org.talend.designer.gefabstractmap.part.InputTablePart)2 LookupConnectionPart (org.talend.designer.gefabstractmap.part.LookupConnectionPart)2