Search in sources :

Example 11 with EConnectionType

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);
            }
        }
    }
}
Also used : IConnection(org.talend.core.model.process.IConnection) EConnectionType(org.talend.core.model.process.EConnectionType)

Example 12 with EConnectionType

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;
}
Also used : INodeConnector(org.talend.core.model.process.INodeConnector) ArrayList(java.util.ArrayList) EConnectionType(org.talend.core.model.process.EConnectionType) INodeConnector(org.talend.core.model.process.INodeConnector)

Example 13 with EConnectionType

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);
        }
    }
}
Also used : IJobletProviderService(org.talend.core.ui.IJobletProviderService) INode(org.talend.core.model.process.INode) INodeConnector(org.talend.core.model.process.INodeConnector) NodeConnector(org.talend.designer.core.model.components.NodeConnector) EConnectionType(org.talend.core.model.process.EConnectionType) INodeConnector(org.talend.core.model.process.INodeConnector)

Example 14 with EConnectionType

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;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) EConnectionCategory(org.talend.core.model.process.EConnectionCategory) Dimension(org.eclipse.draw2d.geometry.Dimension) KeyPoint(org.talend.commons.ui.gmf.draw2d.LineSeg.KeyPoint) Point(org.eclipse.draw2d.geometry.Point) EConnectionType(org.talend.core.model.process.EConnectionType)

Example 15 with EConnectionType

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));
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ColorFieldEditor(org.eclipse.jface.preference.ColorFieldEditor) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) EConnectionType(org.talend.core.model.process.EConnectionType)

Aggregations

EConnectionType (org.talend.core.model.process.EConnectionType)32 INode (org.talend.core.model.process.INode)9 INodeConnector (org.talend.core.model.process.INodeConnector)9 ArrayList (java.util.ArrayList)8 IConnection (org.talend.core.model.process.IConnection)7 Node (org.talend.designer.core.ui.editor.nodes.Node)7 Point (org.eclipse.draw2d.geometry.Point)5 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)5 List (java.util.List)4 EConnectionCategory (org.talend.core.model.process.EConnectionCategory)4 Dimension (org.eclipse.draw2d.geometry.Dimension)3 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 ConnectionType (org.talend.designer.core.model.utils.emf.talendfile.ConnectionType)3 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)3 MalformedPatternException (org.apache.oro.text.regex.MalformedPatternException)2 PointList (org.eclipse.draw2d.geometry.PointList)2 CreateConnectionRequest (org.eclipse.gef.requests.CreateConnectionRequest)2 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)2 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)2 HL7FileNode (org.talend.core.model.metadata.builder.connection.HL7FileNode)2