Search in sources :

Example 21 with InputTable

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

the class InputDataMapTableView method addToolItems.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.mapper.ui.visualmap.table.DataMapTableView#addEntriesActionsComponents()
     */
@Override
protected boolean addToolItems() {
    // TODO: unlock this tentatively.
    if (!getInputTable().isMainConnection()) {
        final InputTable table = getInputTable();
        // condensed Item
        condensedItem = new ToolItem(toolBarActions, SWT.CHECK);
        // condensedItem.setEnabled(!mapperManager.componentIsReadOnly());
        condensedItem.setSelection(table.isActivateCondensedTool());
        condensedItem.setToolTipText("tMap settings");
        initCondensedItemImage();
        condensedItem.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                table.setActivateCondensedTool(condensedItem.getSelection());
                showTableMapSetting(condensedItem.getSelection());
            }
        });
        if (mapperManager.isPersistentMap()) {
            TMAP_LOOKUP_MODE lookupMode = (TMAP_LOOKUP_MODE) table.getLookupMode();
            switch(lookupMode) {
                case LOAD_ONCE:
                case LOAD_ONCE_AND_UPDATE:
                case RELOAD:
                    persistentCheckEditable = true;
                    previousValidPersistentMode = table.isPersistent();
                    break;
                case CACHE_OR_RELOAD:
                    persistentCheckEditable = false;
                    getInputTable().setPersistent(false);
                    break;
                default:
                    break;
            }
        }
    }
    createActivateFilterCheck();
    createColumnNameFilterCheck();
    return true;
}
Also used : InputTable(org.talend.designer.mapper.model.table.InputTable) TMAP_LOOKUP_MODE(org.talend.designer.mapper.model.table.TMAP_LOOKUP_MODE) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 22 with InputTable

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

the class ExternalDataConverter method loadInExternalData.

private void loadInExternalData(Collection<? extends AbstractDataMapTable> tables) {
    for (IDataMapTable table : tables) {
        ExternalMapperTable externalMapperTable = new ExternalMapperTable();
        fillExternalTable(table, externalMapperTable);
        ArrayList<ExternalMapperTableEntry> perTableEntries = new ArrayList<ExternalMapperTableEntry>();
        boolean isVarTable = table instanceof VarsTable;
        boolean isInputTable = table instanceof InputTable;
        for (ITableEntry dataMapTableEntry : table.getColumnEntries()) {
            ExternalMapperTableEntry externalMapperTableEntry = new ExternalMapperTableEntry();
            externalMapperTableEntry.setExpression(dataMapTableEntry.getExpression());
            externalMapperTableEntry.setName(dataMapTableEntry.getName());
            if (isVarTable) {
                externalMapperTableEntry.setType(((VarTableEntry) dataMapTableEntry).getType());
                externalMapperTableEntry.setNullable(((VarTableEntry) dataMapTableEntry).isNullable());
            } else {
                externalMapperTableEntry.setType(((AbstractInOutTableEntry) dataMapTableEntry).getMetadataColumn().getTalendType());
                externalMapperTableEntry.setNullable(((AbstractInOutTableEntry) dataMapTableEntry).getMetadataColumn().isNullable());
            }
            if (isInputTable) {
                externalMapperTableEntry.setOperator(((InputColumnTableEntry) dataMapTableEntry).getOperator());
            }
            perTableEntries.add(externalMapperTableEntry);
        }
        externalMapperTable.setMetadataTableEntries(perTableEntries);
    }
}
Also used : InputTable(org.talend.designer.mapper.model.table.InputTable) VarsTable(org.talend.designer.mapper.model.table.VarsTable) ExternalMapperTableEntry(org.talend.designer.mapper.external.data.ExternalMapperTableEntry) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) ArrayList(java.util.ArrayList) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) ExternalMapperTable(org.talend.designer.mapper.external.data.ExternalMapperTable) AbstractInOutTableEntry(org.talend.designer.mapper.model.tableentry.AbstractInOutTableEntry)

Example 23 with InputTable

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

the class MapperMain method getMetadataListIn.

/**
     * DOC amaumont Comment method "getMetadataListIn".
     */
public List<IMetadataTable> getMetadataListIn() {
    List<InputTable> tables = mapperManager.getInputTables();
    List<IMetadataTable> metadataTables = new ArrayList<IMetadataTable>(tables.size());
    for (InputTable table : tables) {
        metadataTables.add(table.getMetadataTable());
    }
    return metadataTables;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) InputTable(org.talend.designer.mapper.model.table.InputTable) ArrayList(java.util.ArrayList)

Example 24 with InputTable

use of org.talend.designer.mapper.model.table.InputTable 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

InputTable (org.talend.designer.mapper.model.table.InputTable)24 ArrayList (java.util.ArrayList)10 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)8 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)8 GlobalMapEntry (org.talend.designer.mapper.model.tableentry.GlobalMapEntry)8 OutputTable (org.talend.designer.mapper.model.table.OutputTable)5 HashMap (java.util.HashMap)4 List (java.util.List)4 VarsTable (org.talend.designer.mapper.model.table.VarsTable)4 InputColumnTableEntry (org.talend.designer.mapper.model.tableentry.InputColumnTableEntry)4 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)4 Point (org.eclipse.swt.graphics.Point)3 GridData (org.eclipse.swt.layout.GridData)3 Table (org.eclipse.swt.widgets.Table)3 TableItem (org.eclipse.swt.widgets.TableItem)3 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)3 IOConnection (org.talend.designer.mapper.external.connection.IOConnection)3 ExternalMapperTable (org.talend.designer.mapper.external.data.ExternalMapperTable)3 AbstractInOutTable (org.talend.designer.mapper.model.table.AbstractInOutTable)3 ExpressionFilterEntry (org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry)3