本文整理汇总了Java中org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes类的典型用法代码示例。如果您正苦于以下问题:Java EditConfigAttributes类的具体用法?Java EditConfigAttributes怎么用?Java EditConfigAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EditConfigAttributes类属于org.eclipse.nebula.widgets.nattable.edit包,在下文中一共展示了EditConfigAttributes类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureRegistry
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
registry = configRegistry;
// editable
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE,
IEditableRule.ALWAYS_EDITABLE);
// style for selected cells
Style selectStyle = new Style();
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, selectStyle, DisplayMode.SELECT);
// open adjacent editor when we leave the current one during editing
configRegistry.registerConfigAttribute(EditConfigAttributes.OPEN_ADJACENT_EDITOR, Boolean.TRUE,
DisplayMode.EDIT);
// style for upper left corner
BorderStyle borderStyle = new BorderStyle();
borderStyle.setColor(GUIHelper.COLOR_GRAY);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
new LineBorderDecorator(new TextPainter(), borderStyle), DisplayMode.NORMAL, GridRegion.CORNER);
// for each column...
for (int column = 0; column < headingProvider.getColumnCount(); column++)
addColumn(column);
}
示例2: registerComboBox
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private static void registerComboBox(IConfigRegistry configRegistry,
ICellPainter comboBoxCellPainter, ICellEditor comboBoxCellEditor) {
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER, comboBoxCellPainter,
DisplayMode.NORMAL, COMBO_BOX_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
DisplayMode.NORMAL, COMBO_BOX_EDITOR_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
DisplayMode.EDIT, COMBO_BOX_EDITOR_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
new PricingTypeBeanDisplayConverter(), DisplayMode.NORMAL,
FORMAT_PRICING_TYPE_CONFIG_LABEL);
}
示例3: registerTypeNameColumn
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private void registerTypeNameColumn(IConfigRegistry configRegistry, String columnLabel) {
Style cellStyle = new Style();
cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL,
columnLabel);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.EDIT,
columnLabel);
// use a combobox
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new ComboBoxCellEditor(getTypes()),
DisplayMode.EDIT, columnLabel);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new ComboBoxPainter(),
DisplayMode.EDIT, columnLabel);
}
示例4: registerBooleanColumn
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private void registerBooleanColumn(IConfigRegistry configRegistry, String columnLabel) {
// register a CheckBoxCellEditor
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CheckBoxCellEditor() {
protected Control activateCell(Composite parent, Object originalCanonicalValue) {
editorBeenOpened(getRowIndex(), getColumnIndex());
return super.activateCell(parent, originalCanonicalValue);
}
public void close() {
editorBeenClosed(getRowIndex(), getColumnIndex());
super.close();
}
}, DisplayMode.EDIT, columnLabel);
// if you want to use the CheckBoxCellEditor, you should also consider
// using the corresponding CheckBoxPainter to show the content like a
// checkbox in your NatTable
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CheckBoxPainter(),
DisplayMode.NORMAL, columnLabel);
// using a CheckBoxCellEditor also needs a Boolean conversion to work
// correctly
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER,
new DefaultDisplayConverter() {
@Override
public Object canonicalToDisplayValue(Object canonicalValue) {
if (canonicalValue == null)
return null;
boolean isTrue = canonicalValue.toString().equalsIgnoreCase("True");
return new Boolean(isTrue);
}
@Override
public Object displayToCanonicalValue(Object destinationValue) {
return ((Boolean) destinationValue).booleanValue() ? "True" : "False";
}
}, DisplayMode.NORMAL, columnLabel);
}
示例5: registerCheckBoxEditor
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private static void registerCheckBoxEditor(IConfigRegistry configRegistry,
ICellPainter checkBoxCellPainter, ICellEditor checkBoxCellEditor) {
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER, checkBoxCellPainter,
DisplayMode.NORMAL, CHECK_BOX_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
new DefaultBooleanDisplayConverter(), DisplayMode.NORMAL,
CHECK_BOX_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, checkBoxCellEditor,
DisplayMode.NORMAL, CHECK_BOX_EDITOR_CONFIG_LABEL);
}
示例6: registerISINValidator
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private static void registerISINValidator(IConfigRegistry configRegistry) {
TextCellEditor textCellEditor = new TextCellEditor();
textCellEditor.setErrorDecorationEnabled(true);
textCellEditor.setErrorDecorationText(
"Security Id must be 3 alpha characters optionally followed by numbers");
textCellEditor.setDecorationPositionOverride(SWT.LEFT | SWT.TOP);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, textCellEditor,
DisplayMode.NORMAL, SECURITY_ID_EDITOR);
configRegistry.registerConfigAttribute(
EditConfigAttributes.DATA_VALIDATOR, getSecurtityIdValidator(),
DisplayMode.EDIT, SECURITY_ID_CONFIG_LABEL);
}
示例7: registerAskPriceValidator
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private static void registerAskPriceValidator(
IConfigRegistry configRegistry, IDataProvider dataProvider) {
configRegistry.registerConfigAttribute(
EditConfigAttributes.DATA_VALIDATOR,
getAskPriceValidator(dataProvider), DisplayMode.EDIT,
ASK_PRICE_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.DATA_VALIDATOR,
getAskPriceValidator(dataProvider), DisplayMode.NORMAL,
ASK_PRICE_CONFIG_LABEL);
}
示例8: registerBidPriceValidator
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private static void registerBidPriceValidator(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(
EditConfigAttributes.DATA_VALIDATOR,
new DefaultNumericDataValidator(), DisplayMode.EDIT,
BID_PRICE_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.DATA_VALIDATOR,
new DefaultNumericDataValidator(), DisplayMode.NORMAL,
BID_PRICE_CONFIG_LABEL);
}
示例9: registerEditableRules
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private static void registerEditableRules(IConfigRegistry configRegistry,
IDataProvider dataProvider) {
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT,
SECURITY_ID_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT,
COMBO_BOX_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT,
CHECK_BOX_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
getEditRule(dataProvider), DisplayMode.EDIT,
ASK_PRICE_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
getEditRule(dataProvider), DisplayMode.EDIT,
BID_PRICE_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
getEditRule(dataProvider), DisplayMode.EDIT,
LOT_SIZE_CONFIG_LABEL);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
IEditableRule.NEVER_EDITABLE, DisplayMode.EDIT,
SPREAD_CONFIG_LABEL);
}
示例10: registerKeyColumn
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private void registerKeyColumn(IConfigRegistry configRegistry, String columnLabel) {
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CheckBoxCellEditor(),
DisplayMode.EDIT, columnLabel);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CheckBoxPainter(),
DisplayMode.NORMAL, columnLabel);
}
示例11: configureRegistry
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
// editable
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE,
IEditableRule.ALWAYS_EDITABLE);
// style for "changed" cells
Style changedStyle = new Style();
changedStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_YELLOW);
changedStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, GUIHelper.COLOR_BLACK);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, changedStyle, DisplayMode.NORMAL,
"changed");
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, changedStyle, DisplayMode.SELECT,
"changed");
// style for "error" cells
Style errorStyle = new Style();
errorStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_RED);
errorStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, GUIHelper.COLOR_BLACK);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, errorStyle, DisplayMode.NORMAL,
"error");
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, errorStyle, DisplayMode.SELECT,
"error");
// options for Excel export
configRegistry.registerConfigAttribute(ExportConfigAttributes.EXPORTER, new HSSFExcelExporter());
// style for selected cells
Style selectStyle = new Style();
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, selectStyle, DisplayMode.SELECT);
// default text editor
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor(true, true) {
protected Control activateCell(Composite parent, Object originalCanonicalValue) {
editorBeenOpened(getRowIndex(), getColumnIndex());
return super.activateCell(parent, originalCanonicalValue);
}
public void close() {
editorBeenClosed(getRowIndex(), getColumnIndex());
super.close();
}
}, DisplayMode.NORMAL);
// open adjacent editor when we leave the current one during editing
configRegistry.registerConfigAttribute(EditConfigAttributes.OPEN_ADJACENT_EDITOR, Boolean.TRUE,
DisplayMode.EDIT);
// for each column...
if (heading != null)
for (int column = 0; column < heading.length; column++) {
Attribute attribute = heading[column];
String columnLabel = "column" + column;
String type = attribute.getType().toString();
if (type.equalsIgnoreCase("INTEGER"))
registerIntegerColumn(configRegistry, columnLabel);
else if (type.equalsIgnoreCase("RATIONAL"))
registerRationalColumn(configRegistry, columnLabel);
else if (type.equalsIgnoreCase("CHARACTER"))
registerMultiLineEditorColumn(configRegistry, columnLabel);
else if (type.equalsIgnoreCase("BOOLEAN"))
registerBooleanColumn(configRegistry, columnLabel);
else if (type.startsWith("RELATION ")) {
String defaultValue = type + " {}";
registerRvaColumn(configRegistry, columnLabel, defaultValue);
} else
registerDefaultColumn(configRegistry, columnLabel);
}
}
示例12: registerMultiLineEditorColumn
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
private void registerMultiLineEditorColumn(IConfigRegistry configRegistry, String columnLabel) {
// configure the multi line text editor
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR,
new MultiLineTextCellEditor(false) {
protected Control activateCell(Composite parent, Object originalCanonicalValue) {
editorBeenOpened(getRowIndex(), getColumnIndex());
return super.activateCell(parent, originalCanonicalValue);
}
public void close() {
editorBeenClosed(getRowIndex(), getColumnIndex());
super.close();
}
}, DisplayMode.NORMAL, columnLabel);
Style cellStyle = new Style();
cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL,
columnLabel);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.EDIT,
columnLabel);
// configure custom dialog settings
Display display = Display.getCurrent();
Map<String, Object> editDialogSettings = new HashMap<String, Object>();
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_TITLE, "Edit");
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_ICON, display.getSystemImage(SWT.ICON_WARNING));
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_RESIZABLE, Boolean.TRUE);
Point size = new Point(400, 300);
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_SIZE, size);
int screenWidth = display.getBounds().width;
int screenHeight = display.getBounds().height;
Point location = new Point((screenWidth / (2 * display.getMonitors().length)) - (size.x / 2),
(screenHeight / 2) - (size.y / 2));
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_LOCATION, location);
configRegistry.registerConfigAttribute(EditConfigAttributes.EDIT_DIALOG_SETTINGS, editDialogSettings,
DisplayMode.EDIT, columnLabel);
}
示例13: configureRegistry
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
// register the FilterRowTextCellEditor in the first column which
// immediately commits on key press
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
new FilterRowTextCellEditor(),
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + DataModelConstants.FIRSTNAME_COLUMN_POSITION);
// register a combo box cell editor for the gender column in the
// filter row the label is set automatically to the value of
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + column
// position
ICellEditor comboBoxCellEditor = new ComboBoxCellEditor(Arrays.asList(Gender.FEMALE, Gender.MALE));
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
comboBoxCellEditor,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + DataModelConstants.GENDER_COLUMN_POSITION);
// register a combo box cell editor for the married column in the
// filter row the label is set automatically to the value of
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + column
// position
comboBoxCellEditor = new ComboBoxCellEditor(Arrays.asList(Boolean.TRUE, Boolean.FALSE));
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
comboBoxCellEditor,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + DataModelConstants.MARRIED_COLUMN_POSITION);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
TextMatchingMode.EXACT,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + DataModelConstants.GENDER_COLUMN_POSITION);
configRegistry.registerConfigAttribute(FilterRowConfigAttributes.TEXT_DELIMITER, "&"); //$NON-NLS-1$
}
示例14: configureRegistry
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; //导入依赖的package包/类
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
// override the default filter row configuration for painter
configRegistry.registerConfigAttribute(
CELL_PAINTER,
new FilterRowPainter(
new FilterIconPainter(GUIHelper.getImage("filter"))),
NORMAL, FILTER_ROW);
// Configure custom comparator on the rating column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_COMPARATOR,
getIngnorecaseComparator(),
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 2);
// If threshold comparison is used we have to convert the string
// entered by the user to the correct underlying type (double), so
// that it can be compared
// Configure Bid column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
this.doubleDisplayConverter,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
TextMatchingMode.REGULAR_EXPRESSION,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
// Configure Ask column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
this.doubleDisplayConverter,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
TextMatchingMode.REGULAR_EXPRESSION,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6);
// Configure a combo box on the pricing type column
// Register a combo box editor to be displayed in the filter row
// cell when a value is selected from the combo, the object is
// converted to a string using the converter (registered below)
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
new ComboBoxCellEditor(Arrays.asList(new PricingTypeBean("MN"), new PricingTypeBean("AT"))),
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
// The pricing bean object in column is converted to using this
// display converter
// A 'text' match is then performed against the value from the combo
// box
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
new PricingTypeBeanDisplayConverter(),
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
new PricingTypeBeanDisplayConverter(),
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
new PricingTypeBeanDisplayConverter(),
DisplayMode.NORMAL,
"PRICING_TYPE_PROP_NAME");
}