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