Search in sources :

Example 21 with InputXmlTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.

the class MapperManager method refreshTreeSchemaEditor.

/**
     * 
     * DOC Administrator Comment method "refreshTreeSchemaEditor".
     * 
     * @param outputTree
     */
public void refreshTreeSchemaEditor(AbstractInOutTree outputTree) {
    XmlTreeSchemaTableView outputTreeSchemaEditor = null;
    if (outputTree instanceof InputXmlTree) {
        outputTreeSchemaEditor = mapperUI.getTabFolderEditors().getInputTreeSchemaEditor();
    } else {
        outputTreeSchemaEditor = mapperUI.getTabFolderEditors().getOutputTreeSchemaEditor();
    }
    TreeSchemaTableEditor editor = new TreeSchemaTableEditor(outputTree);
    outputTreeSchemaEditor.setExtendedTableModel(editor);
// editor.setModifiedBeanListenable(outputTreeSchemaEditor.getTableViewerCreator());
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) TreeSchemaTableEditor(org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEditor) XmlTreeSchemaTableView(org.talend.designer.xmlmap.ui.tabs.table.XmlTreeSchemaTableView)

Example 22 with InputXmlTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.

the class InputLoopTableUtil method getSourceLoopsFromConnectionSource.

private static void getSourceLoopsFromConnectionSource(TreeNode connectionSource, List<TreeNode> soruceLoops, InputXmlTree mainInputTree) {
    InputXmlTree inputTree = (InputXmlTree) XmlMapUtil.getAbstractInOutTree(connectionSource);
    TreeNode loopParentTreeNode = null;
    if (inputTree == mainInputTree) {
        loopParentTreeNode = XmlMapUtil.getLoopParentNode(connectionSource);
        if (loopParentTreeNode != null) {
            soruceLoops.add(loopParentTreeNode);
        }
    } else {
        getLoopSourceFromLookupNode(connectionSource, mainInputTree, soruceLoops);
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)

Example 23 with InputXmlTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.

the class MapDataHelper method rebuildModelInputs.

public void rebuildModelInputs(List<? extends IConnection> inputConn, XmlMapData mapData) {
    // remove no used input tree
    if (mapData.getInputTrees().size() != inputConn.size()) {
        List treesToRemove = new ArrayList();
        for (InputXmlTree inputTree : mapData.getInputTrees()) {
            boolean found = false;
            for (IConnection connection : inputConn) {
                if (inputTree.getName().equals(connection.getName())) {
                    found = true;
                }
            }
            if (!found) {
                for (TreeNode treeNode : inputTree.getNodes()) {
                    XmlMapUtil.detachNodeConnections(treeNode, mapData, true);
                }
                treesToRemove.add(inputTree);
                XmlMapUtil.detachFilterSource(inputTree, mapData);
            }
        }
        mapData.getInputTrees().removeAll(treesToRemove);
    }
    for (IConnection inData : inputConn) {
        String name = inData.getName();
        InputXmlTree inputTree = null;
        for (InputXmlTree in : mapData.getInputTrees()) {
            if (in.getName() != null && in.getName().equals(name)) {
                inputTree = in;
                break;
            }
        }
        if (inputTree == null) {
            inputTree = XmlmapFactory.eINSTANCE.createInputXmlTree();
            inputTree.setName(name);
            inputTree.setLookup(EConnectionType.FLOW_MAIN != inData.getLineStyle());
            mapData.getInputTrees().add(inputTree.isLookup() ? mapData.getInputTrees().size() : 0, inputTree);
        } else {
            inputTree.setLookup(EConnectionType.FLOW_MAIN != inData.getLineStyle());
        }
        if (inputTree.getLookupMode() == null) {
            inputTree.setLookupMode(XML_MAP_LOOKUP_MODE.LOAD_ONCE.toString());
        }
        if (inputTree.getMatchingMode() == null) {
            inputTree.setMatchingMode(XML_MAP_MATCHING_MODE.ALL_ROWS.toString());
        }
        rebuildInputTree(inputTree, inData.getMetadataTable(), mapData);
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) ArrayList(java.util.ArrayList) List(java.util.List) IConnection(org.talend.core.model.process.IConnection)

Example 24 with InputXmlTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.

the class XmlMapTableTree method createColumns.

@Override
protected void createColumns() {
    layoutManager.setAjustToTableWidth(false);
    // table column title
    MapperTable xmlTree = tableModelManager.getModel();
    boolean hasExpression = false;
    if (xmlTree instanceof InputXmlTree) {
        InputXmlTree inputTree = (InputXmlTree) xmlTree;
        if (inputTree.isLookup()) {
            expressionColumn = new TableColumn(ColumnKeyConstant.KEY_EXPRESSION);
            expressionColumn.setText("Exp.key");
            this.addColumn(expressionColumn);
            columnSash = new ColumnSash(this);
            columnSash.setLeftColumn(expressionColumn);
            this.addSeparator(columnSash);
            hasExpression = true;
        }
    } else {
        expressionColumn = new TableColumn(ColumnKeyConstant.KEY_EXPRESSION);
        expressionColumn.setText("Expression");
        this.addColumn(expressionColumn);
        columnSash = new ColumnSash(this);
        columnSash.setLeftColumn(expressionColumn);
        this.addSeparator(columnSash);
        hasExpression = true;
    }
    nameColumn = new TableColumn(ColumnKeyConstant.KEY_NAME);
    nameColumn.setText("Column");
    if (columnSash != null) {
        columnSash.setRightColumn(nameColumn);
    }
    this.addColumn(nameColumn);
    if (hasExpression) {
        layoutManager.setWeight(0, 0.5);
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) MapperTable(org.talend.designer.gefabstractmap.model.abstractmap.MapperTable) ColumnSash(org.talend.designer.gefabstractmap.figures.table.ColumnSash) TableColumn(org.talend.designer.gefabstractmap.figures.table.TableColumn)

Example 25 with InputXmlTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.

the class XmlmapTreeNodeFigure method createEntityItems.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.newabstractmap.figures.table.entity.TableEntityFigure#createEntityItems()
     */
@Override
protected void createEntityItems(TableEntityElement entityElement) {
    this.treeNode = getEntityManager().getModel();
    boolean isLookup = false;
    if (treeNode instanceof OutputTreeNode) {
        isLookup = true;
    } else {
        TreeNode inputTreeNodeRoot = XmlMapUtil.getTreeNodeRoot(treeNode);
        if (inputTreeNodeRoot != null && inputTreeNodeRoot.eContainer() instanceof InputXmlTree) {
            isLookup = ((InputXmlTree) inputTreeNodeRoot.eContainer()).isLookup();
        }
    }
    if (isLookup) {
        expression = new ExpressionFigure();
        expression.setText(treeNode.getExpression());
        if (!XmlMapUtil.isExpressionEditable(treeNode)) {
            expression.setOpaque(true);
            expression.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_EXPREESION_DISABLE));
        } else {
            expression.setOpaque(false);
        }
        entityElement.add(expression);
    }
    branchContent = new XmlmapBranchContent(getEntityManager());
    TreeBranch treeBranch = new TreeBranch(branchContent, !isRoot());
    entityElement.add(treeBranch);
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) TreeBranch(org.talend.designer.gefabstractmap.figures.table.entity.TreeBranch) ExpressionFigure(org.talend.designer.gefabstractmap.figures.ExpressionFigure) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)

Aggregations

InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)52 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)34 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)28 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)26 XmlMapData (org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)18 ArrayList (java.util.ArrayList)17 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)12 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)12 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)9 List (java.util.List)5 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)5 IConnection (org.talend.designer.xmlmap.model.emf.xmlmap.IConnection)5 InputXmlTreeEditPart (org.talend.designer.xmlmap.parts.InputXmlTreeEditPart)5 Connection (org.talend.designer.xmlmap.model.emf.xmlmap.Connection)4 HashMap (java.util.HashMap)3 Point (org.eclipse.draw2d.geometry.Point)3 EList (org.eclipse.emf.common.util.EList)3 ExpressionFigure (org.talend.designer.gefabstractmap.figures.ExpressionFigure)3 LookupConnection (org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)3 Iterator (java.util.Iterator)2