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.

Bug 200991 - ETable ignores customized TableColumnSelector
Summary: ETable ignores customized TableColumnSelector
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.0.1
Hardware: Other Linux
: P2 normal with 3 votes (vote)
Assignee: Martin Entlicher
Depends on:
Reported: 2011-08-16 10:14 UTC by tschlegl
Modified: 2011-11-13 13:23 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

API change with the proposed solution (9.12 KB, patch)
2011-10-31 15:39 UTC, Martin Entlicher
Details | Diff
Modified patch where Boolean is replaced with ColumnSelection enum. (9.30 KB, patch)
2011-11-02 10:50 UTC, Martin Entlicher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tschlegl 2011-08-16 10:14:16 UTC
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.
Comment 1 Martin Entlicher 2011-08-16 13:38:19 UTC
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 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.
Comment 2 tschlegl 2011-08-16 14:10:21 UTC
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()) {

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.
Comment 3 Martin Entlicher 2011-08-16 14:46:34 UTC
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.
Comment 4 tschlegl 2011-08-18 11:04:49 UTC
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.
Comment 5 Martin Entlicher 2011-09-05 13:38:52 UTC
I've modified the logic in changeset:   200891: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.
Comment 6 Quality Engineering 2011-09-06 14:28:33 UTC
Integrated into 'main-golden'
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.
Comment 7 sfilipkov 2011-10-17 23:41:02 UTC
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.
Comment 8 Martin Entlicher 2011-10-31 15:39:13 UTC
Created attachment 112607 [details]
API change with the proposed solution
Comment 9 Martin Entlicher 2011-10-31 15:45:49 UTC
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.
Comment 10 Jesse Glick 2011-10-31 15:57:54 UTC
[JG01] @NullAllowed java.lang.Boolean is not intuitive for this purpose. A @NonNull enum would be clearer.
Comment 11 Martin Entlicher 2011-11-01 16:32:16 UTC
I see. It's true that null Boolean return value is prone to NPEs when unboxed.
I'll change the patch to use Enum...
Comment 12 Martin Entlicher 2011-11-02 10:50:26 UTC
Created attachment 112730 [details]
Modified patch where Boolean is replaced with ColumnSelection enum.
Comment 13 Jesse Glick 2011-11-02 16:04:07 UTC
Add @since on ColumnSelection.
Comment 14 Martin Entlicher 2011-11-02 16:48:26 UTC
Thanks for the notice, it'll be in the committed change set.
Comment 15 Martin Entlicher 2011-11-07 15:44:35 UTC
Thanks for the review, I'll push the change tomorrow.
Comment 16 Martin Entlicher 2011-11-08 10:35:05 UTC
Fixed by changeset:   206540:fd55a151e1e1
Comment 17 Quality Engineering 2011-11-09 16:12:40 UTC
Integrated into 'main-golden'
Log: #200991: Allow more detailed customization of whether popup menu or dialog is displayed to select visible columns.