Search in sources :

Example 1 with Element

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

the class HL7OutputUI method createAction.

private void createAction() {
    createAction = new CreateHL7ElementAction(xmlViewer, this, "Add Sub-element");
    deleteAction = new DeleteHL7NodeAction(xmlViewer, this, "Delete");
    disconnectAction = new HL7DisconnectAction(xmlViewer, this, "Disconnect Linker");
    fixValueAction = new HL7FixValueAction(xmlViewer, this, "Set A Fix Value");
    setRepetableAction = new SetRepetableAction(xmlViewer, this, "Set As Repeatable Element", this.getValue());
    importAction = new ImportHL7StructureAction(xmlViewer, this, "import HL7 Structure");
}
Also used : SetRepetableAction(org.talend.designer.hl7.action.SetRepetableAction) CreateHL7ElementAction(org.talend.designer.hl7.action.CreateHL7ElementAction) DeleteHL7NodeAction(org.talend.designer.hl7.action.DeleteHL7NodeAction) ImportHL7StructureAction(org.talend.designer.hl7.action.ImportHL7StructureAction) HL7DisconnectAction(org.talend.designer.hl7.action.HL7DisconnectAction) HL7FixValueAction(org.talend.designer.hl7.action.HL7FixValueAction)

Example 2 with Element

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

the class HL7MessageTreeLabelProvider method getColumnText.

public String getColumnText(Object element, int columnIndex) {
    if (element instanceof Type) {
        Type datatype = (Type) element;
        return datatype.getName();
    }
    if (element instanceof IModel) {
        if (element instanceof TypeModel) {
            TypeModel tm = (TypeModel) element;
            allPrimitives.addAll(Arrays.asList(tm.getPrimitives()));
        }
        return ((IModel) element).getDisplayName();
    }
    // }
    if (element instanceof Group) {
        Group group = (Group) element;
        String groupName = group.getName();
        groupName = groupName.substring(groupName.lastIndexOf('.') + 1, groupName.length());
        return groupName;
    }
    if (element instanceof Structure) {
        Structure structure = (Structure) element;
        return structure.getName();
    }
    return null;
}
Also used : Group(ca.uhn.hl7v2.model.Group) Type(ca.uhn.hl7v2.model.Type) IModel(org.talend.designer.hl7.model.IModel) TypeModel(org.talend.designer.hl7.model.TypeModel) Structure(ca.uhn.hl7v2.model.Structure)

Example 3 with Element

use of org.talend.designer.hl7.ui.data.Element 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 Element

use of org.talend.designer.hl7.ui.data.Element 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 5 with Element

use of org.talend.designer.hl7.ui.data.Element 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)

Aggregations

HL7TreeNode (org.talend.designer.hl7.ui.data.HL7TreeNode)20 Element (org.talend.designer.hl7.ui.data.Element)13 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)6 Map (java.util.Map)4 Group (ca.uhn.hl7v2.model.Group)3 List (java.util.List)3 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)3 HL7FileNode (org.talend.core.model.metadata.builder.connection.HL7FileNode)3 Message (ca.uhn.hl7v2.model.Message)2 GridData (org.eclipse.swt.layout.GridData)2 TreeItem (org.eclipse.swt.widgets.TreeItem)2 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)2 IConnection (org.talend.core.model.process.IConnection)2 HL7OutputManager (org.talend.designer.hl7.managers.HL7OutputManager)2 SegmentModel (org.talend.designer.hl7.model.SegmentModel)2 Structure (ca.uhn.hl7v2.model.Structure)1 Type (ca.uhn.hl7v2.model.Type)1 EList (org.eclipse.emf.common.util.EList)1 Command (org.eclipse.gef.commands.Command)1