use of org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure in project tdi-studio-se by Talend.
the class TreeNodeEditPart method performRequest.
@Override
public void performRequest(Request req) {
if (RequestConstants.REQ_DIRECT_EDIT.equals(req.getType())) {
Figure figure = null;
DirectEditRequest drequest = (DirectEditRequest) req;
Point figureLocation = drequest.getLocation();
if (getFigure() instanceof TableTreeEntityFigure) {
XmlmapTreeNodeFigure treeNodeFigure = (XmlmapTreeNodeFigure) getFigure();
ArrayList collection = new ArrayList();
collection.add(treeNodeFigure.getExpressionFigure());
collection.add(treeNodeFigure.getBranchContent());
figure = (Figure) treeNodeFigure.findFigureAt(figureLocation.x, figureLocation.y, new FigureSearch(collection));
}
if (figure instanceof IWidgetCell) {
directEditManager = new XmlMapNodeDirectEditManager(this, new XmlMapNodeCellEditorLocator(figure, this));
}
if (directEditManager != null) {
TreeNode outputTreeNode = (TreeNode) getModel();
if (figure instanceof ExpressionFigure) {
if (XmlMapUtil.isExpressionEditable(outputTreeNode)) {
Point location = drequest.getLocation();
if (figure.containsPoint(location)) {
directEditManager.show();
((XmlMapGraphicViewer) getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
}
}
} else if (!(((TreeNode) getModel()).eContainer() instanceof AbstractInOutTree)) {
// disable for RC2
// directEditManager.show();
// ((XmlMapGraphicViewer)
// getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
}
}
}
super.performRequest(req);
}
use of org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure in project tdi-studio-se by Talend.
the class TreeNodeEditPart method createFigure.
@Override
protected IFigure createFigure() {
TreeNode model = (TreeNode) getModel();
boolean isRoot = false;
if (model.eContainer() instanceof AbstractInOutTree) {
isRoot = true;
}
XmlmapTreeNodeFigure treeNodeFigure = new XmlmapTreeNodeFigure(entityManger, isRoot);
return treeNodeFigure;
}
use of org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure in project tdi-studio-se by Talend.
the class SearchZoneMapper method setEntryState.
public void setEntryState(MapperManager mapperManager, EntryState entryState, Figure entry) {
if (entry != null) {
if (entry instanceof XmlmapTreeNodeFigure) {
XmlmapTreeNodeFigure xmlMapTreeNodeFigure = (XmlmapTreeNodeFigure) entry;
if (xmlMapTreeNodeFigure != null) {
if (xmlMapTreeNodeFigure.getExpressionFigure() != null && matcher.matches(xmlMapTreeNodeFigure.getExpressionFigure().getText())) {
xmlMapTreeNodeFigure.getExpressionFigure().setOpaque(true);
xmlMapTreeNodeFigure.getExpressionFigure().setBackgroundColor(entryState.getColor());
}
if (xmlMapTreeNodeFigure.getTreeNode() != null && matcher.matches(xmlMapTreeNodeFigure.getTreeNode().getName())) {
if (XmlMapUtil.isSubElementOfDocument(xmlMapTreeNodeFigure.getTreeNode())) {
if (!xmlMapTreeNodeFigure.getTreeNode().getName().endsWith("(choice)")) {
xmlMapTreeNodeFigure.getBranchContent().setOpaque(true);
xmlMapTreeNodeFigure.getBranchContent().setBackgroundColor(entryState.getColor());
}
} else {
xmlMapTreeNodeFigure.setOpaque(true);
xmlMapTreeNodeFigure.setBackgroundColor(entryState.getColor());
xmlMapTreeNodeFigure.setOpaque(false);
if (xmlMapTreeNodeFigure.getExpressionFigure() != null && !matcher.matches(xmlMapTreeNodeFigure.getExpressionFigure().getText())) {
// xmlMapTreeNodeFigure.getExpressionFigure().setOpaque(true);
// xmlMapTreeNodeFigure.getExpressionFigure().setBackgroundColor(EntryState.NONE.getColor());
}
}
}
}
} else if (entry instanceof VarEntityFigure) {
VarEntityFigure varEntityFigure = (VarEntityFigure) entry;
if (varEntityFigure != null) {
if (varEntityFigure.getExpression() != null && matcher.matches(varEntityFigure.getExpression().getText())) {
varEntityFigure.getExpression().setOpaque(true);
varEntityFigure.getExpression().setBackgroundColor(entryState.getColor());
}
if (varEntityFigure.getVarName() != null && matcher.matches(varEntityFigure.getVarName())) {
varEntityFigure.setOpaque(true);
varEntityFigure.setBackgroundColor(entryState.getColor());
if (varEntityFigure.getExpression() == null || !matcher.matches(varEntityFigure.getExpression().getText())) {
varEntityFigure.getExpression().setOpaque(true);
varEntityFigure.getExpression().setBackgroundColor(EntryState.NONE.getColor());
}
varEntityFigure.getTypeFigure().setOpaque(true);
varEntityFigure.getTypeFigure().setBackgroundColor(EntryState.NONE.getColor());
}
}
} else if (entry instanceof XmlMapFilterContainer) {
XmlMapFilterContainer filterText = (XmlMapFilterContainer) entry;
if (filterText != null && filterText.getTextArea() != null) {
filterText.getTextArea().setOpaque(true);
filterText.getTextArea().setBackgroundColor(entryState.getColor());
}
}
}
}
use of org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure in project tdi-studio-se by Talend.
the class SearchZoneMapper method moveScrollBarZoneAtSelectedTableItem.
public void moveScrollBarZoneAtSelectedTableItem(Figure entry) {
if (entry != null) {
Rectangle bounds = entry.getBounds();
int selection = bounds.y - 100;
if (entry instanceof XmlmapTreeNodeFigure) {
XmlmapTreeNodeFigure xmlMapTreeNodeFigure = (XmlmapTreeNodeFigure) entry;
TreeNode treeNode = xmlMapTreeNodeFigure.getTreeNode();
if (treeNode != null) {
for (Adapter adapter : treeNode.eAdapters()) {
TreeNodeEditPart part = (TreeNodeEditPart) adapter;
XmlMapDataEditPart xmlMapDataEditPart = part.getMapDataEditPart();
if (adapter instanceof OutputTreeNodeEditPart) {
Viewport viewport = xmlMapDataEditPart.getOutputScroll().getViewport();
viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
} else if (adapter instanceof TreeNodeEditPart) {
Viewport viewport = xmlMapDataEditPart.getInputScroll().getViewport();
viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
}
}
}
} else if (entry instanceof VarNodeFigure) {
VarNodeFigure varNodeFigure = (VarNodeFigure) entry;
VarNode varNode = varNodeFigure.getVarNode();
if (varNode != null) {
for (Adapter adapter : varNode.eAdapters()) {
VarNodeEditPart part = (VarNodeEditPart) adapter;
XmlMapDataEditPart xmlMapDataEditPart = part.getMapDataEditPart();
Viewport viewport = xmlMapDataEditPart.getVarScroll().getViewport();
viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
}
}
}
}
}
use of org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure 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;
}
}
}
Aggregations