use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class AbstractHL7MetadataTableEditorView method configureDbTypeColumn.
/**
* DOC amaumont Comment method "initDbTypeColumn".
*
* @param tableViewerCreator
*/
private TableViewerCreatorColumn configureDbTypeColumn(final TableViewerCreator<B> tableViewerCreator) {
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("MetadataTableEditorView.DBTypeTitle"));
//$NON-NLS-1$
column.setToolTipHeader(Messages.getString("MetadataTableEditorView.DBTypeTitle"));
column.setId(ID_COLUMN_DBTYPE);
column.setBeanPropertyAccessors(getDbTypeAccessor());
column.setModifiable(dbTypeColumnWritable && !isReadOnly());
column.setWeight(10);
column.setMinimumWidth(60);
if (dbTypeColumnWritable) {
CellEditorValueAdapter comboValueAdapter = CellEditorValueAdapterFactory.getComboAdapterForComboCellEditor();
String[] arrayDbTypes = new String[0];
//$NON-NLS-1$
arrayDbTypes = MetadataTalendType.getDbTypes(getCurrentDbms());
// System.out.println("currentDbms:" + getCurrentDbms() + "
// dbTypes:" + arrayDbTypes);
ComboBoxCellEditor typeComboEditor = new ComboBoxCellEditor(tableViewerCreator.getTable(), arrayDbTypes, SWT.READ_ONLY);
CCombo typeCombo = (CCombo) typeComboEditor.getControl();
typeCombo.setEditable(false);
column.setCellEditor(typeComboEditor, comboValueAdapter);
} else {
column.setColorProvider(new IColumnColorProvider() {
public Color getBackgroundColor(Object bean) {
return READONLY_CELL_BG_COLOR;
}
public Color getForegroundColor(Object bean) {
return null;
}
});
}
return column;
}
use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class AbstractHL7MetadataTableEditorView method configureTalendTypeColumn.
/**
* DOC amaumont Comment method "initTalendTypeColumn".
*
* @param tableViewerCreator
* @param comboValueAdapter
* @param arrayTalendTypes
*/
private TableViewerCreatorColumn configureTalendTypeColumn(final TableViewerCreator<B> tableViewerCreator) {
CellEditorValueAdapter comboValueAdapter = null;
ECodeLanguage codeLanguage = LanguageManager.getCurrentLanguage();
if (codeLanguage == ECodeLanguage.JAVA) {
comboValueAdapter = new JavaTypeComboValueAdapter<B>(JavaTypesManager.getDefaultJavaType(), getNullableAccessor());
} else if (codeLanguage == ECodeLanguage.PERL) {
comboValueAdapter = CellEditorValueAdapterFactory.getComboAdapterForComboCellEditor();
}
String[] arrayTalendTypes = new String[0];
try {
arrayTalendTypes = MetadataTalendType.getTalendTypesLabels();
} catch (NoClassDefFoundError e) {
// shouln't be happend
// e.printStackTrace();
ExceptionHandler.process(e);
} catch (ExceptionInInitializerError e) {
// shouln't be happend
// e.printStackTrace();
ExceptionHandler.process(e);
}
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("MetadataTableEditorView.TypleTitle"));
//$NON-NLS-1$
column.setToolTipHeader(Messages.getString("MetadataTableEditorView.TypleTitle"));
column.setId(ID_COLUMN_TYPE);
column.setBeanPropertyAccessors(getTalendTypeAccessor());
column.setModifiable(!isReadOnly());
column.setWeight(10);
column.setMinimumWidth(30);
ComboBoxCellEditor typeComboEditor = new ComboBoxCellEditor(tableViewerCreator.getTable(), arrayTalendTypes, SWT.READ_ONLY);
CCombo typeCombo = (CCombo) typeComboEditor.getControl();
typeCombo.setEditable(false);
column.setCellEditor(typeComboEditor, comboValueAdapter);
return column;
}
use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class AutoConversionTypesEditorView method createTargetDataTypeColumn.
private TableViewerCreatorColumn createTargetDataTypeColumn(TableViewerCreator<AutoConversionType> tableViewerCreator) {
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("AutoConversionTypesEditor.table.column.targetDataType"));
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<AutoConversionType, String>() {
@Override
public String get(AutoConversionType bean) {
return bean.getTargetDataType();
}
@Override
public void set(AutoConversionType bean, String value) {
bean.setTargetDataType(value);
}
});
column.setModifiable(true);
column.setWeight(30);
column.setMinimumWidth(50);
configureTypeColumn(tableViewerCreator, column);
return column;
}
use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class JsonTableView method createColumn.
@SuppressWarnings({ "rawtypes", "unchecked" })
private TableViewerCreatorColumn createColumn(TableViewerCreator<Map<String, Object>> tableViewerCreator, String title) {
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
column.setTitle(title);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Map<String, Object>, String>() {
@Override
public String get(Map<String, Object> bean) {
return (String) bean.get(title);
}
@Override
public void set(Map<String, Object> bean, String value) {
bean.put(title, value);
}
});
column.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
column.setModifiable(!isReadOnly());
column.setWeight(30);
column.setMinimumWidth(50);
//$NON-NLS-1$
column.setDefaultInternalValue("");
return column;
}
use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.
the class OutputDataMapTableView method initColumnsOfTableColumns.
@Override
public void initColumnsOfTableColumns(final TableViewerCreator tableViewerCreatorForColumns) {
IOConnection connection = ((OutputTable) getDataMapTable()).getConnection();
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle(Messages.getString("OutputDataMapTableView.columnTitle.expression"));
column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForColumns, column, new Zone[] { Zone.INPUTS, Zone.VARS }, false);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry bean) {
return bean.getExpression();
}
public void set(OutputColumnTableEntry bean, String value) {
bean.setExpression(value);
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true);
tableViewerCreatorForColumns.getTableViewer().refresh(bean);
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
//$NON-NLS-1$
column.setDefaultInternalValue("");
column.setWeight(COLUMN_EXPRESSION_SIZE_WEIGHT);
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle(DataMapTableView.COLUMN_NAME);
column.setId(DataMapTableView.ID_NAME_COLUMN);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry bean) {
return bean.getMetadataColumn().getLabel();
}
public void set(OutputColumnTableEntry bean, String value) {
bean.getMetadataColumn().setLabel(value);
}
});
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
if (PluginChecker.isTraceDebugPluginLoaded() && mapperManager.isTracesActive() && connection != null) {
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle("Preview");
column.setId(DataMapTableView.PREVIEW_COLUMN);
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry 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(OutputColumnTableEntry bean, String value) {
// do nothing
}
});
}
configureCellModifier(tableViewerCreatorForColumns);
}
Aggregations