Search in sources :

Example 11 with AbstractInOutTable

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

the class UIManager method processColumnNameChanged.

/**
     * DOC amaumont Comment method "processNewProcessColumnName".
     * 
     * @param previousColumnName TODO
     * @param dataMapTableView
     * @param text
     * @param entry
     */
public void processColumnNameChanged(final String previousColumnName, final String newColumnName, final DataMapTableView dataMapTableView, final ITableEntry currentModifiedITableEntry) {
    mapperManager.changeColumnName(currentModifiedITableEntry, previousColumnName, newColumnName);
    Collection<DataMapTableView> tableViews = mapperManager.getTablesView();
    boolean atLeastOneLinkHasBeenRemoved = false;
    for (DataMapTableView view : tableViews) {
        IDataMapTable dataMapTable = view.getDataMapTable();
        List<IColumnEntry> metadataTableEntries = dataMapTable.getColumnEntries();
        for (IColumnEntry entry : metadataTableEntries) {
            if (parseExpression(entry.getExpression(), entry, true, true, false).isAtLeastOneLinkRemoved()) {
                atLeastOneLinkHasBeenRemoved = true;
            }
        }
        // for the input/output table expression filter
        if (dataMapTable instanceof AbstractInOutTable) {
            ExpressionFilterEntry expressionFilterEntry = ((AbstractInOutTable) dataMapTable).getExpressionFilter();
            if (expressionFilterEntry != null && expressionFilterEntry.getExpression() != null) {
                if (parseExpression(expressionFilterEntry.getExpression(), expressionFilterEntry, true, true, false).isAtLeastOneLinkRemoved()) {
                    atLeastOneLinkHasBeenRemoved = true;
                }
            }
        }
    }
    mapperManager.getUiManager().refreshBackground(false, false);
    dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().refresh(currentModifiedITableEntry);
    if (atLeastOneLinkHasBeenRemoved) {
        new AsynchronousThreading(20, false, dataMapTableView.getDisplay(), new Runnable() {

            public void run() {
                TableViewerCreator tableViewerCreatorForColumns = dataMapTableView.getTableViewerCreatorForColumns();
                boolean propagate = MessageDialog.openQuestion(tableViewerCreatorForColumns.getTable().getShell(), //$NON-NLS-1$
                Messages.getString("UIManager.propagateTitle"), //$NON-NLS-1$
                Messages.getString("UIManager.propagateMessage"));
                if (propagate) {
                    TableEntryLocation previousLocation = new TableEntryLocation(currentModifiedITableEntry.getParentName(), previousColumnName);
                    TableEntryLocation newLocation = new TableEntryLocation(currentModifiedITableEntry.getParentName(), newColumnName);
                    mapperManager.replacePreviousLocationInAllExpressions(previousLocation, newLocation);
                }
            }
        }).start();
    }
}
Also used : TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) TableEntryLocation(org.talend.designer.mapper.model.tableentry.TableEntryLocation) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) 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) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) ExpressionFilterEntry(org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry) AsynchronousThreading(org.talend.commons.ui.runtime.thread.AsynchronousThreading)

Example 12 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 dataMapTableView
     */
private void refreshInOutTableAndMetaTable(DataMapTableView dataMapTableView) {
    IMetadataTable metadataTableTarget = ((AbstractInOutTable) dataMapTableView.getDataMapTable()).getMetadataTable();
    dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().refresh();
    MetadataTableEditorView metadataEditorView = getMetadataEditorView(dataMapTableView.getZone());
    if (metadataEditorView != null && metadataEditorView.getMetadataTableEditor() != null && metadataEditorView.getMetadataTableEditor().getMetadataTable() == metadataTableTarget) {
        metadataEditorView.getTableViewerCreator().getTableViewer().refresh();
        metadataEditorView.getTableViewerCreator().refreshTableEditorControls();
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) AbstractMetadataTableEditorView(org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView)

Example 13 with AbstractInOutTable

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

the class MapperManager method replacePreviousLocationInAllExpressions.

/**
     * DOC amaumont Comment method "replacePreviousLocationInAllExpressions".
     */
public void replacePreviousLocationInAllExpressions(final TableEntryLocation previousLocation, final TableEntryLocation newLocation) {
    DataMapExpressionParser dataMapExpressionParser = new DataMapExpressionParser(LanguageProvider.getCurrentLanguage());
    Collection<IDataMapTable> tablesData = getTablesData();
    for (IDataMapTable table : tablesData) {
        List<IColumnEntry> columnEntries = table.getColumnEntries();
        if (table instanceof AbstractInOutTable) {
            replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, ((AbstractInOutTable) table).getExpressionFilter());
        }
        for (IColumnEntry entry : columnEntries) {
            replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
        }
        if (table instanceof OutputTable) {
            List<FilterTableEntry> constraintEntries = ((OutputTable) table).getFilterEntries();
            for (FilterTableEntry entry : constraintEntries) {
                replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
            }
        }
    }
    uiManager.refreshBackground(false, false);
}
Also used : DataMapExpressionParser(org.talend.designer.mapper.utils.DataMapExpressionParser) 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 14 with AbstractInOutTable

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

the class ProblemsManager method checkProblemsForAllEntries.

/**
     * 
     * DOC amaumont Comment method "checkProblemsForAllEntries".
     * 
     * @param dataMapTableView
     * @param forceRefreshData
     * @return true if has errors
     */
@SuppressWarnings("unchecked")
public boolean checkProblemsForAllEntries(DataMapTableView dataMapTableView, boolean forceRefreshData) {
    if (forceRefreshData) {
        mapperManager.getAbstractMapComponent().restoreMapperModelFromInternalData();
        checkProblems();
    }
    boolean hasProblemsWasNull = false;
    if (hasProblems == null) {
        hasProblems = Boolean.FALSE;
        hasProblemsWasNull = true;
    }
    if (dataMapTableView.getDataMapTable() instanceof AbstractInOutTable) {
        AbstractInOutTable table = (AbstractInOutTable) dataMapTableView.getDataMapTable();
        if (table.isActivateExpressionFilter()) {
            checkProblemsForTableEntry(table.getExpressionFilter(), false);
        }
    }
    List<IColumnEntry> columnsEntriesList = dataMapTableView.getDataMapTable().getColumnEntries();
    checkProblemsForAllEntries(columnsEntriesList);
    if (refreshTableEntries) {
        dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().refresh(true);
    }
    if (dataMapTableView.getZone() == Zone.OUTPUTS) {
        List<ITableEntry> constraintEntriesList = dataMapTableView.getTableViewerCreatorForFilters().getInputList();
        checkProblemsForAllEntries(constraintEntriesList);
        if (refreshTableEntries) {
            dataMapTableView.getTableViewerCreatorForFilters().getTableViewer().refresh(true);
        }
    }
    boolean returnedValue = hasProblems;
    if (hasProblemsWasNull) {
        hasProblems = null;
    }
    return returnedValue;
}
Also used : ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry)

Example 15 with AbstractInOutTable

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

the class TableManager method addTable.

/**
     * DOC amaumont Comment method "addTable".
     * 
     * @param view
     * @param tableData
     */
//$NON-NLS-1$
@SuppressWarnings("unchecked")
void addTable(DataMapTableView view, IDataMapTable tableData) {
    if (tableData instanceof AbstractInOutTable) {
        AbstractInOutTable data = (AbstractInOutTable) tableData;
        metadataTableToAbstractDataMapTable.put(data.getMetadataTable(), data);
    }
    if (tableData.getMapperManager() != null)
        if (tableData instanceof OutputTable && ((OutputTable) tableData).isErrorRejectTable()) {
            getMatchedList(tableData).add(0, tableData);
        } else {
            getMatchedList(tableData).add(tableData);
        }
    if (view.getZone() == Zone.INPUTS || view.getZone() == Zone.OUTPUTS) {
        swtTableToView.put(view.getExpressionFilterText(), view);
        swtTableToView.put(view.getColumnNameFilterText(), view);
    }
    swtTableToView.put(view.getTableViewerCreatorForColumns().getTable(), view);
    if (view.getTableViewerCreatorForFilters() != null) {
        swtTableToView.put(view.getTableViewerCreatorForFilters().getTable(), view);
    }
    if (view.getTableViewerCreatorForGlobalMap() != null) {
        swtTableToView.put(view.getTableViewerCreatorForGlobalMap().getTable(), view);
    }
    abstractDataMapTableToView.put(tableData, view);
}
Also used : AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

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