use of org.talend.designer.mapper.managers.UIManager in project tdi-studio-se by Talend.
the class VarsDataMapTableView method addListeners.
@Override
protected void addListeners() {
super.addListeners();
tableViewerCreatorForColumns.getSelectionHelper().addAfterSelectionListener(new ILineSelectionListener() {
public void handle(LineSelectionEvent e) {
if (!getMapperManager().componentIsReadOnly()) {
boolean atLeastOneItemIsSelected = tableViewerCreatorForColumns.getTable().getSelectionCount() > 0;
removeEntryItem.setEnabled(atLeastOneItemIsSelected);
moveUpEntryItem.setEnabled(atLeastOneItemIsSelected);
moveDownEntryItem.setEnabled(atLeastOneItemIsSelected);
}
}
});
getExtendedTableViewerForColumns().getExtendedTableModel().addAfterOperationListListener(new IListenableListListener() {
public void handleEvent(ListenableListEvent event) {
if (event.type == ListenableListEvent.TYPE.SWAPED) {
DataMapTableView varsDataMapTableView = mapperManager.retrieveDataMapTableView(getExtendedTableViewerForColumns().getTable());
UIManager uiManager = mapperManager.getUiManager();
uiManager.parseAllExpressions(varsDataMapTableView, false);
mapperManager.getProblemsManager().checkProblemsForAllEntries(varsDataMapTableView, true);
uiManager.refreshBackground(true, false);
List<ITableEntry> list = uiManager.extractSelectedTableEntries(varsDataMapTableView.getTableViewerCreatorForColumns().getTableViewer().getSelection());
uiManager.selectLinks(varsDataMapTableView, list, false, false);
}
}
});
}
use of org.talend.designer.mapper.managers.UIManager in project tdi-studio-se by Talend.
the class OutputDataMapTableView method createFiltersTable.
protected void createFiltersTable() {
this.extendedTableViewerForFilters = new AbstractExtendedTableViewer<FilterTableEntry>(((OutputTable) abstractDataMapTable).getTableFiltersEntriesModel(), centerComposite) {
@Override
protected void createColumns(TableViewerCreator<FilterTableEntry> tableViewerCreator, Table table) {
createFiltersColumns(tableViewerCreator);
}
/*
* (non-Javadoc)
*
* @see
* org.talend.commons.ui.swt.extended.macrotable.AbstractExtendedTableViewer#setTableViewerCreatorOptions
* (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)
*/
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<FilterTableEntry> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setColumnsResizableByDefault(false);
newTableViewerCreator.setBorderVisible(false);
newTableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
newTableViewerCreator.setKeyboardManagementForCellEdition(true);
// tableViewerCreatorForColumns.setUseCustomItemColoring(this.getDataMapTable()
// instanceof
// AbstractInOutTable);
newTableViewerCreator.setFirstColumnMasked(true);
}
};
tableViewerCreatorForFilters = this.extendedTableViewerForFilters.getTableViewerCreator();
this.extendedTableViewerForFilters.setCommandStack(mapperManager.getCommandStack());
tableForConstraints = tableViewerCreatorForFilters.getTable();
tableForConstraintsGridData = new GridData(GridData.FILL_HORIZONTAL);
tableForConstraints.setLayoutData(tableForConstraintsGridData);
boolean tableConstraintsVisible = false;
if (abstractDataMapTable instanceof OutputTable) {
tableConstraintsVisible = ((OutputTable) abstractDataMapTable).getFilterEntries().size() > 0;
}
tableForConstraintsGridData.exclude = !tableConstraintsVisible;
tableForConstraints.setVisible(tableConstraintsVisible);
if (!mapperManager.componentIsReadOnly()) {
new DragNDrop(mapperManager, tableForConstraints, false, true);
}
tableViewerCreatorForFilters.addCellValueModifiedListener(new ITableCellValueModifiedListener() {
public void cellValueModified(TableCellValueModifiedEvent e) {
unselectAllEntriesIfErrorDetected(e);
}
});
final TableViewer tableViewer = tableViewerCreatorForFilters.getTableViewer();
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
selectThisDataMapTableView();
UIManager uiManager = mapperManager.getUiManager();
uiManager.selectLinks(OutputDataMapTableView.this, uiManager.extractSelectedTableEntries(selection), false, false);
}
});
tableForConstraints.addListener(SWT.KeyDown, new Listener() {
public void handleEvent(Event event) {
processEnterKeyDown(tableViewerCreatorForFilters, event);
}
});
tableViewerCreatorForFilters.setLabelProvider(new DefaultTableLabelProvider(tableViewerCreatorForFilters) {
@Override
public Color getBackground(Object element, int columnIndex) {
return getBackgroundCellColor(tableViewerCreator, element, columnIndex);
}
@Override
public Color getForeground(Object element, int columnIndex) {
return getForegroundCellColor(tableViewerCreator, element, columnIndex);
}
});
initShowMessageErrorListener(tableForConstraints);
}
use of org.talend.designer.mapper.managers.UIManager in project tdi-studio-se by Talend.
the class MapperUI method createWindow.
/**
* DOC amaumont Comment method "createUI".
*
* @param display
*/
public Shell createWindow(final Display display, MapperModel model) {
Shell activeShell = display.getActiveShell();
Shell mapperShell = null;
int style = SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.APPLICATION_MODAL | SWT.RESIZE;
if (activeShell == null) {
mapperShell = new Shell(mapperShell, style);
} else {
mapperShell = new Shell(activeShell, style);
}
this.mapperUIParent = mapperShell;
final Shell mapperShellFinal = mapperShell;
mapperShell.addShellListener(new ShellListener() {
public void shellActivated(ShellEvent e) {
}
public void shellClosed(ShellEvent e) {
UIManager uiManager = mapperManager.getUiManager();
if (uiManager.getMapperResponse() == SWT.NONE) {
for (DataMapTableView dataMapTableView : uiManager.getInputsTablesView()) {
dataMapTableView.notifyFocusLost();
}
for (DataMapTableView dataMapTableView : uiManager.getOutputsTablesView()) {
dataMapTableView.notifyFocusLost();
}
for (DataMapTableView dataMapTableView : uiManager.getVarsTablesView()) {
dataMapTableView.notifyFocusLost();
}
uiManager.setMapperResponse(SWT.CANCEL);
uiManager.prepareClosing(uiManager.getMapperResponse());
}
if (!mapperManager.componentIsReadOnly() && mapperManager.isDataChanged() && !mapperManager.getUiManager().isCloseWithoutPrompt()) {
boolean closeWindow = MessageDialog.openConfirm(mapperShellFinal, //$NON-NLS-1$
Messages.getString("MapperUI.CancelWithoutSaveModifications.Title"), //$NON-NLS-1$
Messages.getString("MapperUI.CancelWithoutSaveModifications.Message"));
if (!closeWindow) {
e.doit = false;
} else {
mapperManager.getAbstractMapComponent().setExternalData(mapperManager.getOriginalExternalData());
mapperManager.getUiManager().prepareClosing(SWT.CANCEL);
}
}
}
public void shellDeactivated(ShellEvent e) {
}
public void shellDeiconified(ShellEvent e) {
}
public void shellIconified(ShellEvent e) {
}
});
MapperComponent component = (MapperComponent) mapperManager.getAbstractMapComponent();
ExternalMapperUiProperties uiProperties = mapperManager.getUiManager().getUiProperties();
mapperShell.setImage(CoreImageProvider.getComponentIcon(component.getComponent(), ICON_SIZE.ICON_32));
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
String productName = brandingService.getFullProductName();
mapperShell.setText(Messages.getString("MapperMain.ShellTitle", productName, component.getComponent().getName(), //$NON-NLS-1$
component.getUniqueName()));
Rectangle boundsMapper = uiProperties.getBoundsMapper();
if (uiProperties.isShellMaximized()) {
mapperShell.setMaximized(uiProperties.isShellMaximized());
} else {
if (uiProperties.getBoundsMapper().equals(ExternalMapperUiProperties.DEFAULT_BOUNDS_MAPPER)) {
mapperShell.setMaximized(true);
// boundsMapper = display.getBounds(); //no need this, will cause the full problems.
} else {
// // move shell at outer of display zone to avoid visual effect on loading
// Rectangle tmpBoundsMapper = new Rectangle(-boundsMapper.width, boundsMapper.y, boundsMapper.width,
// boundsMapper.height);
// shell.setBounds(tmpBoundsMapper);
boundsMapper = uiProperties.getBoundsMapper();
if (boundsMapper.x < 0) {
boundsMapper.x = 0;
}
if (boundsMapper.y < 0) {
boundsMapper.y = 0;
}
mapperShell.setBounds(boundsMapper);
}
}
createCompositeContent(model);
mapperShell.open();
return mapperShell;
}
use of org.talend.designer.mapper.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();
// System.out.println("verticalBar.getSelection()="+verticalBar.getSelection() + "
// currentTable.getItemHeight()="+currentTable.getItemHeight());
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentTable);
int indicYPositionRefZone = 0;
if (WindowSystem.isGTK()) {
int offsetVerticalBar = -verticalBar.getSelection();
if (itemIndexTarget == 0) {
indicYPositionRefTable = 0 + offsetVerticalBar;
} else {
indicYPositionRefTable = itemIndexTarget * (currentTable.getItemHeight() + 2) + offsetVerticalBar;
}
// System.out.println("indicYPositionRefTable="+indicYPositionRefTable);
indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2;
indicYPositionRefZone -= currentTable.getItemHeight() + 1;
// System.out.println("indicYPositionRefZone="+indicYPositionRefZone);
} else {
int offsetVerticalBar = -verticalBar.getSelection() * currentTable.getItemHeight();
if (itemIndexTarget == 0) {
indicYPositionRefTable = 0 + offsetVerticalBar;
} else {
indicYPositionRefTable = itemIndexTarget * currentTable.getItemHeight() - 1 + offsetVerticalBar;
}
Point point = currentTable.getDisplay().map(currentTable, tablesZoneViewParent, new Point(0, indicYPositionRefTable));
indicYPositionRefZone = point.y + 5;
}
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;
}
use of org.talend.designer.mapper.managers.UIManager in project tdi-studio-se by Talend.
the class MapperUI method selectFirstInOutTablesView.
private void selectFirstInOutTablesView() {
List<DataMapTableView> inputsTablesView = mapperManager.getUiManager().getInputsTablesView();
UIManager uiManager = mapperManager.getUiManager();
if (inputsTablesView.size() > 0) {
uiManager.selectDataMapTableView(inputsTablesView.get(0), true, false);
}
List<DataMapTableView> outputsTablesView = mapperManager.getUiManager().getOutputsTablesView();
if (outputsTablesView.size() > 0) {
uiManager.selectDataMapTableView(outputsTablesView.get(0), true, false);
}
}
Aggregations