Customize/Configure ColumnChooser [message #1817926] |
Tue, 03 December 2019 04:01  |
Eclipse User |
|
|
|
I hava a nattable in my application with an PopupMenu
i add the column chooser menu item via PopupMenueBuilder
PopupMenuBuilder.withColumnChooserMenuItem()
the Column Chooser is kind of small (dialog size)
and the items appear in a non sorted order (or probably sorted by a wrong property...)
is there an easy way to configure this without downloading the source code and altering it in place?
i noticed setDialogSettings for the columnChooser but as the ColumnChooser gets created via the PopupMenuBuilder i have no possibility to add parameters.
do i have to create a custom command and a custom implementation for the ColumnChooser?
|
|
|
|
Re: Customize/Configure ColumnChooser [message #1817978 is a reply to message #1817932] |
Tue, 03 December 2019 14:19   |
Eclipse User |
|
|
|
ok, i tried to copy the whole package of org.eclipse.nebula.widgets.nattable.columnChooser
and created package org.eclipse.nebula.widgets.nattable.columnChooser.bio
i prefixed all classes with Bio and Override all methods which need modifications - this is the most offensive solution i can see.
then unregistered the old
natTable.unregisterCommandHandler(DisplayColumnChooserCommand.class);
register my own handler
natTable.registerCommandHandler(new BioDisplayColumnChooserCommandHandler(
getBodyLayerStack().getSelectionLayer(),//SelectionLayer selectionLayer
getBodyLayerStack().getColumnHideShowLayer(),//ColumnHideShowLayer columnHideShowLayer
columnHeaderLayerStack.getColumnHeaderLayer(),// ColumnHeaderLayer columnHeaderLayer
getBodyLayerStack().groupByDataLayer, // DataLayer columnHeaderDataLayer
columnHeaderLayerStack.columnGroupHeaderLayer,// ColumnGroupHeaderLayer cgHeader
columnGroupModel,//ColumnGroupModel columnGroupModel
true,
true
));
after this my Bio*Handler gets created, but still the OLD dialog opens...
|
|
|
Re: Customize/Configure ColumnChooser [message #1818007 is a reply to message #1817978] |
Wed, 04 December 2019 02:19  |
Eclipse User |
|
|
|
1. It seems you hit a bug with sorting and column groups in the tree for available columns in the ColumnChooser. Although you did not mention this explicitly, it seems this is the issue you are talking about. I have created the following ticket for this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=553731
2. The dialog size can be adjusted via IDialogSettings like this:
// Register column chooser
DisplayColumnChooserCommandHandler columnChooserCommandHandler =
new DisplayColumnChooserCommandHandler(
bodyLayer.getSelectionLayer(),
bodyLayer.getColumnHideShowLayer(),
columnHeaderLayer,
columnHeaderDataLayer,
columnGroupHeaderLayer,
this.columnGroupModel,
true);
IDialogSettings settings = new DialogSettings("columnChooser");
settings.put("DIALOG_WIDTH", 800);
settings.put("DIALOG_HEIGHT", 600);
columnChooserCommandHandler.setDialogSettings(settings);
bodyLayer.registerCommandHandler(columnChooserCommandHandler);
3. The DisplayColumnChooserCommandHandler is not registered by default anywhere in NatTable. It needs to be done programmatically on demand. That means, if still the default dialog opens in your case, you have somewhere registered the DisplayColumnChooserCommandHandler in your code which overrides your modified version. That said, please check your configuration/code.
|
|
|
Powered by
FUDForum. Page generated in 0.03523 seconds