Search in sources :

Example 6 with HL7TreeNode

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

the class HL7PublicUtil method getPath.

public String getPath(HL7TreeNode treeNode) {
    StringBuffer path = new StringBuffer();
    HL7TreeNode tmp = treeNode;
    while (tmp != null) {
        //$NON-NLS-1$
        path.insert(0, "/" + tmp.getLabel());
        tmp = tmp.getParent();
    }
    return path.toString();
}
Also used : HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 7 with HL7TreeNode

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

the class HL7PublicUtil method getHL7TreeNodes.

public List<HL7TreeNode> getHL7TreeNodes(List<Message> messageList) {
    List<HL7TreeNode> list = new ArrayList<HL7TreeNode>();
    if (messageList == null) {
        return list;
    }
    for (Message message : messageList) {
        HL7TreeNode root = initTreeRoot(message);
        if (root instanceof Element) {
            // root = ((Element) root).getElementChildren().get(0);
            root.setParent(null);
            list.add(root);
        }
    }
    return list;
}
Also used : Message(ca.uhn.hl7v2.model.Message) Element(org.talend.designer.hl7.ui.data.Element) ArrayList(java.util.ArrayList) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 8 with HL7TreeNode

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

the class HL7PublicUtil method cloneATreeNode.

public HL7TreeNode cloneATreeNode(Object treeNode, String label) {
    HL7TreeNode node = new Element();
    String nodeLabel = getLabel(treeNode, true);
    node.setLabel(nodeLabel);
    String rowLabel = label;
    if (treeNode instanceof SegmentModel) {
        ((Element) node).setRow(nodeLabel);
        rowLabel = nodeLabel;
    } else if (!(treeNode instanceof Group)) {
        ((Element) node).setRow(rowLabel);
    }
    node.setMain(true);
    // treeNode.getChildren();
    Object[] children = getChildList(treeNode);
    if (children != null) {
        for (Object element : children) {
            if (getChildList(element).length > 0) {
                String tlabel = getLabel(element, true);
                String childLabel = rowLabel;
                HL7TreeNode childEle = cloneATreeNode(element, rowLabel);
                if (element instanceof SegmentModel) {
                    childLabel = tlabel;
                }
                childEle.setLabel(tlabel);
                if (childEle instanceof Element) {
                    ((Element) childEle).setRow(childLabel);
                }
                node.addChild(childEle);
            } else {
                HL7TreeNode childEle = new Element();
                String tlabel = getLabel(element, false);
                childEle.setLabel(tlabel);
                if (childEle instanceof Element) {
                    ((Element) childEle).setRow(label);
                    ((Element) childEle).setColumnName(getLabel(element, true));
                }
                childEle.setMain(false);
                node.addChild(childEle);
            }
        }
    }
    return node;
}
Also used : Group(ca.uhn.hl7v2.model.Group) Element(org.talend.designer.hl7.ui.data.Element) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode) SegmentModel(org.talend.designer.hl7.model.SegmentModel)

Example 9 with HL7TreeNode

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

the class HL7PublicUtil method initTreeRoot.

public HL7TreeNode initTreeRoot(Object treeNode) {
    HL7TreeNode node = new Element();
    String nodeLabel = getLabel(treeNode, true);
    node.setLabel(nodeLabel);
    node.setMain(true);
    List children = getFirstLevelChild(treeNode);
    if (children != null) {
        for (Object child : children) {
            String label = getLabel(child, true);
            HL7TreeNode childEle = cloneATreeNode(child, label);
            childEle.setLabel(label);
            if (!(child instanceof Group)) {
                ((Element) childEle).setRow(label);
            }
            node.addChild(childEle);
        }
    }
    return node;
}
Also used : Group(ca.uhn.hl7v2.model.Group) Element(org.talend.designer.hl7.ui.data.Element) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode) ArrayList(java.util.ArrayList) List(java.util.List)

Example 10 with HL7TreeNode

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

the class HL7OutputManager method orderNode.

public void orderNode(HL7TreeNode node) {
    // reset the order.
    if (node != null) {
        List<HL7TreeNode> firstSubChildren = node.getChildren();
        HL7TreeNode foundNode = null;
        for (HL7TreeNode childen : firstSubChildren) {
            if (childen.isRepetable()) {
                foundNode = childen;
                sortOrder(foundNode, node);
                break;
            } else if (childen.isGroup()) {
                foundNode = childen;
                sortOrder(foundNode, node);
                orderNode(childen);
            } else {
                orderNode(childen);
            }
        }
    }
}
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