use of org.talend.designer.core.ui.editor.process.ProcessPart in project tdi-studio-se by Talend.
the class TalendBorderItemRectilinearRouter method manualHorizontalScrolBarCase.
private boolean manualHorizontalScrolBarCase(Connection conn) {
PointList points = conn.getPoints();
Point start = getStartPoint(conn);
Point end = getEndPoint(conn);
boolean handle = false;
boolean processHandle = false;
if ((request != null) && (request instanceof CreateConnectionRequest)) {
start = conn.getSourceAnchor().getReferencePoint();
CreateConnectionRequest createRequest = (CreateConnectionRequest) request;
if (createRequest.getTargetEditPart() != null && createRequest.getTargetEditPart() != createRequest.getSourceEditPart() && createRequest.getTargetEditPart().getModel() instanceof Node) {
PointList pointList = new PointList();
conn.translateToRelative(start);
pointList.addPoint(start);
Point targetPoint = conn.getTargetAnchor().getReferencePoint();
conn.translateToRelative(targetPoint);
pointList.addPoint(targetPoint);
conn.setPoints(pointList);
handle = true;
} else if (createRequest.getTargetEditPart() != null && createRequest.getTargetEditPart() != createRequest.getSourceEditPart() && createRequest.getTargetEditPart() instanceof ProcessPart) {
processHandle = true;
}
}
if (conn instanceof ConnectionFigure) {
IConnection connection = ((ConnectionFigure) conn).getConnection();
EConnectionType lineStyle = connection.getLineStyle();
EConnectionCategory category = lineStyle.getCategory();
if (category == EConnectionCategory.OTHER && (lineStyle == EConnectionType.ON_COMPONENT_ERROR || lineStyle == EConnectionType.ON_COMPONENT_OK || lineStyle == EConnectionType.ON_SUBJOB_ERROR || lineStyle == EConnectionType.ON_SUBJOB_OK || lineStyle == EConnectionType.RUN_IF)) {
return handle || processHandle;
}
}
if (!handle) {
conn.translateToRelative(start);
points.setPoint(start, 0);
conn.translateToRelative(end);
points.setPoint(end, points.size() - 1);
conn.setPoints(points);
}
return handle || processHandle;
}
use of org.talend.designer.core.ui.editor.process.ProcessPart in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method selectNode.
/**
* DOC bqian Comment method "selectNode".
*
* @param node
*/
@SuppressWarnings("unchecked")
public void selectNode(String nodeName) {
GraphicalViewer viewer = designerEditor.getViewer();
Object object = viewer.getRootEditPart().getChildren().get(0);
if (object instanceof ProcessPart) {
// ProcessPart < SubjobContainerPart < NodeContainerPart < NodePart
for (EditPart editPart : (List<EditPart>) ((ProcessPart) object).getChildren()) {
if (editPart instanceof SubjobContainerPart) {
SubjobContainerPart subjobPart = (SubjobContainerPart) editPart;
for (EditPart part : (List<EditPart>) subjobPart.getChildren()) {
if (part instanceof NodeContainerPart) {
EditPart nodePart = (EditPart) part.getChildren().get(0);
if (nodePart instanceof NodePart) {
if (((Node) ((NodePart) nodePart).getModel()).getLabel().equals(nodeName)) {
viewer.select(nodePart);
return;
}
}
}
}
}
}
}
}
use of org.talend.designer.core.ui.editor.process.ProcessPart in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method selectNode.
/**
* DOC bqian Comment method "selectNode".
*
* @param node
*/
public void selectNode(INode node) {
GraphicalViewer viewer = designerEditor.getViewer();
Object object = viewer.getRootEditPart().getChildren().get(0);
if (object instanceof ProcessPart) {
for (EditPart editPart : (List<EditPart>) ((ProcessPart) object).getChildren()) {
if (editPart instanceof NodePart) {
if (((NodePart) editPart).getModel().equals(node)) {
viewer.select(editPart);
}
}
}
}
}
use of org.talend.designer.core.ui.editor.process.ProcessPart in project tdi-studio-se by Talend.
the class NodePart method propertyChange.
// ------------------------------------------------------------------------
// Abstract methods from PropertyChangeListener
/*
* (non-Javadoc)
*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
@Override
public void propertyChange(final PropertyChangeEvent changeEvent) {
boolean needUpdateSubjob = false;
if (!this.isActive()) {
return;
}
if (changeEvent.getPropertyName().equals(Node.LOCATION)) {
refreshVisuals();
needUpdateSubjob = true;
} else if (changeEvent.getPropertyName().equals(Node.PERFORMANCE_DATA)) {
refreshVisuals();
getParent().refresh();
needUpdateSubjob = true;
} else if (changeEvent.getPropertyName().equals(Node.INPUTS)) {
refreshTargetConnections();
needUpdateSubjob = true;
} else if (changeEvent.getPropertyName().equals(Node.OUTPUTS)) {
refreshSourceConnections();
refreshTargetConnections();
needUpdateSubjob = true;
} else if (changeEvent.getPropertyName().equals(Node.SIZE)) {
refreshVisuals();
getParent().refresh();
needUpdateSubjob = true;
} else if (changeEvent.getPropertyName().equals(Node.ICON_CHANGE)) {
changeIcon((Node) changeEvent.getSource());
refreshVisuals();
} else if (changeEvent.getPropertyName().equals(EParameterName.ACTIVATE.getName())) {
if (((INode) getModel()).isActivate()) {
((NodeFigure) figure).setDummy(((Node) getModel()).isDummy());
((NodeFigure) figure).setAlpha(-1);
((NodeFigure) figure).repaint();
refreshVisuals();
} else {
((NodeFigure) figure).setDummy(((Node) getModel()).isDummy());
((NodeFigure) figure).setAlpha(Node.ALPHA_VALUE);
((NodeFigure) figure).repaint();
refreshVisuals();
}
} else if (changeEvent.getPropertyName().equals(EParameterName.DUMMY.getName())) {
if (((INode) getModel()).isActivate()) {
((NodeFigure) figure).setDummy(((Node) getModel()).isDummy());
((NodeFigure) figure).setAlpha(-1);
} else {
((NodeFigure) figure).setDummy(((Node) getModel()).isDummy());
((NodeFigure) figure).setAlpha(Node.ALPHA_VALUE);
}
((NodeFigure) figure).repaint();
refreshVisuals();
} else if (changeEvent.getPropertyName().equals(EParameterName.START.getName())) {
if (((INode) getModel()).isStart()) {
((NodeFigure) figure).setStart(true);
((NodeFigure) figure).repaint();
refreshVisuals();
} else {
((NodeFigure) figure).setStart(false);
((NodeFigure) figure).repaint();
refreshVisuals();
}
} else if (changeEvent.getPropertyName().equals(EParameterName.HINT.getName())) {
if (((Node) getModel()).isSetShowHint()) {
((NodeFigure) figure).setHint(((Node) getModel()).getShowHintText());
} else {
//$NON-NLS-1$
((NodeFigure) figure).setHint("");
}
needUpdateSubjob = true;
} else if (changeEvent.getPropertyName().equals(EParameterName.CONNECTION_FORMAT.getName())) {
Node node = (Node) getModel();
for (IConnection conn : ((Node) getModel()).getOutgoingConnections()) {
String connIdName = null;
String oldName = conn.getUniqueName();
if (conn instanceof Connection && conn.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
node.getProcess().removeUniqueConnectionName(oldName);
if (node.getProcess().checkValidConnectionName(node.getConnectionName(), false)) {
connIdName = node.getProcess().generateUniqueConnectionName(node.getConnectionName());
} else {
//$NON-NLS-1$
connIdName = node.getProcess().generateUniqueConnectionName("row");
}
if (node.getProcess().checkValidConnectionName(connIdName)) {
((Connection) conn).setUniqueName(connIdName);
node.getProcess().addUniqueConnectionName(connIdName);
((Connection) conn).setName(connIdName);
} else {
node.getProcess().addUniqueConnectionName(oldName);
}
}
}
} else if (changeEvent.getPropertyName().equals(EParameterName.REPAINT.getName())) {
((NodeFigure) figure).repaint();
refreshVisuals();
EditPart parentPart = getParent();
if (parentPart != null) {
parentPart.refresh();
}
needUpdateSubjob = true;
}
if (needUpdateSubjob) {
EditPart editPart = getParent();
if (editPart != null) {
while ((!(editPart instanceof ProcessPart)) && (!(editPart instanceof SubjobContainerPart))) {
editPart = editPart.getParent();
}
if (editPart instanceof SubjobContainerPart) {
editPart.refresh();
}
}
}
}
use of org.talend.designer.core.ui.editor.process.ProcessPart in project tdi-studio-se by Talend.
the class NodeProgressBarPart method propertyChange.
/*
* (non-Javadoc)
*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
public void propertyChange(final PropertyChangeEvent evt) {
String request = evt.getPropertyName();
Double extent = new Double(0);
if (evt.getNewValue() instanceof Double) {
extent = (Double) evt.getNewValue();
}
if (request.equals("UPDATE_STATUS")) {
//$NON-NLS-1$
NodeProgressBarFigure figure = (NodeProgressBarFigure) this.getFigure();
Node node = ((NodeContainer) ((NodeContainerPart) getParent()).getModel()).getNode();
// figure.updateVisible(true);
figure.setProgressData(extent);
((NodeProgressBar) getModel()).setProgressSize((figure).getSize());
refreshVisuals();
}
if (request.equals(NodeProgressBar.LOCATION)) {
//$NON-NLS-1$
refreshVisuals();
getParent().refresh();
}
if (request.equals(EParameterName.ACTIVATE.getName())) {
if (((NodeProgressBar) getModel()).isActivate()) {
((NodeProgressBarFigure) figure).setAlpha(-1);
((NodeProgressBarFigure) figure).repaint();
refreshVisuals();
} else {
((NodeProgressBarFigure) figure).setAlpha(Node.ALPHA_VALUE);
((NodeProgressBarFigure) figure).repaint();
refreshVisuals();
}
}
EditPart editPart = getParent();
if (editPart != null) {
while ((!(editPart instanceof ProcessPart)) && (!(editPart instanceof SubjobContainerPart))) {
editPart = editPart.getParent();
}
if (editPart instanceof SubjobContainerPart) {
editPart.refresh();
}
}
}
Aggregations