use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class OutputDataMapTableView method createFiltersColumns.
public void createFiltersColumns(final TableViewerCreator<FilterTableEntry> tableViewerCreatorForFilters) {
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreatorForFilters);
//$NON-NLS-1$
column.setTitle(Messages.getString("OutputDataMapTableView.columnTitle.filterCondition"));
column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
final ExtendedTextCellEditor expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForFilters, column, new Zone[] { Zone.INPUTS, Zone.VARS }, true);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<FilterTableEntry, String>() {
public String get(FilterTableEntry bean) {
return bean.getExpression();
}
public void set(FilterTableEntry bean, String value) {
bean.setExpression(value);
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true);
}
});
column.setModifiable(true);
//$NON-NLS-1$
column.setDefaultInternalValue("");
column.setWeight(99);
column.setMoveable(false);
column.setResizable(false);
// Column with remove button
column = new TableViewerCreatorColumn(tableViewerCreatorForFilters);
//$NON-NLS-1$
column.setTitle("");
//$NON-NLS-1$
column.setDefaultDisplayedValue("");
column.setWidth(16);
column.setMoveable(false);
column.setResizable(false);
ButtonPushImageTableEditorContent buttonImage = new ButtonPushImageTableEditorContent() {
/*
* (non-Javadoc)
*
* @see
* org.talend.commons.ui.swt.tableviewer.tableeditor.ButtonImageTableEditorContent#selectionEvent(org.talend
* .commons.ui.swt.tableviewer.TableViewerCreatorColumn, java.lang.Object)
*/
@Override
protected void selectionEvent(TableViewerCreatorColumnNotModifiable column, Object bean) {
ExtendedTableRemoveCommand removeCommand = new ExtendedTableRemoveCommand(bean, extendedTableViewerForFilters.getExtendedTableModel());
mapperManager.removeTableEntry((ITableEntry) bean);
mapperManager.executeCommand(removeCommand);
tableViewerCreatorForFilters.getTableViewer().refresh();
List list = tableViewerCreatorForFilters.getInputList();
updateGridDataHeightForTableConstraints();
if (list != null && list.size() == 0) {
showTableConstraints(false);
} else {
showTableConstraints(true);
}
}
};
buttonImage.setImage(ImageProvider.getImage(EImage.MINUS_ICON));
column.setTableEditorContent(buttonImage);
}
use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class InputDataMapTableView method initColumnsOfTableColumns.
@Override
public void initColumnsOfTableColumns(final TableViewerCreator tableViewerCreatorForColumns) {
boolean isMainConnection = ((InputTable) getDataMapTable()).isMainConnection();
TableViewerCreatorColumn column = null;
if (!isMainConnection) {
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle(Messages.getString("InputDataMapTableView.columnTitle.Expr"));
column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForColumns, column, new Zone[] { Zone.INPUTS }, false);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<InputColumnTableEntry, String>() {
public String get(InputColumnTableEntry bean) {
return bean.getExpression();
}
public void set(InputColumnTableEntry bean, String value) {
// System.out.println("value='" + value + "'");
bean.setExpression(value);
InputTable inputTable = getInputTable();
boolean tableHasAtLeastOneHashKey = mapperManager.isTableHasAtLeastOneHashKey(inputTable);
if (!tableHasAtLeastOneHashKey) {
IUIMatchingMode matchingMode = inputTable.getMatchingMode();
if (matchingMode != TMAP_MATCHING_MODE.ALL_ROWS) {
inputTable.setMatchingMode(TMAP_MATCHING_MODE.ALL_ROWS);
refreshCondensedImage(inputTable, MATCH_MODEL_SETTING);
}
} else {
IUIMatchingMode matchingMode = inputTable.getMatchingMode();
if (matchingMode == TMAP_MATCHING_MODE.ALL_ROWS) {
IUIMatchingMode newMatchModel = previousMatchingModeSelected == null || previousMatchingModeSelected == TMAP_MATCHING_MODE.ALL_ROWS ? TMAP_MATCHING_MODE.UNIQUE_MATCH : previousMatchingModeSelected;
inputTable.setMatchingMode(newMatchModel);
refreshCondensedImage(inputTable, MATCH_MODEL_SETTING);
}
mapperManager.getUiManager().setStatusBarValues(STATUS.EMPTY, null);
}
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true, true);
if (!mapperManager.isCheckSyntaxEnabled()) {
mapperManager.getUiManager().applyActivatedCellEditors(tableViewerCreatorForColumns);
Display.getDefault().asyncExec(new Runnable() {
public void run() {
mapperManager.getProblemsManager().checkLookupExpressionProblem();
}
});
}
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
//$NON-NLS-1$
column.setDefaultInternalValue("");
column.setWeight(COLUMN_EXPRESSION_SIZE_WEIGHT);
column.setImageProvider(new IColumnImageProvider<InputColumnTableEntry>() {
public Image getImage(InputColumnTableEntry bean) {
if (bean.getExpression() != null && !bean.getExpression().trim().equals("")) {
//$NON-NLS-1$
if (mapperManager.isAdvancedMap()) {
return ImageProviderMapper.getImage(ImageInfo.LOOKUP_KEY_ICON);
} else {
return null;
}
} else {
return null;
}
}
});
}
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle(DataMapTableView.COLUMN_NAME);
column.setId(DataMapTableView.ID_NAME_COLUMN);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<InputColumnTableEntry, String>() {
public String get(InputColumnTableEntry bean) {
return bean.getMetadataColumn().getLabel();
}
public void set(InputColumnTableEntry bean, String value) {
bean.getMetadataColumn().setLabel(value);
}
});
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
if (isMainConnection && PluginChecker.isTraceDebugPluginLoaded() && mapperManager.isTracesActive()) {
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle("Preview");
column.setId(DataMapTableView.PREVIEW_COLUMN);
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<InputColumnTableEntry, String>() {
public String get(InputColumnTableEntry bean) {
IMetadataColumn metadataColumn = bean.getMetadataColumn();
if (metadataColumn != null) {
String label = metadataColumn.getLabel();
TraceData preview = bean.getPreviewValue();
if (preview != null && preview.getData() != null) {
return preview.getData().get(label);
}
}
return "";
}
public void set(InputColumnTableEntry bean, String value) {
// do nothing
}
});
}
}
use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class InputDataMapTableView method createGlobalMapColumns.
public void createGlobalMapColumns(final TableViewerCreator<GlobalMapEntry> tableViewerCreatorForGlobalMap) {
TableViewerCreatorColumn<GlobalMapEntry, String> column = new TableViewerCreatorColumn<GlobalMapEntry, String>(tableViewerCreatorForGlobalMap);
// column.setTitle(Messages.getString("InputDataMapTableView.columnTitle.globalMapVar")); //$NON-NLS-1$
//$NON-NLS-1$
column.setTitle("Expr.");
column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
final ExtendedTextCellEditor expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForGlobalMap, column, new Zone[] { Zone.INPUTS }, false);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<GlobalMapEntry, String>() {
public String get(GlobalMapEntry bean) {
return bean.getExpression();
}
public void set(GlobalMapEntry bean, String value) {
bean.setExpression(value);
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true);
}
});
column.setModifiable(true);
//$NON-NLS-1$
column.setDefaultInternalValue("");
column.setWeight(COLUMN_EXPRESSION_SIZE_WEIGHT);
column.setMoveable(false);
column.setResizable(true);
column = new TableViewerCreatorColumn<GlobalMapEntry, String>(tableViewerCreatorForGlobalMap);
//$NON-NLS-1$
column.setTitle(Messages.getString("InputDataMapTableView.globalMapKey"));
column.setId(DataMapTableView.ID_NAME_COLUMN);
column.setModifiable(true);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<GlobalMapEntry, String>() {
public String get(GlobalMapEntry bean) {
return bean.getName();
}
public void set(GlobalMapEntry bean, String value) {
bean.setName(value);
}
});
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
final TextCellEditor cellEditor = new TextCellEditor(tableViewerCreatorForGlobalMap.getTable());
column.setCellEditor(cellEditor);
// Column with remove button
column = new TableViewerCreatorColumn(tableViewerCreatorForGlobalMap);
//$NON-NLS-1$
column.setTitle("");
//$NON-NLS-1$
column.setDefaultDisplayedValue("");
//$NON-NLS-1$
column.setToolTipHeader(Messages.getString("InputDataMapTableView.addNewGlobalMapVar.tooltip"));
column.setWeight(10);
column.setWidth(25);
column.setMoveable(false);
column.setResizable(true);
column.setImageHeader(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.ADD_ICON)));
column.setTableColumnSelectionListener(new DefaultHeaderColumnSelectionListener(column, tableViewerCreatorForGlobalMap) {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent arg0) {
if (!mapperManager.componentIsReadOnly()) {
getInputTable().addGlobalMapEntry(//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
new GlobalMapEntry(getInputTable(), "\"" + findUniqueName("myKey") + "\"", ""));
updateGridDataHeightForTableGlobalMap();
resizeAtExpandedSize();
}
}
});
ButtonPushImageTableEditorContent buttonImage = new ButtonPushImageTableEditorContent() {
/*
* (non-Javadoc)
*
* @see
* org.talend.commons.ui.swt.tableviewer.tableeditor.ButtonImageTableEditorContent#selectionEvent(org.talend
* .commons.ui.swt.tableviewer.TableViewerCreatorColumn, java.lang.Object)
*/
@Override
protected void selectionEvent(TableViewerCreatorColumnNotModifiable column, Object bean) {
ITableEntry tableEntry = (ITableEntry) bean;
if (!mapperManager.componentIsReadOnly()) {
boolean removeEntry = MessageDialog.openConfirm(getShell(), //$NON-NLS-1$
Messages.getString("InputDataMapTableView.removeGlobalMapVar.Title"), //$NON-NLS-1$
Messages.getString("InputDataMapTableView.removeGlobalMapVar.Message", tableEntry.getName()));
if (removeEntry) {
ExtendedTableRemoveCommand removeCommand = new ExtendedTableRemoveCommand(bean, extendedTableViewerForGlobalMap.getExtendedTableModel());
mapperManager.removeTableEntry((ITableEntry) bean);
mapperManager.executeCommand(removeCommand);
tableViewerCreatorForGlobalMap.getTableViewer().refresh();
List list = tableViewerCreatorForGlobalMap.getInputList();
updateGridDataHeightForTableGlobalMap();
resizeAtExpandedSize();
}
}
}
};
buttonImage.setImage(ImageProvider.getImage(EImage.MINUS_ICON));
column.setTableEditorContent(buttonImage);
}
use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class MetadataTableEditorViewExt method configureParameterColumns.
/**
* qzhang Comment method "configureParameterColumns".
*
* @param tableViewerCreator
*/
private void configureParameterColumns(TableViewerCreator<IMetadataColumn> tableViewerCreator) {
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
column.setId(ID_COLUMN_PARAMETER);
//$NON-NLS-1$
column.setTitle(Messages.getString("RowGenTableEditor2.Parameters.TitleText"));
column.setBeanPropertyAccessors(getParameterAccessor());
column.setModifiable(true);
column.setWeight(10);
column.setWidth(45);
}
use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class FunParaTableView2 method createColumns.
@Override
protected void createColumns(TableViewerCreator<Parameter> tableViewerCreator, final Table table) {
this.tableViewerCreator = tableViewerCreator;
IService expressionBuilderDialogService = GlobalServiceRegister.getDefault().getService(IExpressionBuilderDialogService.class);
TableViewerCreatorColumn column;
column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("FunParaTableView2.Parameter"));
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Parameter, Object>() {
public String get(Parameter bean) {
return bean.getName();
}
public void set(Parameter bean, Object value) {
}
});
column.setModifiable(false);
column.setWidth(115);
// column.setCellEditor(new
// TextCellEditor(tableViewerCreator.getTable()));
// ////////////////////////////////////////////////////////
column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("FunParaTableView2.Value"));
column.setId(VALUE_PROPERTY);
CellEditorDialogBehavior behavior = new CellEditorDialogBehavior();
cellEditor = new ExtendedTextCellEditorWithProposal(tableViewerCreator.getTable(), SWT.MULTI | SWT.BORDER, column, behavior);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Parameter, Object>() {
public String get(Parameter bean) {
StringBuffer id = new StringBuffer();
//$NON-NLS-1$
id.append(component.getLabel() + "=>");
TableItem[] item = rowGenTableEditor2.getTable().getSelection();
if (item.length == 1) {
//$NON-NLS-1$
id.append(((MetadataColumnExt) item[0].getData()).getLabel() + "=>");
}
cellEditor.setOwnerId(id.append(bean.getName()).toString());
cellEditor.setExpressionType(bean.getType());
String valueTemp = bean.getValue();
if (valueTemp != null && !valueTemp.endsWith(" ")) {
bean.setValue(valueTemp + " ");
}
return bean.getValue();
}
public void set(Parameter bean, Object value) {
if (value == null) {
return;
}
String valueTemp = value.toString();
if (!valueTemp.endsWith(" ")) {
value = value + " ";
}
bean.setValue(value.toString());
if (ext != null) {
ext.setChanged(true);
}
if (!rowGenTableEditor2.getTableViewerCreator().getTableViewer().isCellEditorActive()) {
rowGenTableEditor2.getTableViewerCreator().getTableViewer().refresh();
}
}
});
column.setModifiable(true);
column.setWidth(115);
dialog = ((IExpressionBuilderDialogService) expressionBuilderDialogService).getExpressionBuilderInstance(mainComposite, cellEditor, component);
behavior.setCellEditorDialog(dialog);
cellEditor.setContentProposalProvider(getProcessProposals());
//$NON-NLS-1$
cellEditor.setExpressionType("String");
column.setCellEditor(cellEditor);
// ////////////////////////////////////////////////////////
column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("FunParaTableView2.Comment"));
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Parameter, Object>() {
public String get(Parameter bean) {
return bean.getComment();
}
public void set(Parameter bean, Object value) {
}
});
column.setModifiable(false);
column.setWidth(155);
// column.setCellEditor(new
// TextCellEditor(tableViewerCreator.getTable()));
// ////////////////////////////////////////////////////////
}
Aggregations