Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Resizing Columns for a Single Row(When only one row / single row selected, a single column resize resizes all columns)
Resizing Columns for a Single Row [message #1795711] Thu, 27 September 2018 08:29 Go to next message
Martin Schmidt is currently offline Martin SchmidtFriend
Messages: 4
Registered: September 2018
Junior Member
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 13:38]

Report message to a moderator

Re: Resizing Columns for a Single Row [message #1795744 is a reply to message #1795711] Thu, 27 September 2018 15:40 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2695
Registered: July 2012
Senior Member
To clarify the statement. There is no such thing like a column or row selection mode in NatTable. There is no tracking how something was selected. There is only a selection state, and from this state the behaviour is derived.

If you or your users have a problem with this behavior or you think this is incorrect, you have various options:

a) override the behaviour locally in your project. The API should be open enough
b) create a ticket and provide a patch that corrects the behaviour
c) ask for sponsored support

Complaining on Stackoverflow or in a forum was never a trigger to get things changed in an open source project.
Re: Resizing Columns for a Single Row [message #1795757 is a reply to message #1795744] Fri, 28 September 2018 06:10 Go to previous messageGo to next message
Martin Schmidt is currently offline Martin SchmidtFriend
Messages: 4
Registered: September 2018
Junior Member
Sounds a little bit sore, which I wasn't supposed to achieve. I was not complaining, I had good intentions while doing that.

I simply was on a research, posted my "hack" (as you told it a little bit unfriendly) and was responding to your answer (sorry for not agreeing with you).

I know that there is no such a selection mode, otherwise I would not have posted this topic.

Best, Martin
Re: Resizing Columns for a Single Row [message #1795759 is a reply to message #1795757] Fri, 28 September 2018 06:34 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2695
Registered: July 2012
Senior Member
I called it a hack, because it is a quick fix without knowing the impacts. And you called it yourself "dirty" which is for me the same meaning.

I don't have a problem that someone does not agree with me. That is the process in software development, and the software never gets better if nobody complains. I just don't like the way. In both posts you directly mentioned my name, telling that you disagree to me in person. And that is something I take personal if people are talking about me in public posts. That is the reason for my reaction. And also as the project lead I see it in my responsibility to answer posts related to my project in our public forum.

For me your intention and expectation is still not clear. In two places you are complaining or discussing that topic. But what is the expected outcome? You see an error, your users see an error. Okay, in the end your users are right, because you write software for them. But what do you expect from me? Should I immediately start and do something that might be not that easy as there is no such thing as a selection mode? Why should I do that? I explained that I do not see this as a bug as the design is that way. Therefore there is no need for me to do something urgently. And I gave you the possible options what you can do to satisfy your customers. Until you do start any official actions like a bug report and providing a patch, there seems to be nothing to do for me.
Re: Resizing Columns for a Single Row [message #1795761 is a reply to message #1795759] Fri, 28 September 2018 07:02 Go to previous messageGo to next message
Martin Schmidt is currently offline Martin SchmidtFriend
Messages: 4
Registered: September 2018
Junior Member
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 07:09]

Report message to a moderator

Re: Resizing Columns for a Single Row [message #1795763 is a reply to message #1795761] Fri, 28 September 2018 07:34 Go to previous message
Martin Schmidt is currently offline Martin SchmidtFriend
Messages: 4
Registered: September 2018
Junior Member
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 07:37]

Report message to a moderator

Previous Topic:NatTable eample EditorExmple not visible in Composite (ViewPart Eclipse 3.7)
Next Topic:How to restore default value after setting a css property
Goto Forum:
  


Current Time: Tue Jul 16 02:18:23 GMT 2019

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

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

Back to the top