Search in sources :

Example 1 with NodeFigure

use of org.talend.designer.core.ui.editor.nodes.NodeFigure 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 2 with NodeFigure

use of org.talend.designer.core.ui.editor.nodes.NodeFigure in project tdi-studio-se by Talend.

the class ProcessResizableEditPolicy 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 NodeContainer) {
        return null;
    }
    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) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with NodeFigure

use of org.talend.designer.core.ui.editor.nodes.NodeFigure in project tdi-studio-se by Talend.

the class NodeContainerResizableEditPolicy 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 Figure();
        figure.setOpaque(false);
        NodeFigure nodeFigure = new NodeFigure(node);
        figure.add(nodeFigure);
        nodeFigure.setLocation(new Point(32, 32));
        if (node.isStart()) {
            nodeFigure.setBackgroundColor(NodeFigure.START_COLOR);
        } else {
            nodeFigure.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) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure) RectangleFigure(org.eclipse.draw2d.RectangleFigure) NodeFigure(org.talend.designer.core.ui.editor.nodes.NodeFigure)

Example 4 with NodeFigure

use of org.talend.designer.core.ui.editor.nodes.NodeFigure in project tdi-studio-se by Talend.

the class ConnectionPart method deactivateFigure.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractConnectionEditPart#deactivateFigure()
     */
@Override
protected void deactivateFigure() {
    ConnectionFigure connFig = (ConnectionFigure) this.getFigure();
    IFigure targetFig = connFig.getTargetAnchor().getOwner();
    if (targetFig != null && targetFig instanceof NodeFigure) {
        ((NodeFigure) targetFig).removeTargetConnection(connFig);
    }
    IFigure sourceFig = connFig.getSourceAnchor().getOwner();
    if (sourceFig != null && sourceFig instanceof NodeFigure) {
        ((NodeFigure) sourceFig).removeSourceConnection(connFig);
    }
    super.deactivateFigure();
}
Also used : NodeFigure(org.talend.designer.core.ui.editor.nodes.NodeFigure) IFigure(org.eclipse.draw2d.IFigure)

Example 5 with NodeFigure

use of org.talend.designer.core.ui.editor.nodes.NodeFigure in project tdi-studio-se by Talend.

the class TalendSelectionManager method transferFocus.

/*
     * (non-Javadoc) for bug 10072
     * 
     * @when the selected element is ConnectionPerformanceEditPart,transfer Focus to nodepart
     */
private EditPart transferFocus(ConnectionPerformanceEditPart arg0) {
    ConnectionPart connPart = (ConnectionPart) arg0.getParent();
    EditPart targetPart = connPart.getTarget();
    if (targetPart instanceof NodePart) {
        NodeFigure targetFigure = (NodeFigure) ((NodePart) targetPart).getFigure();
        if (targetFigure.containsPoint(getSelectPoint())) {
            setSelectPoint(null);
            return targetPart;
        }
    }
    EditPart sourcePart = connPart.getSource();
    if (sourcePart instanceof NodePart) {
        NodeFigure sourceFigure = (NodeFigure) ((NodePart) sourcePart).getFigure();
        if (sourceFigure.containsPoint(getSelectPoint())) {
            setSelectPoint(null);
            return sourcePart;
        }
    }
    if (connPart.getParent() instanceof TalendScalableFreeformRootEditPart) {
        TalendScalableFreeformRootEditPart parentPart = (TalendScalableFreeformRootEditPart) connPart.getParent();
        if (parentPart.getContents() instanceof ProcessPart) {
            ProcessPart processPart = (ProcessPart) parentPart.getContents();
            List children = processPart.getChildren();
            for (int i = 0; i < children.size(); i++) {
                if (children.get(i) instanceof SubjobContainerPart) {
                    List nodeList = ((SubjobContainerPart) children.get(i)).getChildren();
                    nodeList.remove(sourcePart.getParent());
                    nodeList.remove(targetPart.getParent());
                    for (int j = 0; j < nodeList.size(); j++) {
                        if (nodeList.get(j) instanceof NodeContainerPart) {
                            NodePart nodePart = ((NodeContainerPart) nodeList.get(j)).getNodePart();
                            NodeFigure figure = (NodeFigure) nodePart.getFigure();
                            if (figure.containsPoint(getSelectPoint())) {
                                setSelectPoint(null);
                                return nodePart;
                            }
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) NodeFigure(org.talend.designer.core.ui.editor.nodes.NodeFigure) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) EditPart(org.eclipse.gef.EditPart) AbstractConnectionEditPart(org.eclipse.gef.editparts.AbstractConnectionEditPart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart) ConnectionPerformanceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionPerformanceEditPart) ArrayList(java.util.ArrayList) List(java.util.List) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

NodeFigure (org.talend.designer.core.ui.editor.nodes.NodeFigure)5 IFigure (org.eclipse.draw2d.IFigure)4 RectangleFigure (org.eclipse.draw2d.RectangleFigure)3 Node (org.talend.designer.core.ui.editor.nodes.Node)3 Point (org.eclipse.draw2d.geometry.Point)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Figure (org.eclipse.draw2d.Figure)1 EditPart (org.eclipse.gef.EditPart)1 AbstractConnectionEditPart (org.eclipse.gef.editparts.AbstractConnectionEditPart)1 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)1 ConnLabelEditPart (org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)1 ConnectionPart (org.talend.designer.core.ui.editor.connections.ConnectionPart)1 ConnectionPerformanceEditPart (org.talend.designer.core.ui.editor.connections.ConnectionPerformanceEditPart)1 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)1 NodeContainerPart (org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart)1 NodeLabelEditPart (org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart)1 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)1 NoteEditPart (org.talend.designer.core.ui.editor.notes.NoteEditPart)1 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)1