Search in sources :

Example 6 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class MapperUI method selectFirstInOutTablesView.

private void selectFirstInOutTablesView() {
    UIManager uiManager = mapperManager.getUiManager();
    List<DataMapTableView> inputsTablesView = uiManager.getInputsTablesView();
    if (inputsTablesView.size() > 0) {
        uiManager.selectDataMapTableView(inputsTablesView.get(0), true, false);
    }
    List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
    if (outputsTablesView.size() > 0) {
        uiManager.selectDataMapTableView(outputsTablesView.get(0), true, false);
    }
}
Also used : UIManager(org.talend.designer.dbmap.managers.UIManager) 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)

Example 7 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class CompleteDropTargetListener method dragOver.

@Override
public void dragOver(DropTargetEvent event) {
    super.dragOver(event);
    UIManager uiManager = getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    // System.out.println("\n>>dragOver");
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    fillEvent(event, analyzer);
    InsertionIndicator insertionIndicator = retrieveInsertionIndicator();
    if (analyzer.isDropValid()) {
        draggingInfosPopup.setOutputToOutputMode(analyzer.isOutputToOutput());
        if (analyzer.isInputToInput()) {
            draggingInfosPopup.setExpressionContext(true);
            draggingInfosPopup.setInsertionEntryContext(false);
        } else if (analyzer.isCursorOverExpressionCell()) {
            draggingInfosPopup.setExpressionContext(true);
        } else if (analyzer.targetTableIsFiltersTable()) {
            draggingInfosPopup.setExpressionContext(true);
        } else {
            draggingInfosPopup.setExpressionContext(false);
        }
        draggingInfosPopup.setMapOneToOneMode(analyzer.isMapOneToOneMode(), analyzer.isMapOneToOneAuthorized());
        Point cursorPosition = new Point(event.x, event.y);
        Integer itemIndexWhereInsertFromPosition = getItemIndexFromPosition(cursorPosition);
        if (analyzer.isMapOneToOneMode() && analyzer.isMapOneToOneAuthorized()) {
            int size = draggedData.getTransferableEntryList().size();
            if (itemIndexWhereInsertFromPosition != null) {
                draggableTable.setSelection(itemIndexWhereInsertFromPosition, itemIndexWhereInsertFromPosition + size - 1);
                if (!analyzer.targetTableIsFiltersTable() && itemIndexWhereInsertFromPosition + size - 1 >= draggableTable.getItemCount()) {
                    insertionIndicator.updatePosition(draggableTable, draggableTable.getItemCount());
                    insertionIndicator.setVisible(true);
                    draggingInfosPopup.setInsertionEntryContext(true);
                } else {
                    insertionIndicator.setVisible(false);
                    draggingInfosPopup.setInsertionEntryContext(false);
                }
            } else {
                draggableTable.deselectAll();
                insertionIndicator.setVisible(false);
                draggingInfosPopup.setInsertionEntryContext(false);
            }
        } else {
            if (!analyzer.isTableSourceAndTargetAreSame()) {
                draggableTable.deselectAll();
            }
            if (itemIndexWhereInsertFromPosition != null && !analyzer.isInsertionEntryMode()) {
                draggableTable.setSelection(itemIndexWhereInsertFromPosition);
            }
            if (!analyzer.targetTableIsFiltersTable()) {
                updateInsertionIndicator(event);
                insertionIndicator.setVisible(analyzer.isInsertionEntryMode());
            }
            draggingInfosPopup.setInsertionEntryContext(analyzer.isInsertionEntryMode());
        }
        draggingInfosPopup.setDropInvalid(false, false);
    } else {
        draggingInfosPopup.setMapOneToOneMode(false, false);
        draggingInfosPopup.setExpressionContext(false);
        draggingInfosPopup.setInsertionEntryContext(false);
        draggingInfosPopup.setDropInvalid(true, analyzer.isInvalidKeyPressed());
    }
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) UIManager(org.talend.designer.dbmap.managers.UIManager) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point)

Example 8 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class DataMapTableView method addListeners.

/**
     * DOC amaumont Comment method "addListeners".
     */
protected void addListeners() {
    final UIManager uiManager = mapperManager.getUiManager();
    MouseTrackListener mouseTracker = new MouseTrackListener() {

        @Override
        public void mouseEnter(MouseEvent e) {
        }

        @Override
        public void mouseExit(MouseEvent e) {
            setDefaultCursor();
            resizeHelper.stopDrag();
        }

        @Override
        public void mouseHover(MouseEvent e) {
        }
    };
    this.addMouseTrackListener(mouseTracker);
    SelectionListener scrollListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            uiManager.refreshBackground(true, false);
        }
    };
    tableForEntries.getVerticalBar().addSelectionListener(scrollListener);
    // /////////////////////////////////////////////////////////////////
    addManualTableResizeListeners(uiManager);
    // /////////////////////////////////////////////////////////////////
    // /////////////////////////////////////////////////////////////////
    Listener onSelectDataMapTableViewListener = new Listener() {

        @Override
        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.MouseDown:
                    onSelectDataMapTableView();
                    break;
                default:
            }
        }
    };
    this.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
    headerComposite.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
    nameLabel.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
    // /////////////////////////////////////////////////////////////////
    // /////////////////////////////////////////////////////////////////
    minimizeButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // TODO Auto-generated method stub
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            minimizeTable(!abstractDataMapTable.isMinimized());
        }
    });
    // /////////////////////////////////////////////////////////////////
    initShowMessageErrorListener(tableForEntries);
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionListener(org.eclipse.swt.events.SelectionListener) ControlListener(org.eclipse.swt.events.ControlListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) DisposeListener(org.eclipse.swt.events.DisposeListener) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) MouseListener(org.eclipse.swt.events.MouseListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IListenableListListener(org.talend.commons.utils.data.list.IListenableListListener) FocusListener(org.eclipse.swt.events.FocusListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) KeyListener(org.eclipse.swt.events.KeyListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) UIManager(org.talend.designer.dbmap.managers.UIManager) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ListenableListEvent(org.talend.commons.utils.data.list.ListenableListEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener)

Example 9 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class DataMapTableView method onSelectedEntries.

public void onSelectedEntries(ISelection selection, int[] selectionIndices) {
    if (executeSelectionEvent) {
        UIManager uiManager = mapperManager.getUiManager();
        uiManager.selectLinks(DataMapTableView.this, uiManager.extractSelectedTableEntries(selection), false, false);
        uiManager.selectLinkedMetadataEditorEntries(this, selectionIndices);
    }
}
Also used : UIManager(org.talend.designer.dbmap.managers.UIManager)

Example 10 with UIManager

use of org.talend.designer.dbmap.managers.UIManager 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)

Aggregations

UIManager (org.talend.designer.dbmap.managers.UIManager)15 AbstractUIManager (org.talend.designer.abstractmap.managers.AbstractUIManager)6 Point (org.eclipse.swt.graphics.Point)5 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)5 DraggedData (org.talend.designer.abstractmap.ui.dnd.DraggedData)4 DraggingInfosPopup (org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup)4 FormData (org.eclipse.swt.layout.FormData)3 Event (org.eclipse.swt.widgets.Event)3 Listener (org.eclipse.swt.widgets.Listener)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 Rectangle (org.eclipse.swt.graphics.Rectangle)2 FormLayout (org.eclipse.swt.layout.FormLayout)2 GridData (org.eclipse.swt.layout.GridData)2 Display (org.eclipse.swt.widgets.Display)2 InputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView)2 OutputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)2 ArrayList (java.util.ArrayList)1 IInputValidator (org.eclipse.jface.dialogs.IInputValidator)1 ICellEditorListener (org.eclipse.jface.viewers.ICellEditorListener)1