Search in sources :

Example 11 with OutputTable

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

the class SearchZoneMapper method moveScrollBarZoneAtSelectedTableItem.

public void moveScrollBarZoneAtSelectedTableItem(ITableEntry entry) {
    if (entry != null) {
        DataMapTableView dataMapTableView = mapperManager.retrieveIDataMapTableView(entry.getParent());
        Rectangle tableViewBounds = dataMapTableView.getBounds();
        IDataMapTable table = entry.getParent();
        TableItem tableItem = mapperManager.retrieveTableItem(entry);
        if (table != null && tableItem != null) {
            Rectangle tableItemBounds = tableItem.getBounds();
            int selection = tableViewBounds.y + tableItemBounds.y;
            ScrolledComposite scrollComposite = null;
            if (table instanceof InputTable) {
                scrollComposite = uiManager.getScrolledCompositeViewInputs();
            } else if (table instanceof OutputTable) {
                scrollComposite = uiManager.getScrolledCompositeViewOutputs();
            }
            if (scrollComposite != null) {
                setPositionOfVerticalScrollBarZone(scrollComposite, selection);
            }
        }
    }
}
Also used : InputTable(org.talend.designer.dbmap.model.table.InputTable) TableItem(org.eclipse.swt.widgets.TableItem) Rectangle(org.eclipse.swt.graphics.Rectangle) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) OutputTable(org.talend.designer.dbmap.model.table.OutputTable)

Example 12 with OutputTable

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

the class UIManager method removeOutputTableView.

/**
     * Call mapperManager.removeSelectedOutput() to remove a table view.
     * 
     * @param dataMapTableViewToRemove
     */
public void removeOutputTableView(OutputDataMapTableView dataMapTableViewToRemove) {
    List<DataMapTableView> outputsTablesView = getOutputsTablesView();
    int sizeList = outputsTablesView.size();
    for (int i = 0; i < sizeList; i++) {
        Control control = outputsTablesView.get(i);
        if (control == dataMapTableViewToRemove && i < sizeList - 1 && i > 0) {
            FormData formData = (FormData) outputsTablesView.get(i + 1).getLayoutData();
            formData.top = new FormAttachment(outputsTablesView.get(i - 1));
            break;
        }
    }
    mapperManager.removeTablePair(dataMapTableViewToRemove);
    MetadataTableEditorView outputMetaEditorView = getOutputMetaEditorView();
    OutputTable outputTable = (OutputTable) dataMapTableViewToRemove.getDataMapTable();
    if (outputMetaEditorView.getMetadataTableEditor().getMetadataTable() == outputTable.getMetadataTable()) {
        getOutputMetaEditorView().setMetadataTableEditor(null);
    }
    dataMapTableViewToRemove.dispose();
    dataMapTableViewToRemove = null;
    getTablesZoneViewOutputs().layout();
    refreshBackground(true, false);
    setCurrentSelectedOutputTableView(null);
}
Also used : FormData(org.eclipse.swt.layout.FormData) Control(org.eclipse.swt.widgets.Control) 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) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView) AbstractMetadataTableEditorView(org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView) Point(org.eclipse.swt.graphics.Point) FormAttachment(org.eclipse.swt.layout.FormAttachment) OutputTable(org.talend.designer.dbmap.model.table.OutputTable)

Example 13 with OutputTable

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

the class DropContextAnalyzer method checkDropIsValid.

/**
     * DOC amaumont Comment method "checkDropHasValidTarget".
     */
private boolean checkDropIsValid() {
    isInputToInput = false;
    mapOneToOneAuthorized = true;
    if (targetTableIsFiltersTable() || draggedData.getTransferableEntryList().size() <= 1) {
        mapOneToOneAuthorized = false;
    }
    if (invalidKeyPressed) {
        return false;
    }
    /*
         * INPUT => INPUT
         */
    if (zoneSource == Zone.INPUTS && zoneTarget == Zone.INPUTS) {
        isInputToInput = true;
        mapOneToOneAuthorized = false;
        List<InputTable> inputTables = mapperManager.getInputTables();
        int indexSourceInputTable = inputTables.indexOf(dataMapTableViewSource.getDataMapTable());
        int indexTargetInputTable = inputTables.indexOf(dataMapTableViewTarget.getDataMapTable());
        if (indexSourceInputTable == indexTargetInputTable) {
            return false;
        } else {
            return true;
        }
    }
    /*
         * OUTPUT => OUTPUT
         */
    if (zoneSource == Zone.OUTPUTS && zoneTarget == Zone.OUTPUTS) {
        isOutputToOutput = true;
        mapOneToOneAuthorized = true;
        List<OutputTable> outputTables = mapperManager.getOutputTables();
        int indexSourceOutputTable = outputTables.indexOf(dataMapTableViewSource.getDataMapTable());
        int indexTargetOutputTable = outputTables.indexOf(dataMapTableViewTarget.getDataMapTable());
        if (indexSourceOutputTable == indexTargetOutputTable) {
            return false;
        } else {
            return true;
        }
    }
    TableItem tableItemTarget = getTableItemFromPosition(new Point(event.x, event.y));
    if (zoneSource == Zone.OUTPUTS && zoneTarget == Zone.INPUTS) {
        /*
             * OUTPUT => OUTPUT OUTPUT => INPUT
             */
        return false;
    }
    return true;
}
Also used : InputTable(org.talend.designer.dbmap.model.table.InputTable) TableItem(org.eclipse.swt.widgets.TableItem) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) OutputTable(org.talend.designer.dbmap.model.table.OutputTable)

Example 14 with OutputTable

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

the class MapperUI method createOutputZoneWithTables.

private void createOutputZoneWithTables(MapperModel mapperModel, final UIManager uiManager, final Display display) {
    Control previousControl;
    outputsZone = new OutputsZone(datasFlowViewSashForm, SWT.NONE, mapperManager);
    outputsZone.createHeaderZoneComponents();
    // this.dropTargetOperationListener.addControl(outputsZone);
    sc3 = new ScrolledComposite(outputsZone, getBorder() | SWT.H_SCROLL | SWT.V_SCROLL);
    // this.dropTargetOperationListener.addControl(sc3);
    GridData sc3GridData = new GridData(GridData.FILL_BOTH);
    sc3.setLayoutData(sc3GridData);
    sc3.setBackgroundMode(SWT.INHERIT_DEFAULT);
    sc3.addControlListener(new ControlListener() {

        public void controlMoved(ControlEvent e) {
        // System.out.println("sc3 controlMoved");
        }

        public void controlResized(ControlEvent e) {
            // System.out.println("sc3 controlResized");
            onSashResized(display);
        }
    });
    outputTablesZoneView = new OutputTablesZoneView(sc3, getBorder(), mapperManager);
    // this.dropTargetOperationListener.addControl(outputTablesZoneView);
    outputTablesZoneView.setBackgroundMode(SWT.INHERIT_DEFAULT);
    sc3.setExpandHorizontal(true);
    sc3.setContent(outputTablesZoneView);
    sc3MSListener = new MouseScrolledListener(mapperManager.getUiManager(), sc3);
    outputTablesZoneView.initInsertionIndicator();
    previousControl = null;
    List<OutputTable> tables = mapperModel.getOutputDataMapTables();
    Boolean minimizeStateOfTables = getMinimizedButtonState(tables);
    if (minimizeStateOfTables != null) {
        outputsZone.getToolbar().setMinimizeButtonState(minimizeStateOfTables.booleanValue());
    }
    for (IDataMapTable abstractDataMapTable : tables) {
        OutputDataMapTableView dataMapTableView = uiManager.createNewOutputTableView(previousControl, abstractDataMapTable, outputTablesZoneView);
        previousControl = dataMapTableView;
    }
    outputTablesZoneView.setSize(outputTablesZoneView.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
Also used : IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) OutputsZone(org.talend.designer.dbmap.ui.visualmap.zone.OutputsZone) OutputTablesZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.OutputTablesZoneView) MouseScrolledListener(org.talend.designer.abstractmap.ui.listener.MouseScrolledListener) OutputTable(org.talend.designer.dbmap.model.table.OutputTable) Control(org.eclipse.swt.widgets.Control) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlListener(org.eclipse.swt.events.ControlListener) ControlEvent(org.eclipse.swt.events.ControlEvent) OutputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)

Example 15 with OutputTable

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

the class AutoMapper method map.

/**
     * DOC amaumont Comment method "map".
     */
public void map() {
    List<InputTable> inputTables = mapperManager.getInputTables();
    List<OutputTable> outputTables = mapperManager.getOutputTables();
    IDbLanguage currentLanguage = mapperManager.getCurrentLanguage();
    HashMap<String, InputTable> nameToInputTable = new HashMap<String, InputTable>(inputTables.size());
    for (InputTable inputTable : inputTables) {
        nameToInputTable.put(inputTable.getName(), inputTable);
    }
    // output tables are the references
    for (OutputTable outputTable : outputTables) {
        List<IColumnEntry> outputEntries = outputTable.getColumnEntries();
        boolean mapFound = false;
        for (IColumnEntry outputEntry : outputEntries) {
            mapFound = false;
            if (mapperManager.checkEntryHasEmptyExpression(outputEntry)) {
                String outputColumnName = outputEntry.getName();
                for (InputTable inputTable : inputTables) {
                    List<IColumnEntry> inputColumnEntries = inputTable.getColumnEntries();
                    for (IColumnEntry inputEntry : inputColumnEntries) {
                        if (inputEntry.getName().equalsIgnoreCase(outputColumnName)) {
                            outputEntry.setExpression(currentLanguage.getLocation(inputTable.getName(), inputEntry.getName()));
                            mapFound = true;
                            break;
                        }
                    }
                    if (mapFound) {
                        break;
                    }
                }
            }
        }
        DataMapTableView view = mapperManager.retrieveIDataMapTableView(outputTable);
        view.getTableViewerCreatorForColumns().getTableViewer().refresh();
    }
    mapperManager.getProblemsManager().checkProblems();
    List<DataMapTableView> outputsTablesView = mapperManager.getUiManager().getOutputsTablesView();
    for (DataMapTableView view : outputsTablesView) {
        mapperManager.getUiManager().parseAllExpressions(view, true);
        mapperManager.getProblemsManager().checkProblemsForAllEntries(view, true);
    }
    mapperManager.getUiManager().refreshBackground(true, false);
}
Also used : HashMap(java.util.HashMap) IDbLanguage(org.talend.designer.dbmap.language.IDbLanguage) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) OutputTable(org.talend.designer.dbmap.model.table.OutputTable) InputTable(org.talend.designer.dbmap.model.table.InputTable)

Aggregations

OutputTable (org.talend.designer.dbmap.model.table.OutputTable)18 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)9 FilterTableEntry (org.talend.designer.dbmap.model.tableentry.FilterTableEntry)8 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)7 InputTable (org.talend.designer.dbmap.model.table.InputTable)7 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)6 OutputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)5 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Control (org.eclipse.swt.widgets.Control)3 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)3 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)3 IOConnection (org.talend.designer.dbmap.external.connection.IOConnection)3 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 ControlEvent (org.eclipse.swt.events.ControlEvent)2 ControlListener (org.eclipse.swt.events.ControlListener)2 Point (org.eclipse.swt.graphics.Point)2 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)2 IProcess (org.talend.core.model.process.IProcess)2 InputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView)2