Search in sources :

Example 6 with AbstractInOutTable

use of org.talend.designer.mapper.model.table.AbstractInOutTable in project tdi-studio-se by Talend.

the class UIManager method parseAllExpressions.

/**
     * DOC amaumont Comment method "processAllExpressions".
     * 
     * @param newLinksMustHaveSelectedState TODO
     */
@SuppressWarnings("unchecked")
public void parseAllExpressions(DataMapTableView dataMapTableView, boolean newLinksMustHaveSelectedState) {
    List<IColumnEntry> columnsEntriesList = dataMapTableView.getDataMapTable().getColumnEntries();
    parseAllExpressions(columnsEntriesList, newLinksMustHaveSelectedState);
    if (mapperManager.isAdvancedMap() && (dataMapTableView.getZone() == Zone.INPUTS || dataMapTableView.getZone() == Zone.OUTPUTS)) {
        AbstractInOutTable table = (AbstractInOutTable) dataMapTableView.getDataMapTable();
        if (dataMapTableView.getZone() == Zone.INPUTS) {
            InputTable inputTable = (InputTable) table;
            List<GlobalMapEntry> globalMapEntries = inputTable.getGlobalMapEntries();
            if (globalMapEntries != null && !inputTable.isMainConnection()) {
                parseAllExpressions(globalMapEntries, newLinksMustHaveSelectedState);
            }
        }
        if (table.isActivateExpressionFilter()) {
            ExpressionFilterEntry expressionFilter = table.getExpressionFilter();
            parseExpression(expressionFilter.getExpression(), expressionFilter, newLinksMustHaveSelectedState, false, false);
        }
    } else if (dataMapTableView.getZone() == Zone.OUTPUTS) {
        List<ITableEntry> constraintEntriesList = dataMapTableView.getTableViewerCreatorForFilters().getInputList();
        parseAllExpressions(constraintEntriesList, newLinksMustHaveSelectedState);
    }
}
Also used : InputTable(org.talend.designer.mapper.model.table.InputTable) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) ArrayList(java.util.ArrayList) List(java.util.List) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry) ExpressionFilterEntry(org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry)

Example 7 with AbstractInOutTable

use of org.talend.designer.mapper.model.table.AbstractInOutTable in project tdi-studio-se by Talend.

the class UIManager method refreshInOutTableAndMetaTable.

/**
     * DOC amaumont Comment method "refreshInOutTableAndMetaTable".
     * 
     * @param currentModifiedTableEntry can be null
     */
private void refreshInOutTableAndMetaTable(AbstractInOutTableEntry currentModifiedTableEntry) {
    DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentModifiedTableEntry);
    IMetadataTable metadataTableTarget = ((AbstractInOutTable) dataMapTableView.getDataMapTable()).getMetadataTable();
    dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().refresh(currentModifiedTableEntry);
    MetadataTableEditorView metadataEditorView = getMetadataEditorView(dataMapTableView.getZone());
    if (metadataEditorView != null && metadataEditorView.getMetadataTableEditor() != null && metadataEditorView.getMetadataTableEditor().getMetadataTable() == metadataTableTarget) {
        metadataEditorView.getTableViewerCreator().getTableViewer().refresh(currentModifiedTableEntry.getMetadataColumn());
        metadataEditorView.getTableViewerCreator().refreshTableEditorControls();
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) InputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.OutputDataMapTableView) VarsDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.VarsDataMapTableView) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) AbstractMetadataTableEditorView(org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView)

Example 8 with AbstractInOutTable

use of org.talend.designer.mapper.model.table.AbstractInOutTable in project tdi-studio-se by Talend.

the class UIManager method setTraceFilterParaMapper.

/**
     * DOC wzhang Comment method "setTraceFilterParaMapper".
     */
public void setTraceFilterParaMapper(Map<IConnection, Set<String>> preColumnSet, List<? extends AbstractInOutTable> curTables, Map<IConnection, Map<String, String>> changedColumnMap) {
    for (IConnection curConn : preColumnSet.keySet()) {
        Set<String> addedColumns = new HashSet<String>();
        Set<String> preColSet = preColumnSet.get(curConn);
        Map<String, String> changedColumns = changedColumnMap.get(curConn);
        for (AbstractInOutTable table : curTables) {
            String curTableName = table.getName();
            if (curTableName.equals(curConn.getUniqueName())) {
                if (changedColumns != null) {
                    for (String newName : changedColumns.keySet()) {
                        String oldName = changedColumns.get(newName);
                        if (preColSet.contains(oldName)) {
                            preColSet.remove(oldName);
                            preColSet.add(newName);
                        }
                    }
                }
                List<IMetadataColumn> curTableColumn = table.getMetadataTable().getListColumns();
                for (IMetadataColumn curColumn : curTableColumn) {
                    if (!(preColSet.contains(curColumn.getLabel()))) {
                        addedColumns.add(curColumn.getLabel());
                    }
                }
            }
        }
        CorePlugin.getDefault().getDesignerCoreService().updateTraceColumnValues(curConn, changedColumns, addedColumns);
    }
}
Also used : AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) IConnection(org.talend.core.model.process.IConnection) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) HashSet(java.util.HashSet)

Example 9 with AbstractInOutTable

use of org.talend.designer.mapper.model.table.AbstractInOutTable in project tdi-studio-se by Talend.

the class MapperManager method removeTablePair.

/**
     * 
     * Remove the <code>DataMapTableView</code>-<code>DataMapTable</code> pair.
     * 
     * @param view
     */
public void removeTablePair(DataMapTableView view) {
    IDataMapTable dataTable = tableManager.getData(view);
    List<IColumnEntry> dataMapTableEntries = dataTable.getColumnEntries();
    if (isAdvancedMap() && dataTable instanceof AbstractInOutTable) {
        tableEntriesManager.removeAll(Arrays.asList(((AbstractInOutTable) dataTable).getExpressionFilter()));
    }
    tableEntriesManager.removeAll(dataMapTableEntries);
    if (dataTable instanceof OutputTable) {
        List<FilterTableEntry> constraintEntries = ((OutputTable) dataTable).getFilterEntries();
        tableEntriesManager.removeAll(constraintEntries);
    }
    tableManager.removeTable(view);
}
Also used : AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Example 10 with AbstractInOutTable

use of org.talend.designer.mapper.model.table.AbstractInOutTable in project tdi-studio-se by Talend.

the class InputDataMapTableView method createGlobalMapTable.

protected void createGlobalMapTable() {
    this.extendedTableViewerForGlobalMap = new AbstractExtendedTableViewer<GlobalMapEntry>(((InputTable) abstractDataMapTable).getTableGlobalMapEntriesModel(), centerComposite) {

        @Override
        protected void createColumns(TableViewerCreator<GlobalMapEntry> tableViewerCreator, Table table) {
            createGlobalMapColumns(tableViewerCreator);
        }

        /*
             * (non-Javadoc)
             * 
             * @see
             * org.talend.commons.ui.swt.extended.macrotable.AbstractExtendedTableViewer#setTableViewerCreatorOptions
             * (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)
             */
        @Override
        protected void setTableViewerCreatorOptions(TableViewerCreator<GlobalMapEntry> newTableViewerCreator) {
            super.setTableViewerCreatorOptions(newTableViewerCreator);
            newTableViewerCreator.setColumnsResizableByDefault(true);
            newTableViewerCreator.setShowLineSelection(SHOW_ROW_SELECTION.FULL);
            newTableViewerCreator.setBorderVisible(false);
            newTableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
            newTableViewerCreator.setKeyboardManagementForCellEdition(true);
            newTableViewerCreator.setHorizontalScroll(false);
            newTableViewerCreator.setVerticalScroll(false);
            // tableViewerCreatorForColumns.setUseCustomItemColoring(this.getDataMapTable()
            // instanceof
            // AbstractInOutTable);
            newTableViewerCreator.setFirstColumnMasked(true);
        }
    };
    tableViewerCreatorForGlobalMap = this.extendedTableViewerForGlobalMap.getTableViewerCreator();
    if (mapperManager.componentIsReadOnly()) {
        tableViewerCreatorForGlobalMap.setReadOnly(true);
    }
    this.extendedTableViewerForGlobalMap.setCommandStack(mapperManager.getCommandStack());
    tableForGlobalMap = tableViewerCreatorForGlobalMap.getTable();
    tableForGlobalMapGridData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    tableForGlobalMap.setLayoutData(tableForGlobalMapGridData);
    boolean tableGlobalMapVisible = false;
    if (abstractDataMapTable instanceof InputTable) {
        IUILookupMode lookupMode = ((InputTable) abstractDataMapTable).getLookupMode();
        tableGlobalMapVisible = lookupMode == TMAP_LOOKUP_MODE.RELOAD || lookupMode == TMAP_LOOKUP_MODE.CACHE_OR_RELOAD;
    }
    tableForGlobalMapGridData.exclude = !tableGlobalMapVisible;
    tableForGlobalMap.setVisible(tableGlobalMapVisible);
    if (!mapperManager.componentIsReadOnly()) {
        new DragNDrop(mapperManager, tableForGlobalMap, false, true);
    }
    tableViewerCreatorForGlobalMap.addCellValueModifiedListener(new ITableCellValueModifiedListener() {

        public void cellValueModified(TableCellValueModifiedEvent e) {
            unselectAllEntriesIfErrorDetected(e);
        }
    });
    final TableViewer tableViewer = tableViewerCreatorForGlobalMap.getTableViewer();
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            selectThisDataMapTableView();
            UIManager uiManager = mapperManager.getUiManager();
            uiManager.selectLinks(InputDataMapTableView.this, uiManager.extractSelectedTableEntries(selection), false, false);
        }
    });
    tableForGlobalMap.addListener(SWT.KeyDown, new Listener() {

        public void handleEvent(Event event) {
            processEnterKeyDown(tableViewerCreatorForGlobalMap, event);
        }
    });
    tableViewerCreatorForGlobalMap.setLabelProvider(new DefaultTableLabelProvider(tableViewerCreatorForGlobalMap) {

        @Override
        public Color getBackground(Object element, int columnIndex) {
            return getBackgroundCellColor(tableViewerCreator, element, columnIndex);
        }

        @Override
        public Color getForeground(Object element, int columnIndex) {
            return getForegroundCellColor(tableViewerCreator, element, columnIndex);
        }
    });
    initShowMessageErrorListener(tableForGlobalMap);
}
Also used : IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) InputTable(org.talend.designer.mapper.model.table.InputTable) Table(org.eclipse.swt.widgets.Table) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) DefaultHeaderColumnSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultHeaderColumnSelectionListener) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ArmListener(org.eclipse.swt.events.ArmListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) IUILookupMode(org.talend.designer.mapper.model.table.IUILookupMode) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Color(org.eclipse.swt.graphics.Color) UIManager(org.talend.designer.mapper.managers.UIManager) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) Point(org.eclipse.swt.graphics.Point) InputTable(org.talend.designer.mapper.model.table.InputTable) DragNDrop(org.talend.designer.mapper.ui.dnd.DragNDrop) GridData(org.eclipse.swt.layout.GridData) ISelection(org.eclipse.jface.viewers.ISelection) DefaultTableLabelProvider(org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultTableLabelProvider) FocusEvent(org.eclipse.swt.events.FocusEvent) ArmEvent(org.eclipse.swt.events.ArmEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry) TableViewer(org.eclipse.jface.viewers.TableViewer) AbstractExtendedTableViewer(org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer)

Aggregations

AbstractInOutTable (org.talend.designer.mapper.model.table.AbstractInOutTable)17 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)9 OutputTable (org.talend.designer.mapper.model.table.OutputTable)8 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)6 TableViewer (org.eclipse.jface.viewers.TableViewer)5 Table (org.eclipse.swt.widgets.Table)5 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)5 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)4 FocusEvent (org.eclipse.swt.events.FocusEvent)4 FocusListener (org.eclipse.swt.events.FocusListener)4 GridData (org.eclipse.swt.layout.GridData)4 AbstractExtendedTableViewer (org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer)4 InputTable (org.talend.designer.mapper.model.table.InputTable)4 GlobalMapEntry (org.talend.designer.mapper.model.tableentry.GlobalMapEntry)4 Point (org.eclipse.swt.graphics.Point)3 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)3 AbstractMetadataTableEditorView (org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView)3 MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)3 ExpressionFilterEntry (org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry)3