Search in sources :

Example 1 with ScalableFreeformLayeredPane

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

the class ErDiagramRootEditPart method createScaledLayers.

protected ScalableFreeformLayeredPane createScaledLayers() {
    ScalableFreeformLayeredPane layers = new ScalableFreeformLayeredPane();
    layers.add(new FreeformLayer(), PROCESS_BACKGROUND_LAYER);
    // layers.add(createGridLayer(), GRID_LAYER);
    layers.add(getPrintableLayers(), PRINTABLE_LAYERS);
    layers.add(new FeedbackLayer(), SCALED_FEEDBACK_LAYER);
    return layers;
}
Also used : ScalableFreeformLayeredPane(org.eclipse.draw2d.ScalableFreeformLayeredPane) FreeformLayer(org.eclipse.draw2d.FreeformLayer)

Example 2 with ScalableFreeformLayeredPane

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

the class NodeAnchor method getLocation.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.draw2d.ChopboxAnchor#getLocation(org.eclipse.draw2d.geometry.Point)
     */
@Override
public Point getLocation(Point reference) {
    if (target != null && !target.equals(source)) {
        sourceLocation = new Point(source.getLocation());
        targetLocation = new Point(target.getLocation());
        Point diff = new Point(0, 0);
        if (!isTargetAnchor) {
            if (((reference.y - (target.getSize().height / 2)) != targetLocation.y) || ((reference.x - (target.getSize().width / 2)) != targetLocation.x)) {
                FreeformViewport viewport = getViewport();
                if (viewport != null) {
                    int y = viewport.getVerticalRangeModel().getValue();
                    int x = viewport.getHorizontalRangeModel().getValue();
                    diff = new Point(-x, -y);
                }
            }
        } else {
            if (((reference.y - (source.getSize().height / 2)) != sourceLocation.y) || ((reference.x - (source.getSize().width / 2)) != sourceLocation.x)) {
                FreeformViewport viewport = getViewport();
                if (viewport != null) {
                    int y = viewport.getVerticalRangeModel().getValue();
                    int x = viewport.getHorizontalRangeModel().getValue();
                    diff = new Point(-x, -y);
                }
            }
        }
        ScalableFreeformLayeredPane pane = getScalableFreeform();
        sourceRect = new Rectangle(sourceLocation, source.getSize());
        targetRect = new Rectangle(targetLocation, target.getSize());
        if (pane != null) {
            double scale = pane.getScale();
            sourceLocation.performScale(scale);
            targetLocation.performScale(scale);
            sourceRect.performScale(scale);
            targetRect.performScale(scale);
        }
        sourceLocation = sourceLocation.getTranslated(diff);
        targetLocation = targetLocation.getTranslated(diff);
        sourceRect = sourceRect.getTranslated(diff);
        targetRect = targetRect.getTranslated(diff);
        int nb = 0;
        int connectionId = 0;
        for (Connection connection : (List<Connection>) source.getOutgoingConnections()) {
            if (connection.getTarget().equals(target)) {
                nb++;
                if (connection.equals(this.connection)) {
                    connectionId = nb;
                }
            }
        }
        if (nb <= 1) {
            return getLocationForSimpleConnection(reference);
        } else {
            return getLocationForMultipleConnections(connectionId);
        }
    }
    return super.getLocation(reference);
}
Also used : ScalableFreeformLayeredPane(org.eclipse.draw2d.ScalableFreeformLayeredPane) FreeformViewport(org.eclipse.draw2d.FreeformViewport) Rectangle(org.eclipse.draw2d.geometry.Rectangle) IConnection(org.talend.core.model.process.IConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) ArrayList(java.util.ArrayList) List(java.util.List) KeyPoint(org.talend.commons.ui.gmf.draw2d.LineSeg.KeyPoint) Point(org.eclipse.draw2d.geometry.Point) KeyPoint(org.talend.commons.ui.gmf.draw2d.LineSeg.KeyPoint) Point(org.eclipse.draw2d.geometry.Point)

Example 3 with ScalableFreeformLayeredPane

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

the class TalendScalableFreeformRootEditPart method createScaledLayers.

@Override
protected ScalableFreeformLayeredPane createScaledLayers() {
    ScalableFreeformLayeredPane layers = new ScalableFreeformLayeredPane();
    layers.add(new FreeformLayer(), SUBJOB_BACKGROUND_LAYER);
    layers.add(new FreeformLayer(), PROCESS_BACKGROUND_LAYER);
    layers.add(createGridLayer(), GRID_LAYER);
    layers.add(getPrintableLayers(), PRINTABLE_LAYERS);
    layers.add(new FreeformLayer(), MAP_REDUCE_LAYER);
    layers.add(new FreeformLayer(), SelectionFeedbackEditPolicy.TALEND_FEEDBACK_LAYER);
    layers.add(new FeedbackLayer(), SCALED_FEEDBACK_LAYER);
    feedbackLayer = new FeedbackLayer();
    return layers;
}
Also used : ScalableFreeformLayeredPane(org.eclipse.draw2d.ScalableFreeformLayeredPane) FreeformLayer(org.eclipse.draw2d.FreeformLayer)

Aggregations

ScalableFreeformLayeredPane (org.eclipse.draw2d.ScalableFreeformLayeredPane)3 FreeformLayer (org.eclipse.draw2d.FreeformLayer)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 FreeformViewport (org.eclipse.draw2d.FreeformViewport)1 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 KeyPoint (org.talend.commons.ui.gmf.draw2d.LineSeg.KeyPoint)1 IConnection (org.talend.core.model.process.IConnection)1 Connection (org.talend.designer.core.ui.editor.connections.Connection)1