use of org.eclipse.draw2d.IFigure in project tdi-studio-se by Talend.
the class ConnectionFigure method getBounds.
@Override
public Rectangle getBounds() {
if (bounds == null) {
int expand = (int) (getLineWidthFloat() / 2.0f);
bounds = getPoints().getBounds().getExpanded(expand, expand);
for (int i = 0; i < getChildren().size(); i++) {
IFigure child = (IFigure) getChildren().get(i);
bounds.union(child.getBounds());
}
}
return bounds;
}
use of org.eclipse.draw2d.IFigure in project tdi-studio-se by Talend.
the class ConnectionPart method addChildVisual.
@Override
protected void addChildVisual(EditPart childEditPart, int index) {
IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
getContentPane().add(child, index);
}
use of org.eclipse.draw2d.IFigure in project tdi-studio-se by Talend.
the class SubjobContainerResizableEditPolicy method getCustomFeedbackFigure.
/**
* This will take the figure of the node and set it as feedback figure.
*
* @param modelPart
* @return
*/
protected IFigure getCustomFeedbackFigure(Object modelPart) {
IFigure figure;
if (modelPart instanceof Node) {
Node node = (Node) modelPart;
figure = new NodeFigure(node);
if (node.isStart()) {
figure.setBackgroundColor(NodeFigure.START_COLOR);
} else {
figure.setOpaque(false);
}
} else {
figure = new RectangleFigure();
((RectangleFigure) figure).setXOR(true);
((RectangleFigure) figure).setFill(true);
figure.setBackgroundColor(ColorConstants.darkGreen);
figure.setForegroundColor(ColorConstants.white);
}
return figure;
}
use of org.eclipse.draw2d.IFigure in project tdi-studio-se by Talend.
the class SubjobContainerResizableEditPolicy method createFigure.
protected IFigure createFigure(GraphicalEditPart part, IFigure parent) {
IFigure child = getCustomFeedbackFigure(part.getModel());
if (parent != null) {
parent.add(child);
}
Rectangle childBounds = part.getFigure().getBounds().getCopy();
IFigure walker = part.getFigure().getParent();
while (walker != ((GraphicalEditPart) part.getParent()).getFigure()) {
walker.translateToParent(childBounds);
walker = walker.getParent();
}
child.setBounds(childBounds);
Iterator i = part.getChildren().iterator();
while (i.hasNext()) {
createFigure((GraphicalEditPart) i.next(), child);
}
return child;
}
use of org.eclipse.draw2d.IFigure in project tdi-studio-se by Talend.
the class SubjobContainerPart method createFigure.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
SubjobContainer container = (SubjobContainer) this.getModel();
Boolean isDisplaySubjobs = (container).isDisplayed();
if (!isDisplaySubjobs) {
Figure figure = new FreeformLayer();
figure.setLayoutManager(new FreeformLayout());
return figure;
}
IProcess2 process = container.getProcess();
//$NON-NLS-1$
Object obj = process.getAdditionalProperties().get("FRAMEWORK");
SubjobContainerFigure subjobContainer = null;
if ("Spark Streaming".equals(obj) && !(process.getProperty().getItem() instanceof JobletProcessItem)) {
//$NON-NLS-1$
subjobContainer = new SparkStreamingSubjobContainerFigure(container);
} else {
subjobContainer = new SubjobContainerFigure(container);
}
return subjobContainer;
}
Aggregations