Resizing Columns for a Single Row [message #1795711] |
Thu, 27 September 2018 04:29  |
Eclipse User |
|
|
|
Sczenario:
- User creates the first row in a table by clicking some Add Button. The client code selects the row because of master/details requirements
- Then the user tries to resize ONE column (with mouse / in header) because he/she wants to bring more columns into the viewport
- The result is that ALL columns are resized
We became a ticket from our testers / customers that this behavior feels wrong (Bug entry)
There is also a discussion on stackoverflow refering to this theme
//stackoverflow.com/questions/42826582/auto-resizing-nattable-for-single-row-in-eclipse-rcp-application
My input is, that there should be two selection modes:
a) Column Selection Mode
b) Row Selection Mode
whereas the last user-interaction defines the mode.
In Column Selection Mode (user selects all columns by mouse/header) the current behavior is correct
In Row Selection Mode the detection of the method SelectionLayer#isColumnPositionFullySelected should return false, in order to prevent all columns beeing resized when only one is resized by the user.
Since Dirk Fauth thinks that the current behavior is consitent/correct, but other people don't think so, I crated a forum thread instead of a bug entry.
Reproducable with the FilterRowGridExample and a modification in the class FilterRowExampleGridLayer:
public FilterRowExampleGridLayer(IConfigRegistry configRegistry) {
super(true);
// Underlying data source
EventList<RowDataFixture> eventList = GlazedLists.eventList(RowDataListFixture.getList(1));
...
(When running this example, you have to select the row manually (most left column) to see that.)
[Updated on: Thu, 27 September 2018 09:38] by Moderator
|
|
|
|
|
|
Re: Resizing Columns for a Single Row [message #1795761 is a reply to message #1795759] |
Fri, 28 September 2018 03:02   |
Eclipse User |
|
|
|
Again, I never had the intention to complain. I was spending some hours of understanding that problem, searching the web. (I found (typically) a stacktrace-forum entry), seeing your reply. Since we were not in the situation to provide a patch (because of an ongoing rollout), I tried to follow your suggestion to override SelectionLayer properly. I found
protected boolean handleColumnResizeCommand(ColumnResizeCommand command) {
if (isColumnPositionFullySelected(command.getColumnPosition())) {
return super.doCommand(
new MultiColumnResizeCommand(this,
this.selectionModel.getFullySelectedColumnPositions(getRowCount()),
command.getNewColumnWidth()));
} else {
return super.doCommand(command);
}
}
as a candidate. Since overriding that brought me to a one-way road (not able to pass the command to the super-class of the SelectionLayer class in a subclass; didn't want to use bytcode-weaving), the only solution for the moment was to overide isColumnPositionFullySelected for the moment.
I even analyzed the isColumnPositionFullySelected method and found out, that the determination of the question is to check if the whole body is selected, which is in my opinion not valid (sorry again fir disagreeing).
My intention is to provide a patch for the configuration of the selection layer (establishing a configuration-property to switch off multi-resize), because establishing two selection modi is too expensive at the moment.
(In your role) As the project lead I ask you kindly to think again over the current solution. It may be consistent in the scope of the current NatTable code, but I think the problem is worth of some thoughts by you. Remember, I am not the only one who stumbled over that.
Yours sincerely,
Martin Schmidt
[Updated on: Fri, 28 September 2018 03:09] by Moderator
|
|
|
Re: Resizing Columns for a Single Row [message #1795763 is a reply to message #1795761] |
Fri, 28 September 2018 03:34  |
Eclipse User |
|
|
|
For other people, here is my stack-overflow reply for a quick fix.
BEGIN:
I find the answer of Dirk not really valid.
I think the selection of body-rows/cells has nothing to do with the selection of the header region. The selection of all columns (let's say by selecting the columns with their headers-rectangles) is something completly different as selecting a data-row.
However, I found a quick fix which turns off all the multi-hide, -resize and -clear functionality very easily. This may be a little bit dirty, but it helped me for the first:
class MySelectionLayer extends SelectionLayer {
public MySelectionLayer(IUniqueIndexLayer underlyingLayer) {
super(underlyingLayer);
}
@Override
public boolean isColumnPositionFullySelected(int columnPosition) {
return false;
}
}
;END
[Updated on: Fri, 28 September 2018 03:37] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04222 seconds