use of org.talend.designer.abstractmap.managers.AbstractUIManager in project tdi-studio-se by Talend.
the class DefaultDropTargetListener method dragOperationChanged.
public void dragOperationChanged(DropTargetEvent event) {
updatePopupPosition(event);
detectPressedKeys(event);
AbstractUIManager uiManager = mapperManager.getUiManager();
DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
if (uiManager.isCtrlPressed()) {
draggingInfosPopup.setOverwriteMode(true);
} else {
draggingInfosPopup.setOverwriteMode(false);
}
if (uiManager.isShiftPressed()) {
draggingInfosPopup.setMapOneToOneMode(true, true);
} else {
draggingInfosPopup.setMapOneToOneMode(false, true);
}
int detail = DND.DROP_NONE;
if (uiManager.isCtrlPressed() && uiManager.isShiftPressed()) {
detail |= DND.DROP_COPY;
} else if (uiManager.isCtrlPressed()) {
detail |= DND.DROP_LINK;
} else if (uiManager.isShiftPressed()) {
detail |= DND.DROP_COPY;
} else {
detail |= DND.DROP_COPY;
}
uiManager.setCurrentDragDetail(detail);
event.detail = DND.DROP_NONE;
}
use of org.talend.designer.abstractmap.managers.AbstractUIManager in project tdi-studio-se by Talend.
the class DefaultDropTargetListener method updatePopupPosition.
private void updatePopupPosition(DropTargetEvent event) {
Point cursorPosition = new Point(event.x, event.y);
if (!cursorPosition.equals(lastCursorPosition)) {
AbstractUIManager uiManager = mapperManager.getUiManager();
DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
draggingInfosPopup.setCursorPosition(event.x, event.y);
}
// System.out.println("updatePopupPosition:" + lastCursorPosition + "-->" + cursorPosition);
lastCursorPosition = cursorPosition;
}
use of org.talend.designer.abstractmap.managers.AbstractUIManager in project tdi-studio-se by Talend.
the class CompleteDropTargetTableListener method updateInsertionIndicator.
/**
*
* DOC amaumont Comment method "updateInsertionIndicator".
*
* @param event
* @return true if droppable
*/
private void updateInsertionIndicator(DropTargetEvent event) {
AbstractUIManager uiManager = mapperManager.getUiManager();
DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
// ////////////////////////////////
// to resolve graphical bug between popupInfos and InsertionIndicator
InsertionIndicator insertionIndicator = retrieveInsertionIndicator();
Rectangle popupBounds = draggingInfosPopup.getBounds();
Point positionPopupFromMapperShellOrigin = draggingInfosPopup.getPositionFromMapperShellOrigin();
Rectangle boundsPopupFromMapperShellOrigin = new Rectangle(positionPopupFromMapperShellOrigin.x, positionPopupFromMapperShellOrigin.y, popupBounds.width, popupBounds.height);
boolean intersect = insertionIndicator.isLeftArrowMustBeRefreshed(boundsPopupFromMapperShellOrigin);
Point eventPosition = new Point(event.x, event.y);
// int itemIndexTarget = getItemIndexWhereInsertFromPosition(eventPosition);
int itemIndexTarget = TableUtils.getItemIndexWhereInsertFromPosition(draggableTargetControl, eventPosition);
insertionIndicator.updatePosition(draggableTargetControl, itemIndexTarget);
if (WindowSystem.isGTK()) {
if (insertionIndicator.isRightArrowVisible() && !eventPosition.equals(lastDragPosition)) {
insertionIndicator.setRightArrowVisible(false);
insertionIndicator.setLefArrowVisible(false);
} else {
insertionIndicator.setRightArrowVisible(insertionIndicator.isVisible());
insertionIndicator.setLefArrowVisible(insertionIndicator.isVisible());
}
} else {
if (isIntersectAtPreviousDragOver || intersect) {
insertionIndicator.setLefArrowVisible(false);
isIntersectAtPreviousDragOver = false;
} else {
insertionIndicator.setLefArrowVisible(insertionIndicator.isVisible());
}
}
isIntersectAtPreviousDragOver = intersect;
lastDragPosition = eventPosition;
}
use of org.talend.designer.abstractmap.managers.AbstractUIManager in project tdi-studio-se by Talend.
the class CompleteDropTargetListener method configurePopupInfos.
private void configurePopupInfos(DropContextAnalyzer analyzer) {
AbstractUIManager uiManager = getUiManager();
DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
if (analyzer.isDropValid()) {
draggingInfosPopup.setOutputToOutputMode(analyzer.isOutputToOutput());
if (uiManager.isCtrlPressed()) {
draggingInfosPopup.setOverwriteMode(true);
} else {
draggingInfosPopup.setOverwriteMode(false);
}
if (uiManager.isShiftPressed() && analyzer.isMapOneToOneAuthorized()) {
draggingInfosPopup.setMapOneToOneMode(true, true);
} else {
draggingInfosPopup.setMapOneToOneMode(false, analyzer.isMapOneToOneAuthorized());
}
if (analyzer.isInputToInput()) {
draggingInfosPopup.setExpressionContext(true);
draggingInfosPopup.setInsertionEntryContext(false);
} else if (analyzer.isCursorOverExpressionCell()) {
draggingInfosPopup.setExpressionContext(true);
draggingInfosPopup.setInsertionEntryContext(analyzer.isInsertionEntryMode());
} else if (analyzer.targetTableIsFiltersTable()) {
draggingInfosPopup.setExpressionContext(true);
draggingInfosPopup.setInsertionEntryContext(false);
} else {
draggingInfosPopup.setExpressionContext(false);
draggingInfosPopup.setInsertionEntryContext(true);
}
draggingInfosPopup.setDropInvalid(false, false);
} else {
draggingInfosPopup.setExpressionContext(false);
draggingInfosPopup.setMapOneToOneMode(false, false);
draggingInfosPopup.setInsertionEntryContext(false);
draggingInfosPopup.setDropInvalid(true, analyzer.isInvalidKeyPressed());
}
}
use of org.talend.designer.abstractmap.managers.AbstractUIManager 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());
}
}
Aggregations