Search in sources :

Example 6 with TablesZoneView

use of org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView in project tdi-studio-se by Talend.

the class MapperManager method addInputAliasTable.

/**
     * DOC amaumont Comment method "addAlias".
     */
public void addInputAliasTable() {
    AliasDialog aliasDialog = new AliasDialog(this, tableManager.getPhysicalInputTableNames(), tableManager.getAliases(), tableManager.getVisibleTables());
    if (!aliasDialog.open()) {
        return;
    }
    List<IOConnection> incomingConnections = getComponent().getMapperMain().getIoInputConnections();
    IOConnection connectionFound = null;
    for (IOConnection connection : incomingConnections) {
        if (connection.getName().equalsIgnoreCase(aliasDialog.getTableName())) {
            connectionFound = connection;
            break;
        }
    }
    List<DataMapTableView> inputsTablesView = getUiManager().getInputsTablesView();
    int sizeOutputsView = inputsTablesView.size();
    Control lastChild = null;
    if (sizeOutputsView - 1 >= 0) {
        lastChild = inputsTablesView.get(sizeOutputsView - 1);
    }
    String alias = aliasDialog.getAlias();
    //$NON-NLS-1$
    boolean isPhysicalTable = alias.equals("") || alias.equalsIgnoreCase(aliasDialog.getTableName());
    String aliasOrTableName = isPhysicalTable ? aliasDialog.getTableName() : alias;
    IMetadataTable metadataTable = isPhysicalTable ? connectionFound.getTable() : connectionFound.getTable().clone();
    boolean isInvisiblePhysicalTable = aliasDialog.isSameAsPhysicalTable(aliasOrTableName) && !aliasDialog.isSameAsVisibleTableName(aliasOrTableName);
    InputTable inputTable = new InputTable(this, metadataTable, aliasOrTableName);
    if (isInvisiblePhysicalTable) {
        inputTable.setAlias(null);
    } else {
        inputTable.setAlias(aliasOrTableName);
    }
    inputTable.setTableName(aliasDialog.getTableName());
    inputTable.initFromExternalData(null);
    TablesZoneView tablesZoneViewInputs = uiManager.getTablesZoneViewInputs();
    DataMapTableView dataMapTableView = uiManager.createNewInputTableView(lastChild, inputTable, tablesZoneViewInputs);
    tablesZoneViewInputs.setSize(tablesZoneViewInputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    tablesZoneViewInputs.layout(true, true);
    uiManager.moveInputScrollBarZoneToMax();
    uiManager.refreshBackground(true, false);
    tablesZoneViewInputs.layout();
    uiManager.selectDataMapTableView(dataMapTableView, true, false);
    uiManager.updateDropDownJoinTypeForInputs();
    uiManager.parseAllExpressionsForAllTables();
    uiManager.refreshSqlExpression();
    getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) InputTable(org.talend.designer.dbmap.model.table.InputTable) Control(org.eclipse.swt.widgets.Control) AliasDialog(org.talend.designer.dbmap.ui.dialog.AliasDialog) IOConnection(org.talend.designer.dbmap.external.connection.IOConnection) InputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) TablesZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView)

Aggregations

TablesZoneView (org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView)6 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)5 InputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView)3 OutputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)3 Control (org.eclipse.swt.widgets.Control)2 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)2 Point (org.eclipse.swt.graphics.Point)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Display (org.eclipse.swt.widgets.Display)1 Event (org.eclipse.swt.widgets.Event)1 Layout (org.eclipse.swt.widgets.Layout)1 Listener (org.eclipse.swt.widgets.Listener)1 ScrollBar (org.eclipse.swt.widgets.ScrollBar)1 MetadataTable (org.talend.core.model.metadata.MetadataTable)1 IProcess (org.talend.core.model.process.IProcess)1 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)1 IOConnection (org.talend.designer.dbmap.external.connection.IOConnection)1 UIManager (org.talend.designer.dbmap.managers.UIManager)1