use of org.talend.designer.xmlmap.figures.InputXmlTreeFigure in project tdi-studio-se by Talend.
the class XmlMapTreeContainerLayout method getLookupConnectionSize.
/*
* (non-Javadoc)
*
* @see org.talend.designer.newabstractmap.figures.layout.TreeContainerLayout#getLookupConnectionSize()
*/
@Override
protected int getLookupConnectionSize(AbstractTableContainer tableContainer) {
if (tableContainer instanceof InputXmlTreeFigure) {
InputXmlTree inputModel = ((InputXmlTreeFigure) tableContainer).getInputXmlTree();
List<TreeNode> nodeList = inputModel.getNodes();
int maxSize = 0;
List<IConnection> lookConnections = XmlMapUtil.getAllNodeLookConnections(inputModel);
List<IConnection> filterConnections = XmlMapUtil.getInputTreeFilterConnections(inputModel);
if (lookConnections.size() < filterConnections.size()) {
maxSize = filterConnections.size();
} else {
maxSize = lookConnections.size();
}
return maxSize;
}
return 0;
}
use of org.talend.designer.xmlmap.figures.InputXmlTreeFigure in project tdi-studio-se by Talend.
the class SearchZoneMapper method search.
public void search(Map<Integer, Map<Integer, Figure>> searchMaps, String searchValue) {
if (searchValue.equals("") || searchValue == null) {
return;
}
List<InputXmlTree> inputTrees = mapperManager.getExternalData().getInputTrees();
List<VarTable> varTables = mapperManager.getExternalData().getVarTables();
List<OutputXmlTree> outputTrees = mapperManager.getExternalData().getOutputTrees();
matcher.setPattern("*" + searchValue.trim() + "*");
int index = -1;
// for the InputTables
for (InputXmlTree inputXmlTree : inputTrees) {
// ExpressionFilter
if (inputXmlTree.getExpressionFilter() != null && matcher.matches(inputXmlTree.getExpressionFilter())) {
EList<Adapter> adapter = inputXmlTree.eAdapters();
if (adapter.size() > 0) {
if (adapter.get(0) instanceof InputXmlTreeEditPart) {
InputXmlTreeEditPart inputXmlTreeEditPart = (InputXmlTreeEditPart) adapter.get(0);
if (inputXmlTreeEditPart != null && inputXmlTreeEditPart.getFigure() != null && inputXmlTreeEditPart.getFigure() instanceof InputXmlTreeFigure) {
InputXmlTreeFigure inputXmlTreeFigure = (InputXmlTreeFigure) inputXmlTreeEditPart.getFigure();
Map<Integer, Figure> map = new HashMap<Integer, Figure>();
map.put(0, inputXmlTreeFigure.getFilterContainer());
index++;
searchMaps.put(index, map);
}
}
}
}
// TreeNode
for (TreeNode node : inputXmlTree.getNodes()) {
// id_Document type
if (XmlMapUtil.DOCUMENT.equals(node.getType())) {
for (TreeNode nodeTemp : XmlMapUtil.getFlatChildrenList(node)) {
if (getMatcherNodeFigure(nodeTemp).size() > 0) {
index++;
searchMaps.put(index, getMatcherNodeFigure(nodeTemp));
}
}
}
if (getMatcherNodeFigure(node).size() > 0) {
index++;
searchMaps.put(index, getMatcherNodeFigure(node));
}
}
}
// for the VarsTables
for (VarTable varTable : varTables) {
for (VarNode node : varTable.getNodes()) {
if (getMatcherNodeFigure(node).size() > 0) {
index++;
searchMaps.put(index, getMatcherNodeFigure(node));
}
}
}
// for the OutputTables
for (OutputXmlTree outputXmlTree : outputTrees) {
// ExpressionFilter
if (outputXmlTree.getExpressionFilter() != null && matcher.matches(outputXmlTree.getExpressionFilter())) {
EList<Adapter> adapter = outputXmlTree.eAdapters();
if (adapter.size() > 0) {
if (adapter.get(0) instanceof OutputXmlTreeEditPart) {
OutputXmlTreeEditPart outputXmlTreeEditPart = (OutputXmlTreeEditPart) adapter.get(0);
if (outputXmlTreeEditPart != null && outputXmlTreeEditPart.getFigure() != null && outputXmlTreeEditPart.getFigure() instanceof OutputXmlTreeFigure) {
OutputXmlTreeFigure outputXmlTreeFigure = (OutputXmlTreeFigure) outputXmlTreeEditPart.getFigure();
Map<Integer, Figure> map = new HashMap<Integer, Figure>();
map.put(0, outputXmlTreeFigure.getFilterContainer());
index++;
searchMaps.put(index, map);
}
}
}
}
// OutputTreeNode
for (OutputTreeNode node : outputXmlTree.getNodes()) {
// id_Document type
if (XmlMapUtil.DOCUMENT.equals(node.getType())) {
for (TreeNode nodeTemp : XmlMapUtil.getFlatChildrenList(node)) {
if (getMatcherNodeFigure(nodeTemp).size() > 0) {
index++;
searchMaps.put(index, getMatcherNodeFigure(nodeTemp));
}
}
} else {
if (getMatcherNodeFigure(node).size() > 0) {
index++;
searchMaps.put(index, getMatcherNodeFigure(node));
}
}
}
}
}
use of org.talend.designer.xmlmap.figures.InputXmlTreeFigure in project tdi-studio-se by Talend.
the class InputXmlTreeEditPart method notifyChanged.
@Override
public void notifyChanged(Notification notification) {
int type = notification.getEventType();
int featureId = notification.getFeatureID(XmlmapPackage.class);
switch(type) {
case Notification.ADD:
case Notification.REMOVE:
case Notification.REMOVE_MANY:
switch(featureId) {
case XmlmapPackage.INPUT_XML_TREE__NODES:
case XmlmapPackage.INPUT_XML_TREE__GLOBAL_MAP_KEYS_VALUES:
refreshChildren();
break;
case XmlmapPackage.ABSTRACT_IN_OUT_TREE__FILTER_INCOMING_CONNECTIONS:
refreshTargetConnections();
break;
}
break;
case Notification.SET:
switch(featureId) {
case XmlmapPackage.INPUT_XML_TREE__NODES:
case XmlmapPackage.INPUT_XML_TREE__GLOBAL_MAP_KEYS_VALUES:
refreshChildren();
break;
case XmlmapPackage.INPUT_XML_TREE__ACTIVATE_CONDENSED_TOOL:
getFigure().validate();
break;
case XmlmapPackage.INPUT_XML_TREE__LOOKUP_MODE:
case XmlmapPackage.INPUT_XML_TREE__MATCHING_MODE:
case XmlmapPackage.INPUT_XML_TREE__INNER_JOIN:
case XmlmapPackage.INPUT_XML_TREE__PERSISTENT:
case XmlmapPackage.INPUT_XML_TREE__MINIMIZED:
case XmlmapPackage.INPUT_XML_TREE__EXPRESSION_FILTER:
((InputXmlTreeFigure) getFigure()).update(featureId);
break;
case XmlmapPackage.ABSTRACT_IN_OUT_TREE__MULTI_LOOPS:
if (getParent() instanceof XmlMapDataEditPart) {
List childPart = ((XmlMapDataEditPart) getParent()).getChildren();
for (Object o : childPart) {
if (o instanceof OutputXmlTreeEditPart) {
OutputXmlTreeEditPart outputPart = (OutputXmlTreeEditPart) o;
boolean hasDocument = XmlMapUtil.hasDocument((OutputXmlTree) outputPart.getModel());
if (!hasDocument) {
OutputXmlTreeFigure outputTreeFigure = (OutputXmlTreeFigure) outputPart.getFigure();
outputTreeFigure.update(XmlmapPackage.ABSTRACT_IN_OUT_TREE__MULTI_LOOPS);
} else {
List nodeChild = outputPart.getChildren();
for (Object nc : nodeChild) {
if (nc instanceof OutputTreeNodeEditPart) {
refreshOutputNodeLoopFunctionBtn((OutputTreeNodeEditPart) nc);
}
}
}
}
}
boolean changed = clearOutputAggregateIfNeeded();
if (changed) {
((XmlMapDataEditPart) getParent()).refresh();
}
((XmlMapGraphicViewer) getViewer()).getMapperManager().getProblemsAnalyser().checkProblems();
((XmlMapGraphicViewer) getViewer()).getMapperManager().getMapperUI().updateStatusBar();
}
}
}
}
Aggregations