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);
}
}
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());
}
}
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);
}
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);
}
}
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;
}
Aggregations