Skip to main content



      Home
Home » Eclipse Projects » NatTable » User resizing of columns is wrong
User resizing of columns is wrong [message #1852995] Tue, 14 June 2022 05:50 Go to next message
Eclipse UserFriend
Hi,

I have a table with 20 columns. Number 4 is programmatically frozen (last post issue). Now I want to resize the columns using the mouse. It works fine for the columns before the frozen one. If I resize the one number 5, it resizes yet number 0. So, the user event triggers the action with the wrong targeted column..

Any Idea What I am missing?

Thank you!
Mokhtar

[Updated on: Tue, 14 June 2022 05:51] by Moderator

Re: User resizing of columns is wrong [message #1852997 is a reply to message #1852995] Tue, 14 June 2022 06:54 Go to previous messageGo to next message
Eclipse UserFriend
Sorry, but without an example to see what is happening and how the composition looks like, I can't say anything. Similar to the last question where several details were missing in the description.

The only thing I could think of is that the column 0 is selected, as a resize operation will resize all selected columns if they are fully selected. But again, without more details I can't say anything helpful.
Re: User resizing of columns is wrong [message #1853000 is a reply to message #1852997] Tue, 14 June 2022 07:51 Go to previous messageGo to next message
Eclipse UserFriend
I am really new for all that. Can you help me a bit to understand how the selection and resize operation are all together wired up? w.r.t the layers, nattable .. so that I could get deeper to find how the index/selection is done. Just keywords to the classes etc. Then maybe I can find in my legacy project some configuration step missing.. The gap between the previous 1.5 version of Nattable and this 2.0.2 is apparently big. Thank you!
Re: User resizing of columns is wrong [message #1853001 is a reply to message #1853000] Tue, 14 June 2022 08:01 Go to previous messageGo to next message
Eclipse UserFriend
At this page you find some articles and introduction videos on NatTable: https://www.eclipse.org/nattable/documentation.php?page=articles

Probably the Getting Started Tutorial @ vogella might be interesting: https://www.vogella.com/tutorials/NatTable/article.html

Of course the gap between 1.5 and 2.0.2 is big. It is about 4 years of development in between!

Actually I am not able to give you support via forum in that detailed level. And your error description is not good enough so I could help easily. If you need professional support, I offer consulting services around NatTable.
Re: User resizing of columns is wrong [message #1853153 is a reply to message #1853001] Mon, 20 June 2022 13:44 Go to previous messageGo to next message
Eclipse UserFriend
The service offer would be my option for the case i can decide. But thank you for the hint.

I came up with this solution
 @Override
    public int localToUnderlyingColumnPosition(int localColumnPosition) {
        return localColumnPosition;
    }


I removed the super implementation as it always leads to Column number 1 instead of say 5.

I couldn't prepare any reproducer that will not work. Not because I don't understand well but because the framework is so unhappily deep ad complicated. I have been debugging until the mouseup event handler upward but no way. Comparing to the example from the Nattable Docs, The only weird thing is that the order of the layers is different.
Re: User resizing of columns is wrong [message #1853156 is a reply to message #1853153] Mon, 20 June 2022 23:26 Go to previous messageGo to next message
Eclipse UserFriend
Your solution is very risky as it could break other stuff.

For some scenarios the order of the layers are important. I don't know which layers you are talking about, but I would try to change the layer order instead of overwritting internals.
Re: User resizing of columns is wrong [message #1853189 is a reply to message #1853156] Wed, 22 June 2022 05:38 Go to previous messageGo to next message
Eclipse UserFriend
They used almost the same layer architecture like in _513_FreezeExample extends AbstractNatExample except of some wrappers but at the end it goes: new NatTable(GridLayer, Composite) and GridLayer is like in the example. DataLayer is then a construct that carries the model out of an EMF based datasource.
In the example, when the logic reaches SelectionLayer, it then still remembers what column was that in the datalayer. In my case, the selectionLayer has col=1 (instead of 5) which is correct for this layer but then the same logic can't remember to go back to 5.
What I have done is then to give it the 5 explicitly (see the method in prev post).
I did my override inside the PLRCompositeFreezeLayer extends CompositeFreezeLayer which might be custom; therefore okay for a non complicated usage of the table in my case.
In general, the fact that the developer handles this core UI stuff herself is frustrating and not getting better...
Re: User resizing of columns is wrong [message #1853192 is a reply to message #1853189] Wed, 22 June 2022 07:49 Go to previous messageGo to next message
Eclipse UserFriend
I have no idea what you are talking about. It sounds like the position transformation is not working correctly, but in all of our examples and test cases it works correctly. I can't tell what is wrong on your side, and actually such "customizations" and overrides could be a cause in the end.

Quote:
In general, the fact that the developer handles this core UI stuff herself is frustrating and not getting better...


I'm not sure if you are blaming me and the NatTable framework. You call it "core UI stuff" but from my point of view this is a very powerful, feature rich and therefore unfortunately complicated widget framework to create rich tables. Compared to any UI framework I know, there is nothing comparable. If people tend to think they know everything better and override stuff themselves without knowing and understanding the concepts, then they have to find out themselves what is going wrong. From my point of view the framework works as intended and is used by many projects. The problems you describe here have not been reported ever before. So I doubt that the issue is in NatTable, as you are not even able to create something that would reproduce the issue.
Re: User resizing of columns is wrong [message #1853198 is a reply to message #1853189] Wed, 22 June 2022 10:13 Go to previous messageGo to next message
Eclipse UserFriend
to close this up, I solved the problem so far by just cleaning out another forgotten method from within the compositeLayer class.

EDIT: re-phrasing the above sentence: I mean by removing the following method.

@Override
    public Collection<ILayer> getUnderlyingLayersByColumnPosition(int columnPosition) {
        Collection<ILayer> underlyingLayers = new HashSet<ILayer>();
        underlyingLayers.add(this.selectionLayer);
        return underlyingLayers;
    }


The issues are solved (Freeze programmatically, Resize Column manually)

Thank you!

[Updated on: Wed, 22 June 2022 10:39] by Moderator

Re: User resizing of columns is wrong [message #1853199 is a reply to message #1853198] Wed, 22 June 2022 10:22 Go to previous messageGo to next message
Eclipse UserFriend
For anyone coming across this topic: DON'T DO THIS!

If you override the method getUnderlyingLayersByColumnPosition(int) from the CompositeLayer the way shown above, YOU ACTUALLY BREAK the composition concept of that layer!

The CompositeLayer composes layer stacks in regions. So you get different layer stacks based on the column position. The CompositeFreezeLayer has four regions to support freezing columns and rows. If no freeze is active, every column will return the same layer stack. With the above snippet this concept is broken and the freeze states are not handled correctly!
Re: User resizing of columns is wrong [message #1853200 is a reply to message #1853192] Wed, 22 June 2022 10:33 Go to previous messageGo to next message
Eclipse UserFriend
Dirk Fauth wrote on Wed, 22 June 2022 11:49
I have no idea what you are talking about. It sounds like the position transformation is not working correctly, but in all of our examples and test cases it works correctly. I can't tell what is wrong on your side, and actually such "customizations" and overrides could be a cause in the end.

Quote:
In general, the fact that the developer handles this core UI stuff herself is frustrating and not getting better...


I'm not sure if you are blaming me and the NatTable framework. You call it "core UI stuff" but from my point of view this is a very powerful, feature rich and therefore unfortunately complicated widget framework to create rich tables. Compared to any UI framework I know, there is nothing comparable. If people tend to think they know everything better and override stuff themselves without knowing and understanding the concepts, then they have to find out themselves what is going wrong. From my point of view the framework works as intended and is used by many projects. The problems you describe here have not been reported ever before. So I doubt that the issue is in NatTable, as you are not even able to create something that would reproduce the issue.


That you brought it, take this:
- Any UI framework/library that is not declarative by definition is just a pain.
- And any even declarative UI framework that is in Java (even worse eclipse) based is a more pain.
- HTML, CSS & JS (e.g. React) is there!
I blame the whole RCP/Eclipse ecosystem.
Re: User resizing of columns is wrong [message #1853201 is a reply to message #1853199] Wed, 22 June 2022 10:40 Go to previous message
Eclipse UserFriend
Dirk Fauth wrote on Wed, 22 June 2022 14:22
For anyone coming across this topic: DON'T DO THIS!

If you override the method getUnderlyingLayersByColumnPosition(int) from the CompositeLayer the way shown above, YOU ACTUALLY BREAK the composition concept of that layer!

The CompositeLayer composes layer stacks in regions. So you get different layer stacks based on the column position. The CompositeFreezeLayer has four regions to support freezing columns and rows. If no freeze is active, every column will return the same layer stack. With the above snippet this concept is broken and the freeze states are not handled correctly!


This is what I wrote: cleaning out. I added an "EDIT" to emphasize that I removed the override. I didn't tell that snippet is the solution. removing it is. so is your warning.
Previous Topic:Combo boxes for items with identical string representation
Next Topic:Stop horizontal scrolling when extending selection mit Down-key
Goto Forum:
  


Current Time: Thu May 22 19:46:20 EDT 2025

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

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

Back to the top