Search in sources :

Example 1 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class HL7TargetTreeViewerProvider method getElements.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
     */
public Object[] getElements(Object inputElement) {
    if (inputElement instanceof HL7TreeNode) {
        List list = new ArrayList();
        list.add(inputElement);
        return list.toArray();
    }
    List list = (List) inputElement;
    return list.toArray();
}
Also used : ArrayList(java.util.ArrayList) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class HL7TargetTreeViewerProvider method getChildren.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
     */
public Object[] getChildren(Object parentElement) {
    HL7TreeNode treeNode = (HL7TreeNode) parentElement;
    List<HL7TreeNode> children = treeNode.getChildren();
    if (children.size() >= 0) {
        treeNode.setMain(true);
    }
    return children.toArray();
}
Also used : HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 3 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class SchemaXMLDragAndDropHandler method canAddAttribute.

private boolean canAddAttribute(HL7TreeNode node) {
    if (node == null) {
        return false;
    }
    if (node.getParent() == null) {
        return false;
    }
    if (node instanceof Element) {
        if (((Element) node).getAttributeChildren().size() > 0) {
            return false;
        }
        String nodeName = node.getLabel() + "-";
        List<HL7TreeNode> childs = ((Element) node).getElementChildren();
        if (childs.size() > 0) {
            for (HL7TreeNode child : childs) {
                if (!child.getLabel().startsWith(nodeName)) {
                    return false;
                }
            }
        } else {
            return false;
        }
    }
    if (node.getClass() != Element.class) {
        return false;
    }
    return true;
}
Also used : Element(org.talend.designer.hl7.ui.data.Element) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 4 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class SchemaXMLLinker method createLoopLinks.

private void createLoopLinks(List<HL7TreeNode> treeData) {
    for (HL7TreeNode treeNode : treeData) {
        if (treeNode.getColumn() != null) {
            TableItem tableItem = null;
            for (TableItem curTableItem : getSource().getItems()) {
                if (curTableItem.getText().equals(treeNode.getColumn().getLabel())) {
                    tableItem = curTableItem;
                    break;
                }
            }
            if (tableItem == null) {
                continue;
            }
            String path = tableItem.getText();
            if (path != null) {
                TreeItem treeItem = getTreeItem(treeNode);
                if (treeItem != null) {
                    addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), (HL7TreeNode) treeItem.getData(), false);
                }
            }
        }
        createLoopLinks(treeNode.getChildren());
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) TableItem(org.eclipse.swt.widgets.TableItem) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 5 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class HL7PublicUtil method initNodeOrder.

public void initNodeOrder(HL7TreeNode node, Map<String, Integer> orderMap) {
    if (node == null) {
        return;
    }
    HL7TreeNode parent = node.getParent();
    if (parent == null) {
        curOrder = 1;
        node.setOrder(1);
        String path = getPath(node);
        orderMap.put(path, curOrder);
        curOrder++;
    }
    List<HL7TreeNode> childNode = node.getChildren();
    for (HL7TreeNode child : childNode) {
        child.setOrder(curOrder);
        String path = getPath(child);
        orderMap.put(path, curOrder);
        curOrder++;
        if (child.getChildren().size() > 0) {
            initNodeOrder(child, orderMap);
        }
    }
}
Also used : HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Aggregations

HL7TreeNode (org.talend.designer.hl7.ui.data.HL7TreeNode)41 Element (org.talend.designer.hl7.ui.data.Element)13 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)6 List (java.util.List)4 Map (java.util.Map)4 TreeItem (org.eclipse.swt.widgets.TreeItem)4 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)3 HL7FileNode (org.talend.core.model.metadata.builder.connection.HL7FileNode)3 HL7OutputManager (org.talend.designer.hl7.managers.HL7OutputManager)3 Group (ca.uhn.hl7v2.model.Group)2 Message (ca.uhn.hl7v2.model.Message)2 TableItem (org.eclipse.swt.widgets.TableItem)2 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)2 IConnection (org.talend.core.model.process.IConnection)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 EList (org.eclipse.emf.common.util.EList)1 Command (org.eclipse.gef.commands.Command)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1