Home » Eclipse Projects » NatTable » Best Practice about uncommon table layout(How to add an area between header and body)
Best Practice about uncommon table layout [message #1768464] |
Wed, 19 July 2017 02:51  |
Eclipse User |
|
|
|
Hi There!
I need to create a Table where it is possible to apply some input to all data in a given row. (and this shall be possible for all rows in the table).
e.g.
-) the user should be able to define all row values to be reported
-) the user should be able to apply a label to all row entries.
Visually this would be an area between the Column Header and the BODY. This area would contain two rows - one with a checkbox, and one with a combobox (showing the list of available labels).
I call this the "SettingsLayer". Of course the settings layer needs to be editable, and the values provided using setDataValue() would be propagated to the row elements.
Now I have several ideas how I could implement this behavior - but I'd like to know how persons kowing NatTable way better then me would implement it.
1. Use DefaultGridLayout and somehow extend the header area (similar to how the filter row is added)
2. Use DefaultGridLayout create a Composite of the "SettingsLayer" and the BodyLayer.
3. Do not use the DefaultGridLayout but create a "MyOwnGridLayout" being a (2,3) Composite. Then of course I'd have to do all the default stuff (key bindings etc.) on my own.
I'm quite new to Nattable (use it for a month now), but I think I understand the basic concepts. In this area I simply don't want to move into the wrong direction, so any hint would be appreciated.
Regards,
Chris
|
|
| | | | |
Re: Best Practice about uncommon table layout [message #1768575 is a reply to message #1768572] |
Thu, 20 July 2017 03:43   |
Eclipse User |
|
|
|
Well - if I understand correctly the benefit of the GridLayer is not just the simplification for a 2,2 composite, but also lots of default event handling seems to be done there - exactly the area where I seem to have problems with the checkboxes not being drawn.
Further we have already quite some code (NatTableBuilder classes etc) which internally use GridLayer, and I have to change all these in order to apply our new feature (possibly introducing problems this way, as I forget some event handlers or such).
About events not being fired: in my sample I use the following two classes as configuration on the SETTINGS area. Do you see something which I am obviously missing?
static class EditAreaEditBindings extends AbstractUiBindingConfiguration {
public static final String SETTINGS_REGION = "SETTINGS_REGION";
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
uiBindingRegistry.registerSingleClickBinding(
new CellEditorMouseEventMatcher(SETTINGS_REGION),
new MouseEditAction());
uiBindingRegistry.registerMouseDragMode(
new CellEditorMouseEventMatcher(SETTINGS_REGION),
new CellEditDragMode());
uiBindingRegistry.registerFirstSingleClickBinding(
new CellPainterMouseEventMatcher(SETTINGS_REGION, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class),
new MouseEditAction());
uiBindingRegistry.registerFirstMouseDragMode(
new CellPainterMouseEventMatcher(SETTINGS_REGION, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class),
new CellEditDragMode());
}
}
static class EditingConfig extends AbstractRegistryConfiguration {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE,
IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT,
ViewSPRPartV1.EDIT_ACTIVE_LABEL);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE,
IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT,
ViewSPRPartV1.EDIT_POSITIVE_CONTROL_LABEL);
List<String> controlValues = Arrays.asList("PosCtrl 1", "PosCtrl 2", "PosCtrl 3");
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR,
new ComboBoxCellEditor(controlValues), DisplayMode.EDIT,
ViewSPRPartV1.EDIT_POSITIVE_CONTROL_LABEL);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new ComboBoxPainter(),
DisplayMode.NORMAL, ViewSPRPartV1.EDIT_POSITIVE_CONTROL_LABEL);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CheckBoxCellEditor(),
DisplayMode.EDIT, ViewSPRPartV1.EDIT_ACTIVE_LABEL);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CheckBoxPainter(),
DisplayMode.NORMAL, ViewSPRPartV1.EDIT_ACTIVE_LABEL);
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER,
new DefaultBooleanDisplayConverter(), DisplayMode.NORMAL,
ViewSPRPartV1.EDIT_ACTIVE_LABEL);
}
}
|
|
| | | | | | |
Re: Best Practice about uncommon table layout [message #1771439 is a reply to message #1771424] |
Fri, 25 August 2017 02:05  |
Eclipse User |
|
|
|
Well - I fully understand your point, thanks a lot anyways for the time you invest here on the forums. Going to ask my boss whether we can get some funding.
Btw - just in case you are curious - as the same data provider gets invoked with different indices in getDataValue and setDataValue I expected a possible bug in NatTable - that's why i tried to help with this sample.
I have a workaround for that (doing the index transformation on my own in the setter).
So again - sorry if I was using your time too much, it for sure wasn't my intention.
|
|
|
Goto Forum:
Current Time: Wed Jul 23 11:05:12 EDT 2025
Powered by FUDForum. Page generated in 0.09477 seconds
|