use of org.talend.core.model.process.EConnectionType in project tdi-studio-se by Talend.
the class DisableParallelizationCommand method disableParallelization.
private void disableParallelization(INode node) {
if (node.getOutgoingConnections().size() > 0) {
for (IConnection con : node.getOutgoingConnections()) {
EConnectionType lineStyle = con.getLineStyle();
if (lineStyle.hasConnectionCategory(IConnectionCategory.DATA)) {
con.getElementParameter(EParameterName.REPARTITIONER.getName()).setValue(Boolean.FALSE);
con.getElementParameter(EParameterName.DEPARTITIONER.getName()).setValue(Boolean.FALSE);
con.getElementParameter(EParameterName.PARTITIONER.getName()).setValue(Boolean.FALSE);
con.setPropertyValue(EParameterName.NONE.getName(), Boolean.TRUE);
if (con.getTarget() != null) {
disableParallelization(con.getTarget());
}
} else {
node = con.getTarget();
disableParallelization(node);
}
}
}
}
use of org.talend.core.model.process.EConnectionType in project tdi-studio-se by Talend.
the class DummyComponent method createConnectors.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.components.IComponent#createConnectors(org.talend.core.model.process.INode)
*/
@Override
public List<? extends INodeConnector> createConnectors(INode node) {
List<INodeConnector> listConnector = new ArrayList<INodeConnector>();
INodeConnector nodeConnector;
for (int i = 0; i < EConnectionType.values().length; i++) {
EConnectionType currentType = EConnectionType.values()[i];
if ((currentType == EConnectionType.FLOW_REF) || (currentType == EConnectionType.FLOW_MERGE)) {
continue;
}
boolean exists = false;
for (INodeConnector curNodeConn : listConnector) {
if (curNodeConn.getDefaultConnectionType().equals(currentType)) {
exists = true;
}
}
if (!exists) {
// will add by default all connectors not defined in
// the xml files
nodeConnector = new NodeConnector(node);
nodeConnector.setDefaultConnectionType(currentType);
nodeConnector.setName(currentType.getName());
nodeConnector.setBaseSchema(currentType.getName());
nodeConnector.addConnectionProperty(currentType, currentType.getRGB(), currentType.getDefaultLineStyle());
nodeConnector.setLinkName(currentType.getDefaultLinkName());
nodeConnector.setMenuName(currentType.getDefaultMenuName());
nodeConnector.setMaxLinkInput(0);
nodeConnector.setMinLinkInput(0);
nodeConnector.setMaxLinkOutput(0);
nodeConnector.setMinLinkOutput(0);
if (currentType == EConnectionType.FLOW_MAIN) {
nodeConnector.addConnectionProperty(EConnectionType.FLOW_REF, EConnectionType.FLOW_REF.getRGB(), EConnectionType.FLOW_REF.getDefaultLineStyle());
nodeConnector.addConnectionProperty(EConnectionType.FLOW_MERGE, EConnectionType.FLOW_MERGE.getRGB(), EConnectionType.FLOW_MERGE.getDefaultLineStyle());
}
listConnector.add(nodeConnector);
}
}
return listConnector;
}
use of org.talend.core.model.process.EConnectionType in project tdi-studio-se by Talend.
the class JobletUtil method createTriggerConnector.
private void createTriggerConnector(List<INodeConnector> listConnector, INode jobletNode) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (service != null) {
List<INode> triggerNodes = service.getTriggerNodes(jobletNode.getJobletNode());
for (INode node : triggerNodes) {
// INode node = jobletNode;
EConnectionType triggerConnType = service.getTriggerNodeConnType(node);
if (triggerConnType == null) {
continue;
}
boolean isInput = service.isTriggerInputNode(node);
INodeConnector nodeConnector = null;
String name = node.getUniqueName();
nodeConnector = new NodeConnector(jobletNode);
nodeConnector.setName(name);
nodeConnector.setBaseSchema(triggerConnType.getName());
nodeConnector.setBuiltIn(true);
nodeConnector.setMaxLinkOutput(isInput ? 0 : 1);
nodeConnector.setMinLinkOutput(0);
nodeConnector.setMaxLinkInput(isInput ? 1 : 0);
nodeConnector.setMinLinkInput(0);
String displayName = conDisplayName(node.getLabel(), name);
//$NON-NLS-1$ //$NON-NLS-2$
nodeConnector.setLinkName(triggerConnType.getDefaultLinkName() + " (" + displayName + ")");
//$NON-NLS-1$ //$NON-NLS-2$
nodeConnector.setMenuName(triggerConnType.getDefaultMenuName() + " (" + displayName + ")");
nodeConnector.setDefaultConnectionType(triggerConnType);
nodeConnector.addConnectionProperty(triggerConnType, triggerConnType.getRGB(), triggerConnType.getDefaultLineStyle());
listConnector.add(nodeConnector);
}
}
}
use of org.talend.core.model.process.EConnectionType in project tdi-studio-se by Talend.
the class NodeAnchor method getDirectionPosition.
private Point getDirectionPosition(IConnection connection, Point figCenter, boolean isSource) {
if (!DesignerPlugin.getDefault().getPreferenceStore().getBoolean(TalendDesignerPrefConstants.EDITOR_LINESTYLE)) {
return null;
}
Dimension nodeSize = null;
if (isSource) {
nodeSize = this.source.getSize();
} else {
nodeSize = this.target.getSize();
}
EConnectionCategory category = null;
EConnectionType lineStyle = null;
if (connection != null) {
lineStyle = connection.getLineStyle();
category = lineStyle.getCategory();
} else {
lineStyle = ConnectionManager.getNewConnectionType();
category = lineStyle.getCategory();
}
Point result = new Point(figCenter);
if (category == EConnectionCategory.MAIN && lineStyle != EConnectionType.FLOW_REF) {
if (isSource) {
result.x = figCenter.x + nodeSize.width / 2;
} else {
result.x = figCenter.x - nodeSize.width / 2;
}
return result;
} else if (category == EConnectionCategory.OTHER && (lineStyle == EConnectionType.FLOW_REF || lineStyle == EConnectionType.TABLE_REF)) {
Rectangle sourceBounds = new Rectangle(this.source.getLocation(), this.source.getSize());
Rectangle targetBounds = new Rectangle(this.target.getLocation(), this.target.getSize());
if (isSource) {
int sourceY = this.source.getPosY();
int targetY = this.target.getPosY();
if (sourceY <= targetY) {
if ((targetBounds.getTopRight().y == sourceBounds.getBottomLeft().y)) {
result.y = figCenter.y - nodeSize.height / 2;
} else {
result.y = figCenter.y + nodeSize.height / 2;
}
} else {
if (targetBounds.getBottomLeft().y == sourceBounds.getTopRight().y) {
result.y = figCenter.y + nodeSize.height / 2;
} else {
result.y = figCenter.y - nodeSize.height / 2;
}
}
return result;
}
int sourceY = this.source.getPosY();
int targetY = this.target.getPosY();
if (sourceY < targetY) {
result.y = figCenter.y - nodeSize.height / 2;
} else {
result.y = figCenter.y + nodeSize.height / 2;
}
return result;
}
return null;
}
use of org.talend.core.model.process.EConnectionType in project tdi-studio-se by Talend.
the class DesignerColorsPreferencePage method createConnectionFieldEditors.
private void createConnectionFieldEditors(Composite parent) {
Group connGroup = new Group(parent, SWT.NULL);
//$NON-NLS-1$
connGroup.setText(Messages.getString("DesignerColorsPreferencePage.ConnectionColorGroup"));
connGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
GridLayout layout = new GridLayout(2, true);
layout.marginLeft = 10;
connGroup.setLayout(layout);
Label message = new Label(connGroup, SWT.NULL);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
data.minimumWidth = 400;
data.heightHint = 20;
message.setLayoutData(data);
//$NON-NLS-1$
message.setText(Messages.getString("DesignerColorsPreferencePage.ConnectionColorMessages"));
Composite left = new Composite(connGroup, SWT.NULL);
left.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite right = new Composite(connGroup, SWT.NULL);
right.setLayoutData(new GridData(GridData.FILL_BOTH));
EConnectionType[] values = EConnectionType.values();
for (int i = 0; i < values.length; i++) {
Composite comp = left;
if (i % 2 > 0) {
comp = right;
}
addField(new ColorFieldEditor(DesignerColorUtils.getPreferenceConnectionName(values[i]), values[i].getDefaultMenuName(), comp));
}
}
Aggregations