pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandro Martini <sandro.mart...@gmail.com>
Subject Re: Is that a way to check or uncheck a checkbox using data binding?
Date Thu, 24 Jan 2013 09:03:13 GMT
Hi all,
I'm ready to look better at this, maybe to include in 2.0.3 (soon to
be released) ...

Objections from someone for including this ?
If not I'll create a jira issue (and post here the link) , but I need
the original author to attach there the code, so we are all happy (due
to ASF rules) :-) ... ok ?

Tell me.

Thanks,
Sandro


2012/11/8 treponema <treponema@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);
>         }
>
>     }
>

Mime
View raw message