use of org.talend.designer.xmlmap.figures.OutputXmlTreeFigure 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.OutputXmlTreeFigure 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();
}
}
}
}
use of org.talend.designer.xmlmap.figures.OutputXmlTreeFigure in project tdi-studio-se by Talend.
the class OutputTreeNodeEditPart method notifyChanged.
@Override
public void notifyChanged(Notification notification) {
super.notifyChanged(notification);
int type = notification.getEventType();
int featureId = notification.getFeatureID(XmlmapPackage.class);
switch(type) {
case Notification.SET:
switch(featureId) {
case XmlmapPackage.TREE_NODE__TYPE:
if (XmlMapUtil.DOCUMENT.equals(notification.getOldValue()) || !XmlMapUtil.DOCUMENT.equals(notification.getOldValue()) && XmlMapUtil.DOCUMENT.equals(notification.getNewValue())) {
MapperTablePart mapperTablePart = MapperUtils.getMapperTablePart(this);
if (mapperTablePart.getFigure() instanceof OutputXmlTreeFigure) {
((OutputXmlTreeFigure) mapperTablePart.getFigure()).update(XmlmapPackage.TREE_NODE__TYPE);
}
}
break;
case XmlmapPackage.TREE_NODE__LOOP:
((XmlmapTreeNodeFigure) getFigure()).getBranchContent().updateLoopButtonFigure();
AbstractInOutTree abstractInOutTree = XmlMapUtil.getAbstractInOutTree((OutputTreeNode) getModel());
if (abstractInOutTree != null) {
((XmlMapGraphicViewer) getViewer()).getMapperManager().getProblemsAnalyser().checkProblems(abstractInOutTree);
((XmlMapGraphicViewer) getViewer()).getMapperManager().getMapperUI().updateStatusBar();
}
}
break;
case Notification.REMOVE:
case Notification.REMOVE_MANY:
switch(featureId) {
}
// }
case Notification.ADD:
case Notification.ADD_MANY:
switch(featureId) {
case XmlmapPackage.INPUT_LOOP_NODES_TABLE__INPUTLOOPNODES:
case XmlmapPackage.OUTPUT_TREE_NODE__INPUT_LOOP_NODES_TABLE:
XmlmapTreeNodeFigure outputFigure = (XmlmapTreeNodeFigure) getFigure();
if (outputFigure.getElement() != null) {
outputFigure.getBranchContent().updateLoopButtonFigure();
}
break;
default:
break;
}
}
}
use of org.talend.designer.xmlmap.figures.OutputXmlTreeFigure in project tdi-studio-se by Talend.
the class OutputXmlTreeEditPart 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.OUTPUT_XML_TREE__NODES:
refreshChildren();
break;
case XmlmapPackage.ABSTRACT_IN_OUT_TREE__FILTER_INCOMING_CONNECTIONS:
refreshTargetConnections();
break;
}
break;
case Notification.SET:
switch(featureId) {
case XmlmapPackage.OUTPUT_XML_TREE__NODES:
refreshChildren();
case XmlmapPackage.OUTPUT_XML_TREE__REJECT:
case XmlmapPackage.OUTPUT_XML_TREE__REJECT_INNER_JOIN:
case XmlmapPackage.OUTPUT_XML_TREE__EXPRESSION_FILTER:
case XmlmapPackage.OUTPUT_XML_TREE__MINIMIZED:
case XmlmapPackage.OUTPUT_XML_TREE__ALL_IN_ONE:
case XmlmapPackage.OUTPUT_XML_TREE__ENABLE_EMPTY_ELEMENT:
((OutputXmlTreeFigure) getFigure()).update(featureId);
break;
case XmlmapPackage.TREE_NODE__EXPRESSION:
((OutputXmlTreeFigure) getFigure()).update(XmlmapPackage.TREE_NODE__TYPE);
break;
case XmlmapPackage.ABSTRACT_IN_OUT_TREE__MULTI_LOOPS:
// fix for TDI-20808 , clean aggreage and groups if it's multiloops
OutputXmlTree model = (OutputXmlTree) getModel();
boolean changed = false;
if (model.isMultiLoops()) {
changed = XmlMapUtil.cleanGroup(model.getNodes());
}
if (model.isMultiLoops() && getParent() instanceof XmlMapDataEditPart) {
List childPart = ((XmlMapDataEditPart) getParent()).getChildren();
for (Object o : childPart) {
if (o instanceof InputXmlTreeEditPart) {
InputXmlTree inputTree = (InputXmlTree) ((InputXmlTreeEditPart) o).getModel();
if (inputTree.isMultiLoops() && !inputTree.isLookup()) {
changed = XmlMapUtil.cleanAggregate(model.getNodes()) || changed;
break;
}
}
}
}
if (changed) {
refreshChildren();
}
}
}
// change icon for set loop function button
if (type == Notification.ADD && featureId == XmlmapPackage.OUTPUT_XML_TREE__INPUT_LOOP_NODES_TABLES) {
final InputLoopNodesTable loopNodeTable = (InputLoopNodesTable) notification.getNewValue();
addListenerForInputLoopNodeTable(loopNodeTable);
}
}
Aggregations