Search in sources :

Example 96 with TreeNode

use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.

the class MapperManager method addTreeSchemaEnties.

private void addTreeSchemaEnties(ExtendedTableModel<TreeSchemaTableEntry> tableModel, EList<TreeNode> nodes) {
    for (TreeNode node : nodes) {
        // avoid to edit choice and subs in schema editor
        if (!node.isChoice() && !node.isSubstitution()) {
            TreeSchemaTableEntry entry = new TreeSchemaTableEntry(node);
            tableModel.add(entry);
        }
        if (!node.getChildren().isEmpty()) {
            addTreeSchemaEnties(tableModel, node.getChildren());
        }
    }
}
Also used : OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) TreeSchemaTableEntry(org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry)

Example 97 with TreeNode

use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.

the class AbstractXmlTreeSchemaTableView method validateXPath.

protected String validateXPath(String newValue, int beanPosition) {
    if (beanPosition == -1) {
        return null;
    }
    isValidName = true;
    if (newValue == null || "".equals(newValue)) {
        isValidName = false;
        return "Name can't be null";
    }
    TreeNode bean = getExtendedTableModel().getBeansList().get(beanPosition);
    if (NodeType.NAME_SPACE == bean.getNodeType()) {
        final String validateNameSpace = validateNameSpace(newValue, beanPosition);
        if (validateNameSpace != null) {
            return validateNameSpace;
        }
    }
    if (!StringUtil.validateLabelForXML(newValue)) {
        if (NodeType.ELEMENT == bean.getNodeType()) {
            isValidName = false;
            return "Element name is invalid";
        } else if (NodeType.ATTRIBUT == bean.getNodeType()) {
            isValidName = false;
            return "Attribute name is invalid";
        }
    }
    return validateEntry(newValue, bean, beanPosition);
}
Also used : TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)

Example 98 with TreeNode

use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.

the class AbstractXmlTreeSchemaTableView method validateEntry.

protected String validateEntry(String newValue, TreeNode bean, int beanPosition) {
    String newXPath = bean.getXpath();
    newXPath = newXPath.substring(0, newXPath.lastIndexOf(bean.getName()));
    newXPath = newXPath + newValue;
    if (getExtendedTableModel() != null) {
        for (int i = 0; i < getExtendedTableModel().getBeansList().size(); i++) {
            if (i == beanPosition) {
                continue;
            }
            TreeNode entry = getExtendedTableModel().getBeansList().get(i);
            if (newXPath.equals(entry.getXpath())) {
                isValidName = false;
                return "Name alrady existed";
            }
        }
    }
    return null;
}
Also used : TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)

Example 99 with TreeNode

use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.

the class NameSpaceDialog method isValidPrefix.

private boolean isValidPrefix(String prefix) {
    if (parentNode == null) {
        return false;
    }
    if (prefix == null || "".equals(prefix)) {
        prefix = XmlMapUtil.DEFAULT_NAME_SPACE_PREFIX;
    }
    String xpath = XmlMapUtil.getXPath(parentNode.getXpath(), prefix, NodeType.NAME_SPACE);
    EList<TreeNode> children = parentNode.getChildren();
    boolean exist = false;
    for (TreeNode child : children) {
        if (child == currentNode) {
            continue;
        }
        if (NodeType.NAME_SPACE.equals(child.getNodeType()) && child.getXpath() != null && child.getXpath().equals(xpath)) {
            exist = true;
            break;
        }
    }
    return !exist;
}
Also used : TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)

Example 100 with TreeNode

use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.

the class SetLoopFunctionDialog method initData.

private void initData() {
    List<TreeSchemaTableEntry> inputLoopEntrys = new ArrayList<TreeSchemaTableEntry>();
    tableModel = new ExtendedTableModel<TreeSchemaTableEntry>("Source Loops", inputLoopEntrys);
    for (TreeNode sourceNode : inputLoopNodesTable.getInputloopnodes()) {
        TreeSchemaTableEntry entry = new TreeSchemaTableEntry(sourceNode);
        inputLoopEntrys.add(entry);
    }
}
Also used : TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) TreeSchemaTableEntry(org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry)

Aggregations

TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)119 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)88 ArrayList (java.util.ArrayList)39 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)34 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)26 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)25 TreeNodeEditPart (org.talend.designer.xmlmap.parts.TreeNodeEditPart)22 List (java.util.List)21 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)19 XmlMapData (org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)17 EList (org.eclipse.emf.common.util.EList)15 LookupConnection (org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)14 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)13 Connection (org.talend.designer.xmlmap.model.emf.xmlmap.Connection)12 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)12 FilterConnection (org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection)11 FOXTreeNode (org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode)10 TransferedObject (org.talend.designer.gefabstractmap.dnd.TransferedObject)9 VarNodeEditPart (org.talend.designer.xmlmap.parts.VarNodeEditPart)9 OutputTreeNodeEditPart (org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)8