Search in sources :

Example 1 with TablesZoneView

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

the class MapperManager method addOutput.

/**
     * DOC amaumont Comment method "addOutput".
     */
public void addOutput() {
    String tableName = uiManager.openNewOutputCreationDialog();
    if (tableName == null) {
        return;
    }
    IProcess process = mapperComponent.getProcess();
    //$NON-NLS-1$
    String uniqueName = process.generateUniqueConnectionName("table");
    process.addUniqueConnectionName(uniqueName);
    MetadataTable metadataTable = new MetadataTable();
    metadataTable.setTableName(uniqueName);
    // metadataTable.setId(uniqueName);
    metadataTable.setLabel(tableName);
    List<DataMapTableView> outputsTablesView = getUiManager().getOutputsTablesView();
    int sizeOutputsView = outputsTablesView.size();
    Control lastChild = null;
    if (sizeOutputsView - 1 >= 0) {
        lastChild = outputsTablesView.get(sizeOutputsView - 1);
    }
    IDataMapTable abstractDataMapTable = new OutputTable(this, metadataTable, uniqueName, tableName);
    TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
    DataMapTableView dataMapTableView = uiManager.createNewOutputTableView(lastChild, abstractDataMapTable, tablesZoneViewOutputs);
    tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    tablesZoneViewOutputs.layout();
    uiManager.moveOutputScrollBarZoneToMax();
    uiManager.refreshBackground(true, false);
    tablesZoneViewOutputs.layout();
    uiManager.selectDataMapTableView(dataMapTableView, true, false);
}
Also used : Control(org.eclipse.swt.widgets.Control) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) 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) IProcess(org.talend.core.model.process.IProcess) OutputTable(org.talend.designer.dbmap.model.table.OutputTable)

Example 2 with TablesZoneView

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

the class CompleteDropTargetListener method retrieveInsertionIndicator.

private InsertionIndicator retrieveInsertionIndicator() {
    DataMapTableView dataMapTableViewTarget = getMapperManager().retrieveDataMapTableView(draggableTable);
    TablesZoneView targetTablesZoneView = getUiManager().getTablesZoneView(dataMapTableViewTarget);
    InsertionIndicator insertionIndicator = targetTablesZoneView.getInsertionIndicator();
    return insertionIndicator;
}
Also used : DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) TablesZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView)

Example 3 with TablesZoneView

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

the class UIManager method minimizeAllTables.

public void minimizeAllTables(Zone zone, boolean minimize, ToolItem minimizeButton) {
    List<DataMapTableView> tablesView = null;
    TablesZoneView tablesZoneView = null;
    if (zone == Zone.INPUTS) {
        tablesView = getInputsTablesView();
        tablesZoneView = getTablesZoneViewInputs();
    } else if (zone == Zone.OUTPUTS) {
        tablesZoneView = getTablesZoneViewOutputs();
        tablesView = getOutputsTablesView();
    } else {
        //$NON-NLS-1$
        throw new RuntimeException("Case not found:" + zone);
    }
    Layout layout = tablesZoneView.getLayout();
    try {
        tablesZoneView.setLayout(null);
        for (DataMapTableView view : tablesView) {
            view.minimizeTable(minimize);
        }
    } catch (RuntimeException e) {
        ExceptionHandler.process(e);
    } finally {
        tablesZoneView.setLayout(layout);
    }
    tablesZoneView.layout();
    for (DataMapTableView view : tablesView) {
        view.layout();
    }
    resizeTablesZoneViewAtComputedSize(zone);
    moveScrollBarZoneAtSelectedTable(zone);
}
Also used : Layout(org.eclipse.swt.widgets.Layout) 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)

Example 4 with TablesZoneView

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

the class InsertionIndicator method updatePosition.

/**
     * Update position of the indicator at top of <code>itemIndexTarget</code> position of the
     * <code>draggableTable</code>.
     * 
     * @param currentTable
     * @param itemIndexTarget
     */
public void updatePosition(Table currentTable, int itemIndexTarget) {
    // System.out.println(itemIndexTarget);
    this.draggableTable = currentTable;
    removeTablePaintListener();
    if (tablePaintListener == null) {
        tablePaintListener = new Listener() {

            public void handleEvent(Event event) {
                drawIndicatorLineInTable(event);
            }
        };
    }
    FormLayout formLayout = tablesZoneViewParent.getLayout();
    UIManager uiManager = mapperManager.getUiManager();
    TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
    Display display = tablesZoneViewOutputs.getDisplay();
    Point tablePositionRefZone = display.map(currentTable, tablesZoneViewParent, new Point(0, 0));
    FormData formDataLeftArrow = (FormData) leftArrowDraggingIndicator.getLayoutData();
    FormData formDataRightArrow = (FormData) rightArrowDraggingIndicator.getLayoutData();
    ScrollBar verticalBar = currentTable.getVerticalBar();
    int offsetVerticalBar = -verticalBar.getSelection() * currentTable.getItemHeight();
    int indicYPositionRefZone = 0;
    if (WindowSystem.isGTK()) {
        if (itemIndexTarget == 0) {
            indicYPositionRefTable = 0 + offsetVerticalBar;
        } else {
            indicYPositionRefTable = itemIndexTarget * (currentTable.getItemHeight() + 2) + offsetVerticalBar;
        }
        indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2;
        indicYPositionRefZone -= currentTable.getItemHeight() + 1;
    } else {
        if (itemIndexTarget == 0) {
            indicYPositionRefTable = 0 + offsetVerticalBar;
        } else {
            indicYPositionRefTable = itemIndexTarget * currentTable.getItemHeight() - 1 + offsetVerticalBar;
        }
        indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2 + 4;
    }
    DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentTable);
    Rectangle boundsTableView = dataMapTableView.getBounds();
    int testValue = boundsTableView.y + boundsTableView.height - formLayout.marginTop - HEIGHT_INDICATOR / 2 - 5;
    if (indicYPositionRefZone > testValue) {
        indicYPositionRefZone = testValue;
    }
    currentTable.addListener(SWT.Paint, tablePaintListener);
    if (lastIndicYPositionRefZone != indicYPositionRefZone) {
        formDataLeftArrow.top.offset = indicYPositionRefZone;
        formDataRightArrow.top.offset = indicYPositionRefZone;
        formDataRightArrow.left.offset = currentTable.getSize().x + 2;
        currentTable.redraw();
        tablesZoneViewParent.layout();
    }
    lastIndicYPositionRefZone = indicYPositionRefZone;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Listener(org.eclipse.swt.widgets.Listener) Rectangle(org.eclipse.swt.graphics.Rectangle) Event(org.eclipse.swt.widgets.Event) UIManager(org.talend.designer.dbmap.managers.UIManager) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) Point(org.eclipse.swt.graphics.Point) TablesZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView) ScrollBar(org.eclipse.swt.widgets.ScrollBar) Point(org.eclipse.swt.graphics.Point) Display(org.eclipse.swt.widgets.Display)

Example 5 with TablesZoneView

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

the class UIManager method resizeTablesZoneViewAtComputedSize.

/**
     * recalculate parent size don't hide DataMapTableView when resized.
     */
public void resizeTablesZoneViewAtComputedSize(Zone zone) {
    TablesZoneView tablesZoneView = null;
    if (zone == Zone.INPUTS) {
        tablesZoneView = getTablesZoneViewInputs();
    } else if (zone == Zone.OUTPUTS) {
        tablesZoneView = getTablesZoneViewOutputs();
    }
    tablesZoneView.setSize(tablesZoneView.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
Also used : 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