Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » ColumnReorder causes incorrect
ColumnReorder causes incorrect [message #1721568] Thu, 28 January 2016 10:58 Go to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
Prequesites:
NatTable with multiple Columns of this dataTypes eg:
String, String, Calendar, String

So Calendar needs its own LabelAccumulator (i hope i remember this right - this transforms the Object to the displayed String) whereat the Strings do not need it, as they are Strings already.

In my case the Calendar gets rendered to "day.month.year" eg 28.01.2016.

so far so good.
if i now reorder the columns by drag and drop within NatTable all is fine and perfect, but if i reorder the Columns programmatically, the LabelAccumulators get fucked up.

What does this mean?
The order of the Columns gets changed correctly, but the Accumulators do not get reordered.
means that my Calendar does not get rendered correctly and it displays its default .toString() which ends in akward crap Wink

My NatTable has a default org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer and i call the reorder like this:

getColumnReorderLayer().reorderColumnPosition(from, to);


NOTE: it also seems that the column Positions are incorrect (probably this is causing all the mess?)

as i do not exclude mistakes on my side my question is:
Did i forget a method call?
If you need any more information let me know. i'm willed to Test!
Re: ColumnReorder causes incorrect [message #1721578 is a reply to message #1721568] Thu, 28 January 2016 12:17 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Maybe it is an issue with the index-position transformation.

Typically you shouldn't call methods on the layers directly. You might miss some necessary transformations or additional actions on the way. NatTable uses a command pattern. This means you are telling NatTable that a command should be executed, and if a command handler is registered, the execution is performed.

So I suggest you try to execute the ColumnReorderCommand instead of operating on the layer directly.
Re: ColumnReorder causes incorrect [message #1721676 is a reply to message #1721578] Fri, 29 January 2016 07:01 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
i now tried executing the ColumnReorderCommand.
I hope i do this right:
		ColumnReorderCommand cmdReorder = new ColumnReorderCommand(getColumnReorderLayer(), from, to); // [1]
		//ColumnReorderCommand cmdReorder = new ColumnReorderCommand(getBodyLayerStack(), from, to); // [2]
		natTable.doCommand(cmdReorder);
		natTable.refresh();

i'm not sure which iLayer to pass here (no information about this in doc) so i guess its the ColumnReorderLayer @see [1] or the BodyLayerStack @see [2]

here some screenshots:
this is where we start:
index.php/fa/24813/0/

this is the expected result (when dragged with column header)
index.php/fa/24814/0/

and this is the result via Command
index.php/fa/24815/0/

but the result is not better! now the ColumnAccessors seem to change, but the Column does not Reorder!
Re: ColumnReorder causes incorrect [message #1721680 is a reply to message #1721676] Fri, 29 January 2016 07:40 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
It needs to be the layer to which the column position matches.

The refresh should not be necessary since it is done in the command handling.

At which level do you add the labels. Maybe there is the issue because of wrong index position handling.
Re: ColumnReorder causes incorrect [message #1721888 is a reply to message #1721680] Mon, 01 February 2016 10:57 Go to previous message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
Dirk Fauth wrote on Fri, 29 January 2016 02:40
Maybe there is the issue because of wrong index position handling.


i cant really tell what happened, but it seems that the index got updated twice in a layer (i changed my index manually on my beans and then updated the tables column order, which changed my index beans back.) weird stuff.
now i do tell the table to reorder and listen to reorder events which then get processed to my index beans.
works now, but i cant exactly tell where the mistake was. but i guess it was somewhere in MY code, which synchronizes Formular and Table via those index beans.

Thanks!
Previous Topic:NatTable JavaFX
Next Topic:Exception in NatTable
Goto Forum:
  


Current Time: Fri Mar 29 07:25:10 GMT 2024

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

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

Back to the top