Search in sources :

Example 1 with TreeSchemaTableEntry

use of org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry in project tdi-studio-se by Talend.

the class SetLoopFunctionDialog method updateStatus.

private void updateStatus(boolean refreshTree) {
    if (refreshTree) {
        tableViwer.getTableViewerCreator().getTableViewer().refresh();
    }
    List<String> xpath = new ArrayList<String>();
    boolean findDuplicated = false;
    for (TreeSchemaTableEntry entry : tableModel.getBeansList()) {
        if (xpath.contains(entry.getXPath())) {
            findDuplicated = true;
        } else {
            xpath.add(entry.getXPath());
        }
    }
    Button button = getButton(IDialogConstants.OK_ID);
    if (findDuplicated) {
        statusLabel.setText("Duplicated source loop node exist in the table ,please remove it.");
        button.setEnabled(false);
    } else {
        statusLabel.setText("");
        button.setEnabled(true);
    }
}
Also used : CopyPushButton(org.talend.commons.ui.swt.advanced.dataeditor.button.CopyPushButton) Button(org.eclipse.swt.widgets.Button) AddPushButton(org.talend.commons.ui.swt.advanced.dataeditor.button.AddPushButton) ArrayList(java.util.ArrayList) TreeSchemaTableEntry(org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry)

Example 2 with TreeSchemaTableEntry

use of org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry in project tdi-studio-se by Talend.

the class SetLoopFunctionDialog method okPressed.

@Override
protected void okPressed() {
    List<TreeNode> usedLoops = new ArrayList<TreeNode>();
    for (TreeSchemaTableEntry entry : tableModel.getBeansList()) {
        usedLoops.add(entry.getTreeNode());
    }
    inputLoopNodesTable.getInputloopnodes().clear();
    inputLoopNodesTable.getInputloopnodes().addAll(usedLoops);
    super.okPressed();
}
Also used : TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) TreeSchemaTableEntry(org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry)

Example 3 with TreeSchemaTableEntry

use of org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry in project tdi-studio-se by Talend.

the class MapperManager method getSelectedInputTreeSchemaModel.

public ExtendedTableModel<TreeSchemaTableEntry> getSelectedInputTreeSchemaModel(InputXmlTree inputXmlTree) {
    if (inputXmlTree == null && !getExternalData().getInputTrees().isEmpty()) {
        inputXmlTree = getExternalData().getInputTrees().get(0);
    }
    List<TreeSchemaTableEntry> treeSchemaEntrys = new ArrayList<TreeSchemaTableEntry>();
    ExtendedTableModel<TreeSchemaTableEntry> tableModel = new ExtendedTableModel<TreeSchemaTableEntry>("Tree Schema", treeSchemaEntrys);
    if (inputXmlTree != null) {
        tableModel.setName(inputXmlTree.getName());
        EList<TreeNode> nodes = inputXmlTree.getNodes();
        for (TreeNode node : nodes) {
            if (XmlMapUtil.DOCUMENT.equals(node.getType())) {
                addTreeSchemaEnties(tableModel, node.getChildren());
            }
        }
    }
    return tableModel;
}
Also used : OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) ExtendedTableModel(org.talend.commons.ui.swt.extended.table.ExtendedTableModel) TreeSchemaTableEntry(org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry)

Example 4 with TreeSchemaTableEntry

use of org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry in project tdi-studio-se by Talend.

the class MapperManager method getSelectedOutputTreeSchemaModel.

public ExtendedTableModel<TreeSchemaTableEntry> getSelectedOutputTreeSchemaModel(OutputXmlTree outputXmlTree) {
    if (outputXmlTree == null && !getExternalData().getOutputTrees().isEmpty()) {
        outputXmlTree = getExternalData().getOutputTrees().get(0);
    }
    List<TreeSchemaTableEntry> treeSchemaEntrys = new ArrayList<TreeSchemaTableEntry>();
    ExtendedTableModel<TreeSchemaTableEntry> tableModel = new ExtendedTableModel<TreeSchemaTableEntry>("Tree Schema", treeSchemaEntrys);
    if (outputXmlTree != null) {
        tableModel.setName(outputXmlTree.getName());
        EList<OutputTreeNode> nodes = outputXmlTree.getNodes();
        for (TreeNode node : nodes) {
            if (XmlMapUtil.DOCUMENT.equals(node.getType())) {
                addTreeSchemaEnties(tableModel, node.getChildren());
            }
        }
    }
    return tableModel;
}
Also used : OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) ExtendedTableModel(org.talend.commons.ui.swt.extended.table.ExtendedTableModel) TreeSchemaTableEntry(org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry)

Example 5 with TreeSchemaTableEntry

use of org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry in project tdi-studio-se by Talend.

the class MapperManager method addTreeSchemaEnties.

private void addTreeSchemaEnties(ExtendedTableModel<TreeSchemaTableEntry> tableModel, EList<TreeNode> nodes) {
    for (TreeNode node : nodes) {
        // avoid to edit choice and subs in schema editor
        if (!node.isChoice() && !node.isSubstitution()) {
            TreeSchemaTableEntry entry = new TreeSchemaTableEntry(node);
            tableModel.add(entry);
        }
        if (!node.getChildren().isEmpty()) {
            addTreeSchemaEnties(tableModel, node.getChildren());
        }
    }
}
Also used : OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) TreeSchemaTableEntry(org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry)

Aggregations

TreeSchemaTableEntry (org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaTableEntry)7 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)6 ArrayList (java.util.ArrayList)5 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)3 AddPushButton (org.talend.commons.ui.swt.advanced.dataeditor.button.AddPushButton)2 CopyPushButton (org.talend.commons.ui.swt.advanced.dataeditor.button.CopyPushButton)2 ExtendedTableModel (org.talend.commons.ui.swt.extended.table.ExtendedTableModel)2 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Table (org.eclipse.swt.widgets.Table)1 CellEditorValueAdapter (org.talend.commons.ui.runtime.swt.tableviewer.behavior.CellEditorValueAdapter)1 ExtendedToolbarView (org.talend.commons.ui.swt.advanced.dataeditor.ExtendedToolbarView)1 AddPushButtonForExtendedTable (org.talend.commons.ui.swt.advanced.dataeditor.button.AddPushButtonForExtendedTable)1 TableViewerCreatorColumn (org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)1 IBeanPropertyAccessors (org.talend.commons.utils.data.bean.IBeanPropertyAccessors)1 InputLoopNodesTable (org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable)1