use of org.eclipse.draw2d.geometry.Dimension in project tdi-studio-se by Talend.
the class NodeContainer method getNodeMarkRectangle.
public Rectangle getNodeMarkRectangle() {
Point nodeLocation;
nodeLocation = node.getLocation();
Dimension nodeSize;
Dimension labelSize;
Dimension errorNodeSize;
Dimension progressNodeSize;
nodeSize = node.getSize();
Rectangle nodeRectangle = new Rectangle(nodeLocation, nodeSize);
Rectangle statusRectangle = prepareCleanStatus(nodeLocation, nodeSize);
labelSize = nodeLabel.getLabelSize();
errorNodeSize = nodeError.getErrorSize();
progressNodeSize = nodeProgressBar.getProgressSize();
Rectangle finalRect;
finalRect = nodeRectangle.getUnion(statusRectangle);
finalRect.height += labelSize.height / 2;
if (node.isErrorFlag()) {
finalRect.height += errorNodeSize.height;
}
if (node.isFileScaleComponent()) {
finalRect.height += progressNodeSize.height;
}
return finalRect;
}
use of org.eclipse.draw2d.geometry.Dimension in project tdi-studio-se by Talend.
the class NodeErrorEditPart method refreshVisuals.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
Node node = ((NodeContainer) ((NodeContainerPart) getParent()).getModel()).getNode();
NodeLabel nodeLabel = node.getNodeLabel();
NodeErrorFigure errorFig = (NodeErrorFigure) this.getFigure();
Point loc = node.getLocation().getCopy();
Dimension size = errorFig.getSize();
loc.x = loc.x + (node.getSize().width - size.width) / 2;
loc.y = loc.y + node.getSize().height + (nodeLabel.getLabelSize().height);
Rectangle rectangle = new Rectangle(loc, size);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), rectangle);
}
use of org.eclipse.draw2d.geometry.Dimension in project tdi-studio-se by Talend.
the class ReplaceMultiFlowBytReplicateMigrationTask method findLocationForNode.
/**
* DOC nrousseau Comment method "findLocationForNode".
*
* @param processType
* @param point
* @return
*/
private Point findLocationForNode(ProcessType processType, Point point) {
Rectangle newRect = new Rectangle(point, new Dimension(GRID_SIZE, GRID_SIZE));
Point newLocation = new Point(point);
for (Object oNodeType : processType.getNode()) {
NodeType node = (NodeType) oNodeType;
String uniqueName = ComponentUtilities.getNodeUniqueName(node);
Rectangle currentRect = getNodeRectangle(processType, uniqueName);
if (currentRect.intersects(newRect)) {
newLocation.x += GRID_SIZE;
newLocation.y += GRID_SIZE;
return findLocationForNode(processType, point);
}
}
return newLocation;
}
use of org.eclipse.draw2d.geometry.Dimension in project tdi-studio-se by Talend.
the class NodeProgressBarPart method refreshVisuals.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
Node node = ((NodeContainer) ((NodeContainerPart) getParent()).getModel()).getNode();
NodeLabel nodeLabel = node.getNodeLabel();
NodeProgressBarFigure progressFig = (NodeProgressBarFigure) this.getFigure();
Point loc = node.getLocation().getCopy();
NodeError nodeError = node.getNodeError();
Dimension size = progressFig.getSize();
loc.x = loc.x + (node.getSize().width - size.width) / 2 + size.width / 7;
loc.y = loc.y + node.getSize().height + nodeLabel.getLabelSize().height + nodeError.getErrorSize().height;
Rectangle rectangle = new Rectangle(loc, size);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), rectangle);
}
use of org.eclipse.draw2d.geometry.Dimension in project tdi-studio-se by Talend.
the class NodeResizableEditPolicy method getResizeCommand.
@Override
protected Command getResizeCommand(ChangeBoundsRequest request) {
Object parent = getHost().getParent().getModel();
if (!(parent instanceof NodeContainer)) {
return null;
}
Node node = (Node) getHost().getModel();
if (node.isReadOnly()) {
return null;
}
TalendScalableFreeformRootEditPart rootEditPart = (TalendScalableFreeformRootEditPart) getHost().getRoot();
double scale = 1 / rootEditPart.getZoomManager().getZoom();
return new ResizeNodeCommand(node, new Dimension(node.getSize().width + request.getSizeDelta().getScaled(scale).width, node.getSize().height + request.getSizeDelta().getScaled(scale).height));
}
Aggregations