use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class MapperManager method addTreeSchemaEnties.
private void addTreeSchemaEnties(ExtendedTableModel<TreeSchemaTableEntry> tableModel, EList<TreeNode> nodes) {
for (TreeNode node : nodes) {
// avoid to edit choice and subs in schema editor
if (!node.isChoice() && !node.isSubstitution()) {
TreeSchemaTableEntry entry = new TreeSchemaTableEntry(node);
tableModel.add(entry);
}
if (!node.getChildren().isEmpty()) {
addTreeSchemaEnties(tableModel, node.getChildren());
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class AbstractXmlTreeSchemaTableView method validateXPath.
protected String validateXPath(String newValue, int beanPosition) {
if (beanPosition == -1) {
return null;
}
isValidName = true;
if (newValue == null || "".equals(newValue)) {
isValidName = false;
return "Name can't be null";
}
TreeNode bean = getExtendedTableModel().getBeansList().get(beanPosition);
if (NodeType.NAME_SPACE == bean.getNodeType()) {
final String validateNameSpace = validateNameSpace(newValue, beanPosition);
if (validateNameSpace != null) {
return validateNameSpace;
}
}
if (!StringUtil.validateLabelForXML(newValue)) {
if (NodeType.ELEMENT == bean.getNodeType()) {
isValidName = false;
return "Element name is invalid";
} else if (NodeType.ATTRIBUT == bean.getNodeType()) {
isValidName = false;
return "Attribute name is invalid";
}
}
return validateEntry(newValue, bean, beanPosition);
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class AbstractXmlTreeSchemaTableView method validateEntry.
protected String validateEntry(String newValue, TreeNode bean, int beanPosition) {
String newXPath = bean.getXpath();
newXPath = newXPath.substring(0, newXPath.lastIndexOf(bean.getName()));
newXPath = newXPath + newValue;
if (getExtendedTableModel() != null) {
for (int i = 0; i < getExtendedTableModel().getBeansList().size(); i++) {
if (i == beanPosition) {
continue;
}
TreeNode entry = getExtendedTableModel().getBeansList().get(i);
if (newXPath.equals(entry.getXpath())) {
isValidName = false;
return "Name alrady existed";
}
}
}
return null;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class NameSpaceDialog method isValidPrefix.
private boolean isValidPrefix(String prefix) {
if (parentNode == null) {
return false;
}
if (prefix == null || "".equals(prefix)) {
prefix = XmlMapUtil.DEFAULT_NAME_SPACE_PREFIX;
}
String xpath = XmlMapUtil.getXPath(parentNode.getXpath(), prefix, NodeType.NAME_SPACE);
EList<TreeNode> children = parentNode.getChildren();
boolean exist = false;
for (TreeNode child : children) {
if (child == currentNode) {
continue;
}
if (NodeType.NAME_SPACE.equals(child.getNodeType()) && child.getXpath() != null && child.getXpath().equals(xpath)) {
exist = true;
break;
}
}
return !exist;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class SetLoopFunctionDialog method initData.
private void initData() {
List<TreeSchemaTableEntry> inputLoopEntrys = new ArrayList<TreeSchemaTableEntry>();
tableModel = new ExtendedTableModel<TreeSchemaTableEntry>("Source Loops", inputLoopEntrys);
for (TreeNode sourceNode : inputLoopNodesTable.getInputloopnodes()) {
TreeSchemaTableEntry entry = new TreeSchemaTableEntry(sourceNode);
inputLoopEntrys.add(entry);
}
}
Aggregations