Hi, don't worry for the delay, I'm busy a lot like you .-) ... Forwarding to dev list because now I'd like to hear what other Pivot Developers say on this small addition (to me seems useful). Could be for 2.1, or maybe even for 2.0.3 (we are near to a release candicate, in next weeks).
This is our section in JIRA (Apache issue tracker): https://issues.apache.org/jira/browse/PIVOT you can sign (you have to register before, but it's fast) and add a new issue (for example as improvement), and then you could attach a sample code there, so then we could use it (these are rules at Apache for us to accept code) ... and it's useful even for us, to not forget things between releases :-) . If you could do it, it would be great. If you need some help, sent to me an email ... Roger, Chris, and others, what do you think ? Bye, Sandro 2012/11/8 treponema <trepon...@orange.fr>: > Hi, > Sorry for this late answer. > This is the more generic helper that I use on different windows : > > private static class CheckboxMapping<T> implements > Button.ButtonDataBindMapping { > private final Set<Key<T>> set; > private final Checkbox cb; > private final Key<T> key; > > public CheckboxMapping(Checkbox cb, Key<T> key, Set<Key<T>> set) { > > > this.cb = cb; > this.key = key; > this.set = set; > > } > > @Override > public Object toButtonData(Object value) { > if (value != null && ((List<Key<T>>) value).contains(key)) > cb.setSelected(true); > else > cb.setSelected(false); > > return cb.getButtonData(); > } > > @Override > public Object valueOf(Object buttonData) { > if (cb.isSelected()) > set.add(this.key); > return new ArrayList<Key<T>>(set); > } > > } > > I have to learn what a "JIRA issue" is, I am new to open source (I come from > .Net). So I think nothing about this. > > Bye... > > > >> Message du 26/09/12 14:36 >> De : "Sandro Martini" >> A : u...@pivot.apache.org >> Copie à : >> Objet : Re: Is that a way to check or uncheck a checkbox using data >> binding? > >> >> Hi, >> >> I'm sorry but I don't have a better solution for this problem. >> >> Maybe for 2.1 we could think (if no better solution will come) to >> write some helper classes like your (but maybe a little more generic) >> but based on real use cases like this. A JIRA issue could be good too, >> to not forget ... >> >> What do you think ? >> >> Bye, >> Sandro >>