pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From treponema <trepon...@orange.fr>
Subject Re: Is that a way to check or uncheck a checkbox using data binding?
Date Thu, 08 Nov 2012 21:23:59 GMT
Hi,
Sorry for this late answer.
This is the more generic helper that I use on different windows :
private static class CheckboxMapping implements Button.ButtonDataBindMapping {
        private final Set> set; 
        private final Checkbox cb;        
        private final Key key;
        
        public CheckboxMapping(Checkbox cb, Key key, Set> set) {
            this.cb = cb;
            this.key = key;
            this.set = set;
        }

        @Override
        public Object toButtonData(Object value) {
            if (value != null && ((List>) 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>(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 : user@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
>
Mime
View raw message