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();
}
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;
}
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;
}
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;
}
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);
}
}
}
}
Aggregations