Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Enabling checkbox in NATTable with data provider which is represented by a Boolean List(Enabling checkbox in NATTable with data provider which is represented by a Boolean List)
Enabling checkbox in NATTable with data provider which is represented by a Boolean List [message #1193752] Mon, 18 November 2013 06:44 Go to next message
Joel Johnson is currently offline Joel JohnsonFriend
Messages: 2
Registered: November 2013
Junior Member
We have a data model which is represented by a java bean which consists of a list(collection) of boolean values rather than an individual boolean value.

public class MyModel{

 
  private String name;

  private String desc;

  private List<Boolean> flags;

  // Setters and getters ...

}



In the above code, the list of boolean values represent dynamic column data in my NatTable.
which is used for displaying checkbox in UI

Unfortunately the list of boolean instance variable in the data model is not capturing the UI click events on the checkbox in the NatTable.

Is it possible to represent in such a manner?

Thanks in advance
Re: Enabling checkbox in NATTable with data provider which is represented by a Boolean List [message #1194448 is a reply to message #1193752] Mon, 18 November 2013 14:13 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2751
Registered: July 2012
Senior Member
Hi,

I'm still not sure what you are trying to do. Do you want to have multiple checkboxes in one cell? Looking at the data model you posted, it seems this is what you are trying to achieve.

At the moment this is not supported in NatTable. There is no MulitCheckboxEditor in NatTable. But it should be possible to implement such an editor.

You need to implement three things (at least for a first thought):
1. the editor class that is able to deal with multiple checkboxes
2. the painter class that is able to render multiple checkboxes
3. the MouseEventMatcher that is able to determine which checkbox was clicked (have a look at the DefaultEditBindings to see what I'm talking about)

Or do you build one column per Boolean value?

Then you should check:
1. Are the bindings registered correctly? (check the DefaultEditBindings, maybe the matcher for the CheckBoxPainter is missing)
2. Is your data provider aware of the data structure? (check if setDataValue() of your data provider is called on mouse click)

Greez,
Dirk
Re: Enabling checkbox in NATTable with data provider which is represented by a Boolean List [message #1194545 is a reply to message #1194448] Mon, 18 November 2013 15:11 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2751
Registered: July 2012
Senior Member
BTW ... did you implement a custom IColumnPropertyAccessor or are you using the ReflectiveColumnPropertyAccessor? Because if you want to update a collection of Boolean values, you definitely need to implement your own IColumnPropertyAccessor.
Re: Enabling checkbox in NATTable with data provider which is represented by a Boolean List [message #1200223 is a reply to message #1194545] Thu, 21 November 2013 06:12 Go to previous messageGo to next message
Joel Johnson is currently offline Joel JohnsonFriend
Messages: 2
Registered: November 2013
Junior Member
Hi Dirk,

Yes, We trying to build one column per Boolean value since our datamodel returns a dynamic number of columns.(hence the list implementation)
We followed your suggestion and it is working fine now.Thanks

But any click on the table causes the columns with the checkbox to flicker.
Is there anything we could be doing wrong?

Regards,
Joel
Re: Enabling checkbox in NATTable with data provider which is represented by a Boolean List [message #1200387 is a reply to message #1200223] Thu, 21 November 2013 08:03 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2751
Registered: July 2012
Senior Member
Hm, not sure as I don't know about your code.

In NatTable 1.0.1 there is a flickering issue regarding the viewport that is solved in the development snapshots already. But it doesn't sound to be related to that.

What happens on clicking the checkbox? Usually the data model updates are performed very fast. So the only thing I could think of now is some misusage of the editing. But to be honest, I'm not sure.
Previous Topic:Sorting with different row heights
Next Topic:Using wildcards in configLabels
Goto Forum:
  


Current Time: Sun Dec 08 16:53:25 GMT 2019

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

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

Back to the top