use of org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer in project tdi-studio-se by Talend.
the class OutputDataMapTableView method createMapSettingTable.
@Override
protected void createMapSettingTable() {
ExtendedTableModel<GlobalMapEntry> tableMapSettingEntriesModel = ((OutputTable) abstractDataMapTable).getTableMapSettingEntriesModel();
extendedTableViewerForMapSetting = new AbstractExtendedTableViewer<GlobalMapEntry>(tableMapSettingEntriesModel, centerComposite) {
@Override
protected void createColumns(TableViewerCreator<GlobalMapEntry> tableViewerCreator, Table table) {
initMapSettingColumns(tableViewerCreator);
}
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<GlobalMapEntry> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setBorderVisible(false);
}
};
if (tableMapSettingEntriesModel != null) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, OUTPUT_REJECT, null));
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, LOOK_UP_INNER_JOIN_REJECT, null));
if (getOutputTable().getIsJoinTableOf() == null) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_TYPE, null));
if (getOutputTable().isRepository()) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_ID, null));
}
}
}
mapSettingViewerCreator = extendedTableViewerForMapSetting.getTableViewerCreator();
mapSettingTable = extendedTableViewerForMapSetting.getTable();
tableForMapSettingGridData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
mapSettingTable.setLayoutData(tableForMapSettingGridData);
mapSettingTable.setHeaderVisible(true);
mapSettingTable.setLinesVisible(true);
boolean mappingSettingVisible = false;
if (abstractDataMapTable instanceof AbstractInOutTable) {
mappingSettingVisible = ((AbstractInOutTable) abstractDataMapTable).isActivateCondensedTool();
}
tableForMapSettingGridData.exclude = !mappingSettingVisible;
mapSettingTable.setVisible(mappingSettingVisible);
mapSettingViewerCreator.getTableViewer().setSelection(null);
mapSettingTable.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
mapSettingViewerCreator.getTableViewer().setSelection(null);
}
public void focusGained(FocusEvent e) {
}
});
final TableViewer mapSettingTableViewer = mapSettingViewerCreator.getTableViewer();
mapSettingTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
selectThisDataMapTableView();
}
});
}
use of org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer in project tdi-studio-se by Talend.
the class VarsDataMapTableView method createToolItems.
@Override
protected void createToolItems() {
// /////////////////////////////////////////////////////////////////
ToolItem addEntryItem = new ToolItem(toolBarActions, SWT.PUSH);
addEntryItem.setEnabled(!getMapperManager().componentIsReadOnly());
//$NON-NLS-1$
addEntryItem.setToolTipText(Messages.getString("VarsDataMapTableView.entryItemTooltip.addVariable"));
addEntryItem.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.ADD_ICON)));
addEntryItem.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
TableViewerCreator<IColumnEntry> tableViewerCreator = getExtendedTableViewerForColumns().getTableViewerCreator();
tableViewerCreator.applyActivatedCellEditor();
Table table = getExtendedTableViewerForColumns().getTable();
int[] indices = table.getSelectionIndices();
int indexInsert = table.getItemCount();
if (indices.length > 0) {
indexInsert = indices[indices.length - 1] + 1;
}
IDataMapTable dataMapTable = VarsDataMapTableView.this.getDataMapTable();
String varName = null;
if (dataMapTable instanceof VarsTable) {
//$NON-NLS-1$
varName = ((VarsTable) dataMapTable).findUniqueColumnName("var");
} else {
throw new UnsupportedOperationException(Messages.getString(//$NON-NLS-1$
"VarsDataMapTableView.exceptionMessage.caseNotFound"));
}
ILanguage currentLanguage = LanguageProvider.getCurrentLanguage();
String type = null;
if (currentLanguage.getCodeLanguage() == ECodeLanguage.JAVA) {
type = JavaTypesManager.STRING.getId();
} else {
// fix bug 0018996 ,when add a var row,there is no default type,this bug exsit for long time
type = PerlTypesManager.STRING;
}
mapperManager.addNewVarEntry(VarsDataMapTableView.this, varName, indexInsert, type);
tableViewerCreatorForColumns.getTableViewer().refresh();
if (canBeResizedAtPreferedSize()) {
VarsDataMapTableView.this.changeSize(VarsDataMapTableView.this.getPreferredSize(true, true, false), true, true);
changeMinimizeState(false);
}
mapperManager.getUiManager().refreshBackground(true, false);
table.setSelection(indexInsert);
removeEntryItem.setEnabled(true);
moveUpEntryItem.setEnabled(true);
moveDownEntryItem.setEnabled(true);
}
});
// /////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////
removeEntryItem = new ToolItem(toolBarActions, SWT.PUSH);
removeEntryItem.setEnabled(false);
removeEntryItem.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.MINUS_ICON)));
//$NON-NLS-1$
removeEntryItem.setToolTipText(Messages.getString("VarsDataMapTableView.entryItemTooltip.removeVariable"));
removeEntryItem.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) tableViewerCreatorForColumns.getTableViewer().getSelection();
List<ITableEntry> selectedBeans = selection.toList();
for (ITableEntry entry : selectedBeans) {
mapperManager.removeTableEntry(entry);
}
if (selectedBeans.size() > 0) {
tableViewerCreatorForColumns.getTableViewer().refresh();
mapperManager.getUiManager().refreshBackground(true, false);
if (canBeResizedAtPreferedSize()) {
resizeAtExpandedSize();
}
}
removeEntryItem.setEnabled(false);
}
});
// /////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////
moveUpEntryItem = new ToolItem(toolBarActions, SWT.PUSH);
moveUpEntryItem.setEnabled(false);
moveUpEntryItem.setImage(ImageProvider.getImage(EImage.UP_ICON));
//$NON-NLS-1$
moveUpEntryItem.setToolTipText(Messages.getString("VarsDataMapTableView.entryItemTooltip.moveUpVariable"));
moveUpEntryItem.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
AbstractExtendedTableViewer viewer = getExtendedTableViewerForColumns();
ExtendedTableMoveCommand moveCommand = new ExtendedTableMoveCommand(viewer.getExtendedTableModel(), true, viewer.getTableViewerCreator().getTable().getSelectionIndices());
viewer.getTableViewerCreator().applyActivatedCellEditor();
viewer.executeCommand(moveCommand);
}
});
// /////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////
moveDownEntryItem = new ToolItem(toolBarActions, SWT.PUSH);
moveDownEntryItem.setEnabled(false);
moveDownEntryItem.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
//$NON-NLS-1$
moveDownEntryItem.setToolTipText(Messages.getString("VarsDataMapTableView.entryItemTooltip.movedownVariable"));
moveDownEntryItem.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
AbstractExtendedTableViewer viewer = getExtendedTableViewerForColumns();
ExtendedTableMoveCommand moveCommand = new ExtendedTableMoveCommand(viewer.getExtendedTableModel(), false, viewer.getTableViewerCreator().getTable().getSelectionIndices());
viewer.getTableViewerCreator().applyActivatedCellEditor();
viewer.executeCommand(moveCommand);
}
});
// /////////////////////////////////////////////////////////////////
}
use of org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer in project tdi-studio-se by Talend.
the class InputDataMapTableView method createMapSettingTable.
@Override
protected void createMapSettingTable() {
ExtendedTableModel<GlobalMapEntry> tableMapSettingEntriesModel = ((InputTable) abstractDataMapTable).getTableMapSettingEntriesModel();
extendedTableViewerForMapSetting = new AbstractExtendedTableViewer<GlobalMapEntry>(tableMapSettingEntriesModel, centerComposite) {
@Override
protected void createColumns(TableViewerCreator<GlobalMapEntry> tableViewerCreator, Table table) {
initMapSettingColumns(tableViewerCreator);
}
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<GlobalMapEntry> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setBorderVisible(false);
}
};
if (tableMapSettingEntriesModel != null) {
if (!getInputTable().isMainConnection()) {
if (!getMapperManager().isMRProcess()) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, LOOKUP_MODEL_SETTING, null));
}
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, MATCH_MODEL_SETTING, null));
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, JOIN_MODEL_SETTING, null));
if (!getMapperManager().isBigDataProcess()) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, PERSISTENCE_MODEL_SETTING, null));
}
// remove schema type in input tables
// tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_TYPE, null));
} else {
// tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_TYPE, null));
}
// if (getInputTable().isRepository()) {
// tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_ID, null));
// }
}
mapSettingViewerCreator = extendedTableViewerForMapSetting.getTableViewerCreator();
mapSettingTable = extendedTableViewerForMapSetting.getTable();
tableForMapSettingGridData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
mapSettingTable.setLayoutData(tableForMapSettingGridData);
mapSettingTable.setHeaderVisible(true);
mapSettingTable.setLinesVisible(true);
boolean mappingSettingVisible = false;
if (abstractDataMapTable instanceof AbstractInOutTable) {
mappingSettingVisible = ((AbstractInOutTable) abstractDataMapTable).isActivateCondensedTool();
}
tableForMapSettingGridData.exclude = !mappingSettingVisible;
mapSettingTable.setVisible(mappingSettingVisible);
mapSettingViewerCreator.setCellModifier(new TableCellModifier(mapSettingViewerCreator));
mapSettingViewerCreator.getTableViewer().setSelection(null);
mapSettingTable.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
mapSettingViewerCreator.getTableViewer().setSelection(null);
}
public void focusGained(FocusEvent e) {
}
});
final TableViewer mapSettingTableViewer = mapSettingViewerCreator.getTableViewer();
mapSettingTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
selectThisDataMapTableView();
}
});
}
use of org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer 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.commons.ui.swt.extended.table.AbstractExtendedTableViewer in project tdi-studio-se by Talend.
the class InputDataMapTableView method createGlobalMapTable.
protected void createGlobalMapTable() {
this.extendedTableViewerForGlobalMap = new AbstractExtendedTableViewer<GlobalMapEntry>(((InputTable) abstractDataMapTable).getTableGlobalMapEntriesModel(), centerComposite) {
@Override
protected void createColumns(TableViewerCreator<GlobalMapEntry> tableViewerCreator, Table table) {
createGlobalMapColumns(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<GlobalMapEntry> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setColumnsResizableByDefault(true);
newTableViewerCreator.setShowLineSelection(SHOW_ROW_SELECTION.FULL);
newTableViewerCreator.setBorderVisible(false);
newTableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
newTableViewerCreator.setKeyboardManagementForCellEdition(true);
newTableViewerCreator.setHorizontalScroll(false);
newTableViewerCreator.setVerticalScroll(false);
// tableViewerCreatorForColumns.setUseCustomItemColoring(this.getDataMapTable()
// instanceof
// AbstractInOutTable);
newTableViewerCreator.setFirstColumnMasked(true);
}
};
tableViewerCreatorForGlobalMap = this.extendedTableViewerForGlobalMap.getTableViewerCreator();
if (mapperManager.componentIsReadOnly()) {
tableViewerCreatorForGlobalMap.setReadOnly(true);
}
this.extendedTableViewerForGlobalMap.setCommandStack(mapperManager.getCommandStack());
tableForGlobalMap = tableViewerCreatorForGlobalMap.getTable();
tableForGlobalMapGridData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
tableForGlobalMap.setLayoutData(tableForGlobalMapGridData);
boolean tableGlobalMapVisible = false;
if (abstractDataMapTable instanceof InputTable) {
IUILookupMode lookupMode = ((InputTable) abstractDataMapTable).getLookupMode();
tableGlobalMapVisible = lookupMode == TMAP_LOOKUP_MODE.RELOAD || lookupMode == TMAP_LOOKUP_MODE.CACHE_OR_RELOAD;
}
tableForGlobalMapGridData.exclude = !tableGlobalMapVisible;
tableForGlobalMap.setVisible(tableGlobalMapVisible);
if (!mapperManager.componentIsReadOnly()) {
new DragNDrop(mapperManager, tableForGlobalMap, false, true);
}
tableViewerCreatorForGlobalMap.addCellValueModifiedListener(new ITableCellValueModifiedListener() {
public void cellValueModified(TableCellValueModifiedEvent e) {
unselectAllEntriesIfErrorDetected(e);
}
});
final TableViewer tableViewer = tableViewerCreatorForGlobalMap.getTableViewer();
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
selectThisDataMapTableView();
UIManager uiManager = mapperManager.getUiManager();
uiManager.selectLinks(InputDataMapTableView.this, uiManager.extractSelectedTableEntries(selection), false, false);
}
});
tableForGlobalMap.addListener(SWT.KeyDown, new Listener() {
public void handleEvent(Event event) {
processEnterKeyDown(tableViewerCreatorForGlobalMap, event);
}
});
tableViewerCreatorForGlobalMap.setLabelProvider(new DefaultTableLabelProvider(tableViewerCreatorForGlobalMap) {
@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(tableForGlobalMap);
}
Aggregations