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;
}
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);
}
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;
}
Aggregations