Search in sources :

Example 41 with IColumnEntry

use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry 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 42 with IColumnEntry

use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.

the class TableEntriesManager method addTableEntry.

/**
     * DOC amaumont Comment method "addTableEntry".
     * 
     * @param dataMapTableEntry
     * @param index
     */
public void addTableEntry(ITableEntry dataMapTableEntry, Integer index) {
    if (dataMapTableEntry == null) {
        throw new IllegalArgumentException(Messages.getString(//$NON-NLS-1$
        "TableEntriesManager.exceptionMessage.dataMapTableEntryCannotNull"));
    }
    add(dataMapTableEntry);
    IDataMapTable dataMapTable = dataMapTableEntry.getParent();
    if (dataMapTableEntry instanceof IColumnEntry) {
        if (index == null) {
            dataMapTable.addColumnEntry((IColumnEntry) dataMapTableEntry);
        } else {
            dataMapTable.addColumnEntry((IColumnEntry) dataMapTableEntry, index);
        }
    } else if (dataMapTableEntry instanceof FilterTableEntry) {
        if (index == null) {
            ((OutputTable) dataMapTable).addFilterEntry((FilterTableEntry) dataMapTableEntry);
        } else {
            ((OutputTable) dataMapTable).addFilterEntry((FilterTableEntry) dataMapTableEntry, index);
        }
    } else if (dataMapTableEntry instanceof GlobalMapEntry) {
        if (index == null) {
            ((InputTable) dataMapTable).addGlobalMapEntry((GlobalMapEntry) dataMapTableEntry);
        } else {
            ((InputTable) dataMapTable).addGlobalMapEntry((GlobalMapEntry) dataMapTableEntry, index);
        }
    } else {
        String exceptionMessage = Messages.getString("TableEntriesManager.exceptionMessage.typeIsNotValid", //$NON-NLS-1$
        dataMapTableEntry.getClass().toString());
        throw new IllegalArgumentException(exceptionMessage);
    }
// TableEntriesManagerEvent event = new TableEntriesManagerEvent(EVENT_TYPE.ADD);
// event.entry = dataMapTableEntry;
// fireEvent(event);
}
Also used : InputTable(org.talend.designer.mapper.model.table.InputTable) FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry)

Aggregations

IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)42 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)16 FilterTableEntry (org.talend.designer.dbmap.model.tableentry.FilterTableEntry)11 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)10 OutputTable (org.talend.designer.dbmap.model.table.OutputTable)10 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)9 InputTable (org.talend.designer.mapper.model.table.InputTable)8 ExpressionFilterEntry (org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry)8 FilterTableEntry (org.talend.designer.mapper.model.tableentry.FilterTableEntry)8 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 TableViewer (org.eclipse.jface.viewers.TableViewer)6 AbstractInOutTable (org.talend.designer.mapper.model.table.AbstractInOutTable)6 OutputTable (org.talend.designer.mapper.model.table.OutputTable)6 InputTable (org.talend.designer.dbmap.model.table.InputTable)5 TableEntryLocation (org.talend.designer.dbmap.model.tableentry.TableEntryLocation)5 GlobalMapEntry (org.talend.designer.mapper.model.tableentry.GlobalMapEntry)5 TableEntryLocation (org.talend.designer.mapper.model.tableentry.TableEntryLocation)5 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)4