Search in sources :

Example 26 with IFigure

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;
}
Also used : Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Example 27 with IFigure

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);
}
Also used : GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IFigure(org.eclipse.draw2d.IFigure)

Example 28 with IFigure

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;
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) NodeFigure(org.talend.designer.core.ui.editor.nodes.NodeFigure) Node(org.talend.designer.core.ui.editor.nodes.Node) IFigure(org.eclipse.draw2d.IFigure)

Example 29 with IFigure

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;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) Iterator(java.util.Iterator) IFigure(org.eclipse.draw2d.IFigure)

Example 30 with IFigure

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;
}
Also used : SparkStreamingSubjobContainerFigure(org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure) FreeformLayout(org.eclipse.draw2d.FreeformLayout) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) SparkStreamingSubjobContainerFigure(org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure) IProcess2(org.talend.core.model.process.IProcess2) FreeformLayer(org.eclipse.draw2d.FreeformLayer) IFigure(org.eclipse.draw2d.IFigure) SparkStreamingSubjobContainerFigure(org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure) Figure(org.eclipse.draw2d.Figure)

Aggregations

IFigure (org.eclipse.draw2d.IFigure)440 Rectangle (org.eclipse.draw2d.geometry.Rectangle)120 Point (org.eclipse.draw2d.geometry.Point)77 Dimension (org.eclipse.draw2d.geometry.Dimension)56 Figure (org.eclipse.draw2d.Figure)38 List (java.util.List)37 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)35 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)32 Graphics (org.eclipse.draw2d.Graphics)17 Iterator (java.util.Iterator)15 ArrayList (java.util.ArrayList)14 EditPart (org.eclipse.gef.EditPart)13 StackLayout (org.eclipse.draw2d.StackLayout)12 DefaultSizeNodeFigure (org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure)12 NodeFigure (org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure)12 Insets (org.eclipse.draw2d.geometry.Insets)11 INodeFigure (org.whole.lang.ui.figures.INodeFigure)11 MarginBorder (org.eclipse.draw2d.MarginBorder)10 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)10 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)10