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