use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class DynamicColumnExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// start with 3 columns
this.columns.add("Column_0");
this.columns.add("Column_1");
this.columns.add("Column_2");
this.values.add(createValueRow("Homer"));
this.values.add(createValueRow("Marge"));
this.values.add(createValueRow("Bart"));
this.values.add(createValueRow("Lisa"));
this.values.add(createValueRow("Maggie"));
Composite panel = new Composite(parent, SWT.NONE);
panel.setLayout(new GridLayout());
GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
Composite gridPanel = new Composite(panel, SWT.NONE);
gridPanel.setLayout(new GridLayout());
GridDataFactory.fillDefaults().grab(true, true).applyTo(gridPanel);
Composite buttonPanel = new Composite(panel, SWT.NONE);
buttonPanel.setLayout(new GridLayout());
GridDataFactory.fillDefaults().grab(true, true).applyTo(buttonPanel);
ConfigRegistry configRegistry = new ConfigRegistry();
final GlazedListsGridLayer<Map<String, String>> glazedListsGridLayer = new GlazedListsGridLayer<>(this.values, new MyColumnPropertyAccessor(), new SimpleColumnHeaderDataProvider(), configRegistry, true);
final NatTable natTable = new NatTable(gridPanel, glazedListsGridLayer, false);
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
natTable.addConfiguration(new SingleClickSortConfiguration());
natTable.configure();
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
Button addColumnButton = new Button(buttonPanel, SWT.PUSH);
addColumnButton.setText("add column");
addColumnButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String newColumn = "Column_" + DynamicColumnExample.this.columns.size();
DynamicColumnExample.this.columns.add(newColumn);
for (Map<String, String> value : DynamicColumnExample.this.values) {
String prefix = value.get("Column_0");
prefix = prefix.substring(0, prefix.indexOf("_"));
value.put(newColumn, prefix + "_" + (DynamicColumnExample.this.columns.size() - 1));
}
glazedListsGridLayer.getBodyDataLayer().fireLayerEvent(new ColumnInsertEvent(glazedListsGridLayer.getBodyDataLayer(), DynamicColumnExample.this.columns.size() - 1));
natTable.refresh();
}
});
natTable.doCommand(new ColumnHideCommand(glazedListsGridLayer.getBodyLayer(), 1));
return panel;
}
use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class _6035_ExcelLikeFilterRowCustomTypesExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// create a new ConfigRegistry which will be needed for GlazedLists
// handling
ConfigRegistry configRegistry = new ConfigRegistry();
String[] propertyNames = { "name", "age", "money", "gender", "city" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<>();
propertyToLabelMap.put("name", "Name");
propertyToLabelMap.put("age", "Age");
propertyToLabelMap.put("money", "Money");
propertyToLabelMap.put("gender", "Gender");
propertyToLabelMap.put("city", "City");
IColumnPropertyAccessor<MyRowObject> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<>(propertyNames);
BodyLayerStack<MyRowObject> bodyLayerStack = new BodyLayerStack<>(createMyRowObjects(50), columnPropertyAccessor);
// add a label accumulator to be able to register converter
bodyLayerStack.getBodyDataLayer().setConfigLabelAccumulator(new ColumnLabelAccumulator());
// build the column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// example on how to configure a different icon if a filter is applied
ComboBoxFilterRowHeaderComposite<MyRowObject> filterRowHeaderLayer = new ComboBoxFilterRowHeaderComposite<>(bodyLayerStack.getFilterList(), bodyLayerStack.getBodyDataLayer(), bodyLayerStack.getSortedList(), columnPropertyAccessor, columnHeaderLayer, columnHeaderDataProvider, configRegistry, false);
final IComboBoxDataProvider comboBoxDataProvider = filterRowHeaderLayer.getComboBoxDataProvider();
filterRowHeaderLayer.addConfiguration(new ComboBoxFilterRowConfiguration() {
{
this.cellEditor = new FilterRowComboBoxCellEditor(comboBoxDataProvider, 5);
this.filterIconPainter = new ComboBoxFilterIconPainter(comboBoxDataProvider, GUIHelper.getImage("filter"), null);
}
});
// build the row header layer
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// build the corner layer
IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, filterRowHeaderLayer);
// build the grid layer
GridLayer gridLayer = new GridLayer(bodyLayerStack, filterRowHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
// add the
// DefaultNatTableStyleConfiguration and the ConfigRegistry manually
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new MyRowObjectTableConfiguration());
natTable.addConfiguration(new FilterRowConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
@Override
protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
return super.createCornerMenu(natTable).withStateManagerMenuItemProvider();
}
});
natTable.addConfiguration(new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE);
}
});
natTable.configure();
natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(natTable));
return natTable;
}
use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class _6041_TreeGridExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout());
// create a new ConfigRegistry which will be needed for GlazedLists
// handling
ConfigRegistry configRegistry = new ConfigRegistry();
// property names of the Person class
String[] propertyNames = { "lastName", "firstName", "gender", "married", "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<>();
propertyToLabelMap.put("lastName", "Lastname");
propertyToLabelMap.put("firstName", "Firstname");
propertyToLabelMap.put("gender", "Gender");
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("birthday", "Birthday");
IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<>(propertyNames);
final BodyLayerStack<PersonWithAddress> bodyLayerStack = new BodyLayerStack<>(PersonService.getPersonsWithAddress(50), columnPropertyAccessor, new PersonWithAddressTreeFormat());
// build the column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// build the row header layer
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// build the corner layer
IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
GridLayer gridLayer = new GridLayer(bodyLayerStack, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
final NatTable natTable = new NatTable(container, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
// add the DefaultNatTableStyleConfiguration and the ConfigRegistry
// manually
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
// register a CheckBoxPainter as CellPainter for the married
// information
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CheckBoxPainter(), DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3);
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDateDisplayConverter("MM/dd/yyyy"), DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4);
}
});
// adds the key bindings that allows pressing space bar to
// expand/collapse tree nodes
natTable.addConfiguration(new TreeLayerExpandCollapseKeyBindings(bodyLayerStack.getTreeLayer(), bodyLayerStack.getSelectionLayer()));
natTable.configure();
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
Composite buttonPanel = new Composite(container, SWT.NONE);
buttonPanel.setLayout(new RowLayout());
GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonPanel);
Button collapseAllButton = new Button(buttonPanel, SWT.PUSH);
collapseAllButton.setText("Collapse All");
collapseAllButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new TreeCollapseAllCommand());
}
});
Button expandAllButton = new Button(buttonPanel, SWT.PUSH);
expandAllButton.setText("Expand All");
expandAllButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new TreeExpandAllCommand());
}
});
return container;
}
use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class _6044_HierarchicalTreeLayerGridExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<>();
propertyToLabelMap.put("manufacturer", "Manufacturer");
propertyToLabelMap.put("model", "Model");
propertyToLabelMap.put("motors.identifier", "Identifier");
propertyToLabelMap.put("motors.capacity", "Capacity");
propertyToLabelMap.put("motors.capacityUnit", "Capacity Unit");
propertyToLabelMap.put("motors.maximumSpeed", "Maximum Speed");
propertyToLabelMap.put("motors.feedbacks.creationTime", "Creation Time");
propertyToLabelMap.put("motors.feedbacks.classification", "Classification");
propertyToLabelMap.put("motors.feedbacks.comment", "Comment");
ConfigRegistry configRegistry = new ConfigRegistry();
BodyLayerStack bodyLayerStack = new BodyLayerStack(CarService.getInput(), CarService.PROPERTY_NAMES);
// create the column header layer stack
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(CarService.PROPERTY_NAMES, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DataLayer(columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// add the SortHeaderLayer to the column header layer stack
final SortHeaderLayer<HierarchicalWrapper> sortHeaderLayer = new SortHeaderLayer<>(columnHeaderLayer, new HierarchicalWrapperSortModel(bodyLayerStack.getSortedList(), bodyLayerStack.getColumnPropertyAccessor(), bodyLayerStack.getTreeLayer().getLevelIndexMapping(), columnHeaderDataLayer, configRegistry), false);
// create the row header layer stack
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
ILayer rowHeaderLayer = new RowHeaderLayer(new DataLayer(rowHeaderDataProvider, 40, 20), bodyLayerStack, bodyLayerStack.getSelectionLayer());
// create the corner layer stack
ILayer cornerLayer = new CornerLayer(new DataLayer(new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider)), rowHeaderLayer, sortHeaderLayer);
// create the grid layer composed with the prior created layer stacks
GridLayer gridLayer = new GridLayer(bodyLayerStack, sortHeaderLayer, rowHeaderLayer, cornerLayer);
NatTable natTable = new NatTable(parent, gridLayer, false);
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {
{
this.vAlign = VerticalAlignmentEnum.TOP;
this.hAlign = HorizontalAlignmentEnum.LEFT;
this.cellPainter = new PaddingDecorator(new TextPainter(), 2);
}
});
// adds the key bindings that allows pressing space bar to
// expand/collapse tree nodes
natTable.addConfiguration(new TreeLayerExpandCollapseKeyBindings(bodyLayerStack.getTreeLayer(), bodyLayerStack.getSelectionLayer()));
// add sorting configuration
natTable.addConfiguration(new SingleClickSortConfiguration());
natTable.configure();
return natTable;
}
use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class _6045_HierarchicalTreeLayerExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout());
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<>();
propertyToLabelMap.put("manufacturer", "Manufacturer");
propertyToLabelMap.put("model", "Model");
propertyToLabelMap.put("motors.identifier", "Identifier");
propertyToLabelMap.put("motors.capacity", "Capacity");
propertyToLabelMap.put("motors.capacityUnit", "Capacity Unit");
propertyToLabelMap.put("motors.maximumSpeed", "Maximum Speed");
propertyToLabelMap.put("motors.feedbacks.creationTime", "Creation Time");
propertyToLabelMap.put("motors.feedbacks.classification", "Classification");
propertyToLabelMap.put("motors.feedbacks.comment", "Comment");
ConfigRegistry configRegistry = new ConfigRegistry();
BodyLayerStack bodyLayerStack = new BodyLayerStack(CarService.getInput(), CarService.PROPERTY_NAMES);
// create the column header layer stack
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(CarService.PROPERTY_NAMES, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DataLayer(columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// add the SortHeaderLayer to the column header layer stack
final SortHeaderLayer<HierarchicalWrapper> sortHeaderLayer = new SortHeaderLayer<>(columnHeaderLayer, new HierarchicalWrapperSortModel(bodyLayerStack.getSortedList(), bodyLayerStack.getColumnPropertyAccessor(), bodyLayerStack.getTreeLayer().getLevelIndexMapping(), columnHeaderDataLayer, configRegistry), false);
// add the filter row functionality
final FilterRowHeaderComposite<HierarchicalWrapper> filterRowHeaderLayer = new FilterRowHeaderComposite<>(new DefaultGlazedListsFilterStrategy<>(bodyLayerStack.getFilterList(), bodyLayerStack.getColumnPropertyAccessor(), configRegistry), sortHeaderLayer, columnHeaderDataLayer.getDataProvider(), configRegistry);
filterRowHeaderLayer.addConfigLabelAccumulatorForRegion(GridRegion.FILTER_ROW, new IConfigLabelAccumulator() {
@Override
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
int columnIndex = filterRowHeaderLayer.getColumnIndexByPosition(columnPosition);
// header column
if (columnIndex < 0) {
configLabels.addLabelOnTop(HierarchicalTreeLayer.LEVEL_HEADER_CELL);
}
}
});
// create the composite layer composed with the prior created layer
// stacks
CompositeLayer compositeLayer = new CompositeLayer(1, 2);
compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, filterRowHeaderLayer, 0, 0);
compositeLayer.setChildLayer(GridRegion.BODY, bodyLayerStack, 0, 1);
compositeLayer.addConfiguration(new DefaultGridLayerConfiguration(compositeLayer) {
@Override
protected void addAlternateRowColoringConfig(CompositeLayer gridLayer) {
// do nothing to avoid the default grid alternate row coloring
// needed because the alternate row coloring in the hierarchical
// tree
// is based on the spanned cells and not per individual row
// position
}
});
NatTable natTable = new NatTable(container, compositeLayer, false);
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {
{
this.vAlign = VerticalAlignmentEnum.TOP;
this.hAlign = HorizontalAlignmentEnum.LEFT;
this.cellPainter = new PaddingDecorator(new TextPainter(), 2);
}
});
// add editing configuration
natTable.addConfiguration(new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
// make identifier editable
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, EditableRule.ALWAYS_EDITABLE, DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2);
// make capacity unit editable
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, EditableRule.ALWAYS_EDITABLE, DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new ComboBoxCellEditor("KW", "PS"), DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new PaddingDecorator(new ComboBoxPainter(), 2), DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4);
// make comment editable
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, EditableRule.ALWAYS_EDITABLE, DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 8);
}
});
// adds the key bindings that allows pressing space bar to
// expand/collapse tree nodes
natTable.addConfiguration(new TreeLayerExpandCollapseKeyBindings(bodyLayerStack.getTreeLayer(), bodyLayerStack.getSelectionLayer()));
// add sorting configuration
natTable.addConfiguration(new SingleClickSortConfiguration());
// add some additional filter configuration
natTable.addConfiguration(new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
Style style = new Style();
style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.getColor(173, 216, 230));
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, GridRegion.FILTER_ROW);
}
});
natTable.configure();
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
Composite buttonPanel = new Composite(container, SWT.NONE);
buttonPanel.setLayout(new RowLayout());
GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonPanel);
Button collapseAllButton = new Button(buttonPanel, SWT.PUSH);
collapseAllButton.setText("Collapse All");
collapseAllButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new TreeCollapseAllCommand());
}
});
Button expandAllButton = new Button(buttonPanel, SWT.PUSH);
expandAllButton.setText("Expand All");
expandAllButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new TreeExpandAllCommand());
}
});
Button expandAllFirstLevelButton = new Button(buttonPanel, SWT.PUSH);
expandAllFirstLevelButton.setText("Expand All First Level");
expandAllFirstLevelButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new TreeExpandToLevelCommand(0));
}
});
Button toggleExpandButton = new Button(buttonPanel, SWT.PUSH);
toggleExpandButton.setText("Enable Advanced Expand");
toggleExpandButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
_6045_HierarchicalTreeLayerExample.this.advancedExpandEnabled = !_6045_HierarchicalTreeLayerExample.this.advancedExpandEnabled;
if (_6045_HierarchicalTreeLayerExample.this.advancedExpandEnabled) {
toggleExpandButton.setText("Disable Advanced Expand");
// configure advanced action
natTable.getUiBindingRegistry().registerFirstSingleClickBinding(_6045_HierarchicalTreeLayerExample.this.treeImagePainterMouseEventMatcher, _6045_HierarchicalTreeLayerExample.this.advancedTreeExpandCollapseAction);
} else {
toggleExpandButton.setText("Enable Advanced Expand");
// configure simple action
natTable.getUiBindingRegistry().registerFirstSingleClickBinding(_6045_HierarchicalTreeLayerExample.this.treeImagePainterMouseEventMatcher, _6045_HierarchicalTreeLayerExample.this.simpleTreeExpandCollapseAction);
}
}
});
Button multiReorderButton = new Button(buttonPanel, SWT.PUSH);
multiReorderButton.setText("Reorder Second Level");
multiReorderButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
List<Integer> fromColumnPositions = Arrays.asList(4, 5);
natTable.doCommand(new MultiColumnReorderCommand(natTable, fromColumnPositions, 8));
}
});
Button deleteButton = new Button(buttonPanel, SWT.PUSH);
deleteButton.setText("Delete Row 4");
deleteButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// remove the element
HierarchicalWrapper rowObject = bodyLayerStack.getFilterList().remove(3);
// fire the event to refresh
bodyLayerStack.getBodyDataLayer().fireLayerEvent(new RowDeleteEvent(bodyLayerStack.getBodyDataLayer(), 3));
bodyLayerStack.getTreeLayer().cleanupRetainedCollapsedNodes(rowObject);
}
});
return container;
}
Aggregations