Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Loosing selection
Loosing selection [message #1131317] Thu, 10 October 2013 12:14 Go to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
Howdy,

I have again a problem and I do not see the solution of it. I want to implement a selection within a selection. I have worked with styles, so the two different selections could be distiguished. The second get an additional label and for that label a different selection style is configured. My problem is, that if if select a cell within my first selection, I lose my first selection. Is there any way to keep the first selection?

I tried also to select the rows for the first selection again after the second one was done, but then I lose the second selecton Sad
Re: Loosing selection [message #1131333 is a reply to message #1131317] Thu, 10 October 2013 12:29 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Selection within a selection? What do you mean?

Are you trying to perform selection of multiple items one after the other? If yes, try to think how you would do this in the UI. If you want to select multiple cells you usually use the CTRL mask.

Are you trying to select manually or programmatically? If it is programmatically, do you use the SelectRowsCommand or how are you trying to achieve your selection?
Re: Loosing selection [message #1131345 is a reply to message #1131333] Thu, 10 October 2013 12:41 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
The selection is done by mouse or keyboard, not programatically.

First selection:
First somehow a preselection of item should be done, that are marked for selection. This selection should be kept and always be visible, so the user could see the marked items.

Second selection:
With the second selection (that is in the row range of the first) the use selects the items he wants to edit. It could be one cell or more cells.

Example:
I preselect row 5-15 ( first selection) and then I select the second cell of the rows 7-10. The selected rows 5-15 should be visible in a different color, let us say grey and the cells marked for editing in another color, let us say green.

My problem is, that at the moment I mark the cells for editing, I lose the first selection.
Re: Loosing selection [message #1131351 is a reply to message #1131345] Thu, 10 October 2013 12:50 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Never heard of such a use case related to selection. And I think technically this is not possible if you only think of selection.

For the "preselection" you don't need to really select anything. At least I don't see the the reason why it should. So maybe a solution would be to perform something like a selection. You are talking about items that are marked somehow. I guess you want to tell your user at which items he should focus. Why not marking these items with another mechanism than selection and add labels to those cells. So you are able to highlight them to the user. On top everything is possible using selection and editing as you know.
Re: Loosing selection [message #1131355 is a reply to message #1131351] Thu, 10 October 2013 12:55 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
I need the preselection because of the database that is behind the table, to lock the preselected rows.
How could I highlight them?
Re: Loosing selection [message #1131374 is a reply to message #1131355] Thu, 10 October 2013 13:13 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
Or do you mean with "highlight them" to do it like in the example "Custom_styling_of_specific_cells" (adding config labels). I have done this. But I lose the highlighting when I start the second selection.

[Updated on: Thu, 10 October 2013 13:14]

Report message to a moderator

Re: Loosing selection [message #1131376 is a reply to message #1131355] Thu, 10 October 2013 13:14 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Well, from the perspective of a user, architect and UI ergonomist Wink

Let's assume the user selects those rows to be able to lock:
1. user selects the rows
2. user performs some custom action to execute locking
3. the user can select and edit in the fields

Technically:
1. user performs a selection, which needs to be a real selection so the lock function can operate on that
2. after the lock operation has succeeded you need to tell your model about the lock state. this way you are able to perform conditional styling on the lock state
3. the first selection can be removed and sub selections can be performed as the lock state is made visible via conditional styling rather than selection state

for more information on conditional styling: http://eclipse.org/nattable/documentation.php?page=styling
Re: Loosing selection [message #1131398 is a reply to message #1131376] Thu, 10 October 2013 13:34 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
This is what I already done.
1.) First selection is done by mouse in table -> locked in DB and by adding a label for the different style (according to example "Custom_styling_of_specific_cells")

So far it works fine. But when I started the second selection, the custom styling get lost too. Sad
Re: Loosing selection [message #1131407 is a reply to message #1131398] Thu, 10 October 2013 13:41 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
The labels are calculated again on every refresh. The LabelStack is not persistent. So you need to add some attribute to your model object or introduce some other mechanism that is able to track which rows are locked, so the information can't get lost on rerendering.
Re: Loosing selection [message #1131429 is a reply to message #1131407] Thu, 10 October 2013 14:03 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
in the accumulateConfigLabels I think I have such an persistent mechanism. The labels are marked according to the both selections which where done (both selection-rectangle objects are "stored"). But when I do the second selection the first custom style gets lost. If I perfom the first selection again, then it looks as I want it.
Re: Loosing selection [message #1131464 is a reply to message #1131429] Thu, 10 October 2013 14:51 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
check if your labels are still there in the appropriate cells by using the DebugMenuConfiguration like
natTable.addConfiguration(new DebugMenuConfiguration(natTable));

this way you can open a debug dialog by right clicking on a cell
Re: Loosing selection [message #1131494 is a reply to message #1131464] Thu, 10 October 2013 15:31 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
thank you very much so far... I will try it!
Re: Loosing selection [message #1132494 is a reply to message #1131494] Fri, 11 October 2013 07:22 Go to previous message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
Your last hint helps me to find my mistake! Tahnk you very much!
Previous Topic:Problem with RowReorderLayer and indexes.
Next Topic:Wrap text row height with more than one column
Goto Forum:
  


Current Time: Thu Mar 28 11:32:53 GMT 2024

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

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

Back to the top