Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » MultiRowHideCommand
MultiRowHideCommand [message #1010744] Mon, 18 February 2013 06:59 Go to next message
Martin Jacob is currently offline Martin Jacob
Messages: 116
Registered: July 2009
Senior Member
Hi,

in my application I have a master detail pattern and hide rows depending on the selection in the master.
When calling MultiRowHideCommand twice editing of the first row was blocked. It seams to be a bug if
calling MultiRowHideCommand and already hidden rows as parameter.
My workaround is to call first ShowAllRowsCommandand then MultiRowHideCommand.

Or may be my NatTable configuration is not as it should be?

my body layer stack is as follow:
public BodyLayerStack(IDataProvider dataProvider) {
bodyDataLayer = new DataLayer(dataProvider, 150, 20);
rowHideShowLayer = new RowHideShowLayer(bodyDataLayer);
selectionLayer = new SelectionLayer(rowHideShowLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
setUnderlyingLayer(viewportLayer);
}


and the row layer stack

public class RowHeaderLayerStack extends AbstractLayerTransform {

public RowHeaderLayerStack(IDataProvider dataProvider, BodyLayerStack pBodyLayer) {
DataLayer dataLayer = new DataLayer(dataProvider, 200, 20);
RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(dataLayer, pBodyLayer,
pBodyLayer.getSelectionLayer());
setUnderlyingLayer(rowHeaderLayer);
}
}


Martin
Re: MultiRowHideCommand [message #1010771 is a reply to message #1010744] Mon, 18 February 2013 08:04 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1338
Registered: July 2012
Senior Member
Hi,

I think the RowHideShowLayer was created to add support of row groups to the NatTable. I'm not sure if it was intended and tested to add a similar action as column hide/show.

Nevertheless, this is something to take a closer look at. So it might be that this is a bug, so please create a ticket for this. I hope I can fix it before the 1.0.0 release which shouldn't be that far away.

In your special case, why do you use the RowHideShowLayer and not a filter? Do you use GlazedLists in your composition? Then I really suggest to use filters together with the DefaultGlazedListsStaticFilterStrategy which allows you to add a static filter together with the filters applied by the filter row.
If you don't use GlazedLists you would need to implement such a filter yourself for the moment. This is some missing feature to add filters without GlazedLists. But that's on our ToDo list.

Hope that helps,
Dirk
Re: MultiRowHideCommand [message #1010825 is a reply to message #1010771] Mon, 18 February 2013 09:52 Go to previous messageGo to next message
Martin Jacob is currently offline Martin Jacob
Messages: 116
Registered: July 2009
Senior Member
Hi Dirk,

I do not use GlazedLists but I got it work with the workaround as described in the first email of
this thread.

I did not have a closer look on filters. But I understand as long as I do not use GlazedLists it
wont help me much. So the 2workaround" works fine for me. Might be not the best performance but as I
have only a few rows its got no problem.

follow up on: https://bugs.eclipse.org/bugs/show_bug.cgi?id=401058

Martin

schrieb Dirk Fauth, Am 18.02.2013 09:04:
> Hi,
>
> I think the RowHideShowLayer was created to add support of row groups to the NatTable. I'm not sure
> if it was intended and tested to add a similar action as column hide/show.
>
> Nevertheless, this is something to take a closer look at. So it might be that this is a bug, so
> please create a ticket for this. I hope I can fix it before the 1.0.0 release which shouldn't be
> that far away.
>
> In your special case, why do you use the RowHideShowLayer and not a filter? Do you use GlazedLists
> in your composition? Then I really suggest to use filters together with the
> DefaultGlazedListsStaticFilterStrategy which allows you to add a static filter together with the
> filters applied by the filter row. If you don't use GlazedLists you would need to implement such a
> filter yourself for the moment. This is some missing feature to add filters without GlazedLists. But
> that's on our ToDo list.
>
> Hope that helps,
> Dirk
Re: MultiRowHideCommand [message #1010828 is a reply to message #1010825] Mon, 18 February 2013 10:00 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1338
Registered: July 2012
Senior Member
Well if you don't have much rows you can also try to use AbstractFilterListDataProvider. Implementing this instead of the default ListDataProvider gives you the opportunity to filter directly. In terms of performance it doesn't scale well with large datasets. This is one of those issues regarding filtering that I need to look at. But I used this in some of my projects that only show a few rows. There it works fine.

Nevertheless I will take a look at the bug soon. Thanks for reporting and creating the ticket.
Re: MultiRowHideCommand [message #1010841 is a reply to message #1010828] Mon, 18 February 2013 10:20 Go to previous messageGo to next message
Martin Jacob is currently offline Martin Jacob
Messages: 116
Registered: July 2009
Senior Member
My data provider just implements IDataProvider as I have more than on object type (class) in my rows.
As I understand ListDataProvider shall have the same object type in each row.

Any way for now it works well and right now not much time to "research".

Thanks, Martin


schrieb Dirk Fauth, Am 18.02.2013 11:00:
> Well if you don't have much rows you can also try to use AbstractFilterListDataProvider.
> Implementing this instead of the default ListDataProvider gives you the opportunity to filter
> directly. In terms of performance it doesn't scale well with large datasets. This is one of those
> issues regarding filtering that I need to look at. But I used this in some of my projects that only
> show a few rows. There it works fine.
>
> Nevertheless I will take a look at the bug soon. Thanks for reporting and creating the ticket.
Re: MultiRowHideCommand [message #1016192 is a reply to message #1010841] Tue, 05 March 2013 12:44 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1338
Registered: July 2012
Senior Member
Hi,

I can not reproduce your issue. The layer stack composition looks good. I think the issue is related on how you call the MultiRowHideCommand.

Please provide the information how you execute the command, so I can determine whether it is a bug or a wrong usage of the command.

Greez,
Dirk
Re: MultiRowHideCommand [message #1016429 is a reply to message #1016192] Wed, 06 March 2013 12:36 Go to previous messageGo to next message
Martin Jacob is currently offline Martin Jacob
Messages: 116
Registered: July 2009
Senior Member
Hi,

I call the command in the following way:

treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

......
natTable.doCommand(new MultiRowHideCommand(bodyLayer.getSelectionLayer(), lHide));

.....
}


Martin


schrieb Dirk Fauth, Am 05.03.2013 13:44:
> Hi,
>
> I can not reproduce your issue. The layer stack composition looks good. I think the issue is related
> on how you call the MultiRowHideCommand.
>
> Please provide the information how you execute the command, so I can determine whether it is a bug
> or a wrong usage of the command.
>
> Greez,
> Dirk
Re: MultiRowHideCommand [message #1016433 is a reply to message #1016429] Wed, 06 March 2013 12:55 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1338
Registered: July 2012
Senior Member
Changed my testcase to look like your code (except the TreeViewer stuff). It still works as intended and I can not reproduce your issue.

Are you aware of the fact that you are hiding row positions and not indexes? And are you doing additional stuff after hiding rows that may have impact?
Re: MultiRowHideCommand [message #1016901 is a reply to message #1016433] Fri, 08 March 2013 07:33 Go to previous messageGo to next message
Martin Jacob is currently offline Martin Jacob
Messages: 116
Registered: July 2009
Senior Member
Well I am not sure about the wording index respective position. I use the row number according to
the rows BodyDataProvider. May be this is not what it should be? Should I somehow convert the row
number to position respective index?

The command is the last code line in the selectionChangeListener.


schrieb Dirk Fauth, Am 06.03.2013 13:55:
> Changed my testcase to look like your code (except the TreeViewer stuff). It still works as intended
> and I can not reproduce your issue.
>
> Are you aware of the fact that you are hiding row positions and not indexes? And are you doing
> additional stuff after hiding rows that may have impact?
Re: MultiRowHideCommand [message #1016912 is a reply to message #1016901] Fri, 08 March 2013 08:09 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1338
Registered: July 2012
Senior Member
Well, the hide commands take the position. Concerning the RowHideShowLayer this means that the positions you are using to hide are related to the visible rows.

For example:

You hide row at position 1 ... without any other transformation like filtering or sorting, this means the row with index 1 (concerning the data provider) will be hidden.
Afterwards the row at position 1 is the row with index 2.

If you are now trying to hide the row at index 2, you will in fact tell to hide the row at index 3 because what you are really trying to do is to hide the row at position 1.

Hope my explanation works out for you. I have a flu so some things might sound confusing.

Maybe this helps in further understanding: http://eclipse.org/nattable/documentation.php?page=layer

At least now it seems to be misusage instead of a bug.

Greez,
Dirk
Re: MultiRowHideCommand [message #1017136 is a reply to message #1016912] Sat, 09 March 2013 19:12 Go to previous message
Martin Jacob is currently offline Martin Jacob
Messages: 116
Registered: July 2009
Senior Member
Hi Dirk,

yes u are right its a misuse of the command. I took in deed the index instead of the position.
Understand now the matter and I have to be careful in the future about position and index.

Thanks and Gute Besserung, Martin


schrieb Dirk Fauth, Am 08.03.2013 09:09:
> Well, the hide commands take the position. Concerning the RowHideShowLayer this means that the
> positions you are using to hide are related to the visible rows.
>
> For example:
>
> You hide row at position 1 ... without any other transformation like filtering or sorting, this
> means the row with index 1 (concerning the data provider) will be hidden.
> Afterwards the row at position 1 is the row with index 2.
>
> If you are now trying to hide the row at index 2, you will in fact tell to hide the row at index 3
> because what you are really trying to do is to hide the row at position 1.
>
> Hope my explanation works out for you. I have a flu so some things might sound confusing.
>
> Maybe this helps in further understanding: http://eclipse.org/nattable/documentation.php?page=layer
>
> At least now it seems to be misusage instead of a bug.
>
> Greez,
> Dirk
Previous Topic:cell editor
Next Topic:configRegistry.registerConfigAttribute dont work on CompositeLayer
Goto Forum:
  


Current Time: Wed Oct 22 09:52:12 GMT 2014

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

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