Search in sources :

Example 1 with EConnectionType

use of org.talend.core.model.process.EConnectionType in project tdi-studio-se by Talend.

the class AbstractXMLConfigPage method loadAttrsInfo.

protected void loadAttrsInfo() {
    attrsAvailableValuesMap = new HashMap<String, String[]>();
    String[] valuesArray = null;
    // CTYPE
    EConnectionType[] eConnectionTypes = EConnectionType.values();
    valuesArray = new String[eConnectionTypes.length];
    for (int i = 0; i < eConnectionTypes.length; i++) {
        valuesArray[i] = eConnectionTypes[i].getName();
    }
    //$NON-NLS-1$
    attrsAvailableValuesMap.put("CTYPE", valuesArray);
    // FIELD
    EParameterFieldType[] eParameterFieldType = EParameterFieldType.values();
    valuesArray = new String[eParameterFieldType.length];
    for (int i = 0; i < eParameterFieldType.length; i++) {
        valuesArray[i] = eParameterFieldType[i].getName();
    }
    //$NON-NLS-1$
    attrsAvailableValuesMap.put("FIELD", valuesArray);
    // PLATFORM
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    attrsAvailableValuesMap.put("PLATEFORM", new String[] { "ALL", "WINDOWS", "LINUX" });
    // COMPATIBILITY
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    attrsAvailableValuesMap.put("COMPATIBILITY", new String[] { "ALL", "WINDOWS", "LINUX" });
    // STATUS
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    attrsAvailableValuesMap.put("STATUS", new String[] { "ALPHA", "BETA", "RELEASE" });
    // LINE_STYLE
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    attrsAvailableValuesMap.put("LINE_STYLE", new String[] { "1", "2", "3", "4" });
    // NB_LINES
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
    attrsAvailableValuesMap.put("NB_LINES", new String[] { "1", "2", "3", "4", "5" });
    // MAX_INPUT MIN_INPUT MAX_OUTPUT MIN_OUTPUT
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
    valuesArray = new String[] { "0", "1", "2", "3", "4", "5" };
    //$NON-NLS-1$
    attrsAvailableValuesMap.put("MAX_INPUT", valuesArray);
    //$NON-NLS-1$
    attrsAvailableValuesMap.put("MIN_INPUT", valuesArray);
    //$NON-NLS-1$
    attrsAvailableValuesMap.put("MAX_OUTPUT", valuesArray);
    //$NON-NLS-1$
    attrsAvailableValuesMap.put("MIN_OUTPUT", valuesArray);
    // PROPERTY_TYPE
    List<String> valuesList = new ArrayList<String>();
    //$NON-NLS-1$
    valuesList.add("DELIMITED");
    //$NON-NLS-1$
    valuesList.add("POSITIONAL");
    //$NON-NLS-1$
    valuesList.add("REGEX");
    //$NON-NLS-1$
    valuesList.add("XML");
    //$NON-NLS-1$
    valuesList.add("LDAP");
    //$NON-NLS-1$
    valuesList.add("WSDL");
    //$NON-NLS-1$
    valuesList.add("GENERIC");
    //$NON-NLS-1$
    valuesList.add("DATABASE");
    for (EDatabaseTypeName eDatabaseTypeName : EDatabaseTypeName.values()) {
        //$NON-NLS-1$
        valuesList.add("DATABASE:" + eDatabaseTypeName.getProduct());
    }
    //$NON-NLS-1$
    attrsAvailableValuesMap.put("REPOSITORY_VALUE", valuesList.toArray(new String[0]));
    // attributes with boolean value
    String[] booleanAttrNameArray = { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    "SHOW", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    "REQUIRED", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    "READONLY", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    "BASED_ON_SCHEMA", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    "KEY", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    "NULLABLE", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    "CUSTOM", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    "BUILTIN", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    "STARTABLE", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    "SCHEMA_AUTO_PROPAGATE", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    "DATA_AUTO_PROPAGATE", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    "HAS_CONDITIONAL_OUTPUTS", "IS_MULTIPLYING_OUTPUTS", "VISIBLE", "TSTATCATCHER_STATS", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "USE_MERGE" };
    //$NON-NLS-1$ //$NON-NLS-2$
    String[] booleanArray = { "true", "false" };
    for (String attrName : booleanAttrNameArray) {
        attrsAvailableValuesMap.put(attrName, booleanArray);
    }
    // init maps for TooTipsText
    attrsToolTipsMap = new HashMap<String, String>();
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("MAX_INPUT", Messages.getString("AbstractXMLConfigPage.MAXINPUTTip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("MIN_INPUT", Messages.getString("AbstractXMLConfigPage.MININPUTTip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("MAX_OUTPUT", Messages.getString("AbstractXMLConfigPage.MAXOUTPUTTip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("MIN_OUTPUT", Messages.getString("AbstractXMLConfigPage.MINOUTPUTTip"));
    //$NON-NLS-1$
    attrsToolTipsMap.put(//$NON-NLS-1$
    "LINE_STYLE", //$NON-NLS-1$
    Messages.getString("AbstractXMLConfigPage.LINESTYLETip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("LENGTH", Messages.getString("AbstractXMLConfigPage.IntValue"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("PRECISION", Messages.getString("AbstractXMLConfigPage.IntValue"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("NB_LINES", Messages.getString("AbstractXMLConfigPage.NBLINESTip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("NUM_ROW", Messages.getString("AbstractXMLConfigPage.NUMROWTip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("VERSION", Messages.getString("AbstractXMLConfigPage.VERSIONTip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("REPOSITORY_VALUE", Messages.getString("AbstractXMLConfigPage.REPOSITORYVALUETip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("EXTENSION", Messages.getString("AbstractXMLConfigPage.EXTENSIONTip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("CTYPE", Messages.getString("AbstractXMLConfigPage.CTYPETip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("TYPE", Messages.getString("AbstractXMLConfigPage.TYPETip"));
    //$NON-NLS-1$ //$NON-NLS-2$
    attrsToolTipsMap.put("COLOR", Messages.getString("AbstractXMLConfigPage.COLORTip"));
    for (String attrName : booleanAttrNameArray) {
        //$NON-NLS-1$
        attrsToolTipsMap.put(attrName, Messages.getString("AbstractXMLConfigPage.BooleanTip"));
    }
}
Also used : EParameterFieldType(org.talend.core.model.process.EParameterFieldType) ArrayList(java.util.ArrayList) EDatabaseTypeName(org.talend.core.database.EDatabaseTypeName) EConnectionType(org.talend.core.model.process.EConnectionType)

Example 2 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 3 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 4 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 5 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