Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » how to move up/down the row
how to move up/down the row [message #1073561] Thu, 25 July 2013 04:08 Go to next message
cheng shouwu is currently offline cheng shouwuFriend
Messages: 12
Registered: September 2012
Junior Member
Hi Dears:

I am using GridTreeViewer,and now When I select a row in it and want to move it to above the previous row(the same level),what method I can do?
Re: how to move up/down the row [message #1073615 is a reply to message #1073561] Thu, 25 July 2013 07:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Reorder your model and call refresh passing the parent domain object.

Tom

On 25.07.13 06:08, cheng shouwu wrote:
> Hi Dears:
>
> I am using GridTreeViewer,and now When I select a row in it and want to
> move it to above the previous row(the same level),what method I can do?
Re: how to move up/down the row [message #1073649 is a reply to message #1073615] Thu, 25 July 2013 08:35 Go to previous messageGo to next message
cheng shouwu is currently offline cheng shouwuFriend
Messages: 12
Registered: September 2012
Junior Member
yes,I has done with this way,but it can not work correctly.after saved and reopen it,it can show correctly

//itemEntity is one which want to be moved up
//finde the parent
ProjectitemEntity parent = itemEntity.getParent();
//sub items
List<ProjectitemEntity> subItems = parent.getSubItems();
int i = subItems.indexOf(itemEntity);
//above item
ProjectitemEntity aboveItem = subItems.get(i-1);
//reorder
itemEntity.setOrdNo(i-1);
aboveItem.setOrdNo(i);
//refresh
itemTreeGrid.refresh(parent);
Re: how to move up/down the row [message #1073651 is a reply to message #1073649] Thu, 25 July 2013 08:39 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Have you set a ViewerComparator, who tells the viewer to sort your
subitems according to the ordNo?

Tom


On 25.07.13 10:35, cheng shouwu wrote:
> yes,I has done with this way,but it can not work correctly.after saved
> and reopen it,it can show correctly
>
> //itemEntity is one which want to be moved up
> //finde the parent
> ProjectitemEntity parent = itemEntity.getParent();
> //sub items
> List<ProjectitemEntity> subItems = parent.getSubItems();
> int i = subItems.indexOf(itemEntity);
> //above item
> ProjectitemEntity aboveItem = subItems.get(i-1);
> //reorder
> itemEntity.setOrdNo(i-1);
> aboveItem.setOrdNo(i);
> //refresh
> itemTreeGrid.refresh(parent);
Re: how to move up/down the row [message #1073660 is a reply to message #1073649] Thu, 25 July 2013 08:53 Go to previous message
cheng shouwu is currently offline cheng shouwuFriend
Messages: 12
Registered: September 2012
Junior Member
Ha,I have got it

subItems.remove(i-1);
subItems.add(i-1,itemEntity);
subItems.remove(i);
subItems.add(i,aboveItem);
Previous Topic:Copy and Paste in Nebula Grid
Next Topic:GanttEvents from GanntChart?
Goto Forum:
  


Current Time: Sat Nov 09 02:18:43 GMT 2024

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

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

Back to the top