Search in sources :

Example 6 with DraggedData

use of org.talend.designer.abstractmap.ui.dnd.DraggedData in project tdi-studio-se by Talend.

the class CompleteDropTargetTableListener method dragOver.

@Override
public void dragOver(DropTargetEvent event) {
    super.dragOver(event);
    AbstractUIManager uiManager = mapperManager.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() && !analyzer.isInsertionEntryMode()) {
            draggingInfosPopup.setExpressionContext(true);
            draggingInfosPopup.setInsertionEntryContext(false);
        } else if (analyzer.isCursorOverExpressionCell()) {
            draggingInfosPopup.setExpressionContext(true);
        } else if (analyzer.targetIsExpressionFilterText() || 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) {
                draggableTargetControl.setSelection(itemIndexWhereInsertFromPosition, itemIndexWhereInsertFromPosition + size - 1);
                if (!analyzer.targetIsExpressionFilterText() && !analyzer.targetTableIsFiltersTable() && itemIndexWhereInsertFromPosition + size - 1 >= draggableTargetControl.getItemCount()) {
                    insertionIndicator.updatePosition(draggableTargetControl, draggableTargetControl.getItemCount());
                    insertionIndicator.setVisible(true);
                    draggingInfosPopup.setInsertionEntryContext(true);
                } else {
                    insertionIndicator.setVisible(false);
                    draggingInfosPopup.setInsertionEntryContext(false);
                }
            } else {
                draggableTargetControl.deselectAll();
                insertionIndicator.setVisible(false);
                draggingInfosPopup.setInsertionEntryContext(false);
            }
        } else {
            if (!analyzer.isTableSourceAndTargetAreSame()) {
                draggableTargetControl.deselectAll();
            }
            if (itemIndexWhereInsertFromPosition != null && !analyzer.isInsertionEntryMode()) {
                draggableTargetControl.setSelection(itemIndexWhereInsertFromPosition);
            }
            if (!analyzer.targetIsExpressionFilterText() && !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) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData) Point(org.eclipse.swt.graphics.Point) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) Point(org.eclipse.swt.graphics.Point)

Example 7 with DraggedData

use of org.talend.designer.abstractmap.ui.dnd.DraggedData in project tdi-studio-se by Talend.

the class CompleteDropTargetTableListener method dragLeave.

@Override
public void dragLeave(DropTargetEvent event) {
    // System.out.println("\n>>dragLeave");
    // System.out.println(event);
    super.dragLeave(event);
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    UIManager uiManager = getUiManager();
    if (!analyzer.isTableSourceAndTargetAreSame()) {
        draggableTargetControl.deselectAll();
    }
    retrieveInsertionIndicator().setVisible(false);
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    draggingInfosPopup.setExpressionContext(false);
    draggingInfosPopup.setInsertionEntryContext(false);
    uiManager.setDragging(false);
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) UIManager(org.talend.designer.mapper.managers.UIManager) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData)

Example 8 with DraggedData

use of org.talend.designer.abstractmap.ui.dnd.DraggedData in project tdi-studio-se by Talend.

the class CompleteDropTargetTableListener method dragOperationChanged.

@Override
public void dragOperationChanged(DropTargetEvent event) {
    // System.out.println("\n>>dragOperationChanged");
    // showInfos(event);
    // super.dragOperationChanged(event);
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    detectPressedKeys(event);
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    configurePopupInfos(analyzer);
    UIManager uiManager = getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    draggingInfosPopup.updateVisibleLabels();
    fillEvent(event, analyzer);
    mapperManager.getUiManager().setCurrentDragDetail(event.detail);
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) UIManager(org.talend.designer.mapper.managers.UIManager) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData)

Example 9 with DraggedData

use of org.talend.designer.abstractmap.ui.dnd.DraggedData in project tdi-studio-se by Talend.

the class CompleteDropTargetStyledTextListener method dragOver.

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);
    if (analyzer.isDropValid()) {
        draggingInfosPopup.setExpressionContext(true);
    } 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) UIManager(org.talend.designer.mapper.managers.UIManager) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData)

Example 10 with DraggedData

use of org.talend.designer.abstractmap.ui.dnd.DraggedData in project tdi-studio-se by Talend.

the class CompleteDropTargetStyledTextListener method dragOperationChanged.

public void dragOperationChanged(DropTargetEvent event) {
    // System.out.println("\n>>dragOperationChanged");
    // showInfos(event);
    // super.dragOperationChanged(event);
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    detectPressedKeys(event);
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    configurePopupInfos(analyzer);
    UIManager uiManager = getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    draggingInfosPopup.updateVisibleLabels();
    fillEvent(event, analyzer);
    getUiManager().setCurrentDragDetail(event.detail);
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) UIManager(org.talend.designer.mapper.managers.UIManager) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData)

Aggregations

DraggedData (org.talend.designer.abstractmap.ui.dnd.DraggedData)11 AbstractUIManager (org.talend.designer.abstractmap.managers.AbstractUIManager)8 DraggingInfosPopup (org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup)8 UIManager (org.talend.designer.mapper.managers.UIManager)6 Point (org.eclipse.swt.graphics.Point)4 UIManager (org.talend.designer.dbmap.managers.UIManager)4 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)3 TransferableEntry (org.talend.designer.abstractmap.ui.dnd.TransferableEntry)3 ArrayList (java.util.ArrayList)2 ISelection (org.eclipse.jface.viewers.ISelection)2 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)2 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)2 MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)2 ILanguage (org.talend.designer.mapper.language.ILanguage)2 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)2 Zone (org.talend.designer.mapper.ui.visualmap.zone.Zone)2 IDbLanguage (org.talend.designer.dbmap.language.IDbLanguage)1 TableEntryLocation (org.talend.designer.dbmap.model.tableentry.TableEntryLocation)1 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)1 Zone (org.talend.designer.dbmap.ui.visualmap.zone.Zone)1