use of org.talend.designer.gefabstractmap.figures.treetools.ToolBarButtonImageFigure in project tdi-studio-se by Talend.
the class XmlmapBranchContent method createContent.
@Override
protected void createContent() {
super.createContent();
statusFigure = new Label();
statusFigure.setForegroundColor(ColorConstants.red);
statusFigure.setText(getStatus());
defaultValue = new Label();
defaultValue.setForegroundColor(ColorConstants.blue);
defaultValue.setText(getDefaultValue());
ImageInfo infor = ImageInfo.SETLOOPFUNCTION_BUTTON;
if (treeNode instanceof OutputTreeNode) {
InputLoopNodesTable inputLoopNodesTable = ((OutputTreeNode) treeNode).getInputLoopNodesTable();
infor = (inputLoopNodesTable == null || inputLoopNodesTable.getInputloopnodes().isEmpty()) ? ImageInfo.SETLOOPFUNCTION_BUTTON_ERROR : ImageInfo.SETLOOPFUNCTION_BUTTON;
}
loopButtonFigure = new ToolBarButtonImageFigure(ImageProviderMapper.getImage(infor));
loopButtonFigure.addMouseListener(new MouseListener.Stub() {
@Override
public void mousePressed(MouseEvent me) {
OutputTreeNode outputTreeNode = (OutputTreeNode) treeNode;
List<TreeNode> loopNodes = new ArrayList<TreeNode>();
if (manager.isMainTableMultiLoop()) {
loopNodes.addAll(XmlMapUtil.getMultiLoopsForXmlTree(manager.getMainInputTree()));
}
InputLoopNodesTable inputLoopNodesTable = null;
if (outputTreeNode.getInputLoopNodesTable() != null) {
inputLoopNodesTable = outputTreeNode.getInputLoopNodesTable();
} else {
inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
outputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
AbstractInOutTree abstractInOutTree = XmlMapUtil.getAbstractInOutTree(outputTreeNode);
if (abstractInOutTree != null) {
((OutputXmlTree) abstractInOutTree).getInputLoopNodesTables().add(inputLoopNodesTable);
}
}
SetLoopFunctionDialog nsDialog = new SetLoopFunctionDialog(null, outputTreeNode.getInputLoopNodesTable(), loopNodes);
if (nsDialog.open() == Window.OK) {
manager.getProblemsAnalyser().checkProblems(XmlMapUtil.getAbstractInOutTree(outputTreeNode));
manager.getMapperUI().updateStatusBar();
}
}
});
if (treeNode != null && treeNode instanceof OutputTreeNode) {
// display loop setup button only when input main is multiloop
if (treeNode.isLoop() && manager.isMainTableMultiLoop()) {
this.add(loopButtonFigure);
}
}
this.add(statusFigure);
this.add(defaultValue);
}
Aggregations