This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
A customized TableColumnSelector, which is assigned to the ETable via setColumnSelector() is not used anymore. I've got the impression that this should be used inside ColumnSelectionPanel.showColumnSelectionDialog() but that method isn't called now like it was until v7.0. Possible solution: Call the new (7.0.1) method ColumnSelectionPanel.showColumnSelectionPopupOrDialog() where ColumnSelectionPanel.showColumnSelectionPopup() is called currently.
Can you please elaborate when you expect the customized TableColumnSelector to be called? It is still used inside ColumnSelectionPanel.showColumnSelectionDialog() method, which did not change in the last 3 years. The behavior was changed by http://hg.netbeans.org/main/rev/1ddde2853a03 as a response to issue #198671. When the right mouse button is pressed, a popup menu is presented always. When the left mouse button is pressed, a dialog or popup menu is presented, depending on table.isPopupUsedFromTheCorner(). showColumnSelectionPopupOrDialog() is called in this case and the custom TableColumnSelector is used when isPopupUsedFromTheCorner() returns false.
I do expect TableColumnSelector's methods called when performing a Button 3 click on the table header. In fact it's not a real mouse event - it's stimulated by calling the mouseClicked() method of the MouseListeners attached to the table header. I did that because i couldn't find a direct way to get called. In v7.0 and v7.0.1 this event caused the call of ColumnSelectionPanel.showColumnSelectionPopup() where in v7.0 the decision was made if showColumnSelectionDialog() should get called: if (! table.isPopupUsedFromTheCorner()) { showColumnSelectionDialog(table); return; } In 7.0.1 this decision was moved to a new method showColumnSelectionPopupOrDialog(). But not all previous calls of showColumnSelectionPopup() are replaced by the new one so i think, this is some kind of regression.
Well O.K. now I get it. I do not think this has a good solution, since there are three kinds of desired behavior, while the API (isPopupUsedFromTheCorner()) allows only two states. The desired behavior is: 1) The popup menu should be shown always (requested by issue #198671) Should be performed when isPopupUsedFromTheCorner() returns true. 2) The popup menu should be shown on mouse right-click (the standard way to invoke context menus) and the dialog should be shown on mouse left-click. This is currently the behavior when isPopupUsedFromTheCorner() returns false, which is the default. 3) The dialog should be shown always (requested by this issue). It was the case when isPopupUsedFromTheCorner() returns false, before issue #198671 was fixed. Strict following of isPopupUsedFromTheCorner() would not allow to implement option 2) which is the most natural IMHO. Therefore we need to enhance the API to be able to distinguish all required behavior.
In fact behaviour 3 is the only way currently to bring the customized column selector in play. The dialog nor the popup should not appear then. I also would prefer an direct access to the TableColumnSelector without dealing with dialog, popup, and MouseEvents on a corner button or table title.
I've modified the logic in changeset: 200891:583f194e3ed3 http://hg.netbeans.org/main/rev/583f194e3ed3 Since it looks very non-standard to invoke dialogs via right mouse click, a menu item is presented, which invokes the column selector. If the table column selector is defined, that menu item is displayed instead of the menu with column selection. I hope that this new behavior fixes this issue. A direct access to TableColumnSelector is via ETable.getColumnSelector() method.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/583f194e3ed3 User: mentlicher@netbeans.org Log: #200991 When a popup menu with column selection is to be displayed, check if TableColumnSelector is defined. If yes, show a menu item that invokes the selector rather than standard selection popup menu.
OK, popup is unusual for some of. But is it usual to remove a feature without leaving any way to use previous behavior? My application is broken by this update. I have too much columns, they just don't fit the scree in popup. And now I have no way to show a more or less standard selector (using two lists and add/remove buttons). Please, at least provide some way to force dialog instead of popup. There are applications where popup is unusable.
Created attachment 112607 [details] API change with the proposed solution
Please review the proposed API change to solve this issue. The two existing methods ETable.isPopupUsedFromTheCorner() and ETable.setPopupUsedFromTheCorner() are not sufficient to cover the functionality. Therefore I propose to add two additional methods: Boolean ETable.isColumnSelectionPopupOn(int mouseButton) and void ETable.setColumnSelectionPopupOn(int mouseButton, Boolean popup) In addition to that, void ETable.showColumnSelectionDialog() is there for programmatic invocation of the column selection dialog.
[JG01] @NullAllowed java.lang.Boolean is not intuitive for this purpose. A @NonNull enum would be clearer.
I see. It's true that null Boolean return value is prone to NPEs when unboxed. I'll change the patch to use Enum...
Created attachment 112730 [details] Modified patch where Boolean is replaced with ColumnSelection enum.
Add @since on ColumnSelection.
Thanks for the notice, it'll be in the committed change set.
Thanks for the review, I'll push the change tomorrow.
Fixed by changeset: 206540:fd55a151e1e1 http://hg.netbeans.org/main/rev/fd55a151e1e1
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/fd55a151e1e1 User: mentlicher@netbeans.org Log: #200991: Allow more detailed customization of whether popup menu or dialog is displayed to select visible columns.