Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Customize/Configure ColumnChooser
Customize/Configure ColumnChooser [message #1817926] Tue, 03 December 2019 09:01 Go to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
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 #1817932 is a reply to message #1817926] Tue, 03 December 2019 09:48 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I think you only need to register a custom configured instance of the DisplayColumnChooserCommandHandler. There you can configure if the available columns should be sorted and provide the IDialogSettings.
Re: Customize/Configure ColumnChooser [message #1817978 is a reply to message #1817932] Tue, 03 December 2019 19:19 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
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 07:19 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
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.
Previous Topic:CellOverrideLabelAccumulator
Next Topic:Sorting a TreeTable at first level
Goto Forum:
  


Current Time: Thu Apr 25 11:40:21 GMT 2024

Powered by FUDForum. Page generated in 1.05856 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top