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