|
@@ -1,40 +1,40 @@ |
1 |
|
- |
package com.temp.client.foundation.widget.input.support; |
2 |
|
- |
|
3 |
|
- |
import com.google.gwt.event.dom.client.*; |
4 |
|
- |
import com.google.gwt.event.logical.shared.*; |
5 |
|
- |
import com.google.gwt.event.shared.*; |
6 |
|
- |
import com.google.gwt.user.client.ui.*; |
7 |
|
- |
import com.temp.client.foundation.widget.input.fieldsupport.*; |
8 |
|
- |
import com.temp.client.foundation.widget.input.support.events.*; |
9 |
|
- |
import com.temp.shared.utils.*; |
10 |
|
- |
|
11 |
|
- |
public class CheckBoxValueAdapter implements InputWidgetValueAdapter<Boolean> { |
12 |
|
- |
|
13 |
|
- |
private final CheckBox inputWidget; |
14 |
|
- |
|
15 |
|
- |
private final NonDomChangeEvent changeEvent = new NonDomChangeEvent( this ); |
16 |
|
- |
|
17 |
|
- |
public CheckBoxValueAdapter( CheckBox inputWidget ) { |
18 |
|
- |
Validate.notNull( "inputWidget", this.inputWidget = inputWidget ); |
19 |
|
- |
} |
20 |
|
- |
|
21 |
|
- |
@Override |
22 |
|
- |
public HandlerRegistration addChangeHandler( final ChangeHandler handler ) { |
23 |
|
- |
return inputWidget.addValueChangeHandler( new ValueChangeHandler<Boolean>() { |
24 |
|
- |
@Override |
25 |
|
- |
public void onValueChange( ValueChangeEvent<Boolean> booleanValueChangeEvent ) { |
26 |
|
- |
changeEvent.dispatch( handler ); |
27 |
|
- |
} |
28 |
|
- |
} ); |
29 |
|
- |
} |
30 |
|
- |
|
31 |
|
- |
@Override |
32 |
|
- |
public Boolean getValue() { |
33 |
|
- |
return ObjectUtils.deNull( inputWidget.getValue(), Boolean.FALSE ); |
34 |
|
- |
} |
35 |
|
- |
|
36 |
|
- |
@Override |
37 |
|
- |
public void setValue( Boolean value ) { |
38 |
|
- |
inputWidget.setValue( ObjectUtils.deNull( value, Boolean.FALSE ) ); |
39 |
|
- |
} |
40 |
|
- |
} |
|
1 |
+ |
package com.temp.client.foundation.widget.input.support; |
|
2 |
+ |
|
|
3 |
+ |
import com.google.gwt.event.dom.client.*; |
|
4 |
+ |
import com.google.gwt.event.logical.shared.*; |
|
5 |
+ |
import com.google.gwt.event.shared.*; |
|
6 |
+ |
import com.google.gwt.user.client.ui.*; |
|
7 |
+ |
import com.temp.client.foundation.widget.input.fieldsupport.*; |
|
8 |
+ |
import com.temp.client.foundation.widget.input.support.events.*; |
|
9 |
+ |
import com.temp.shared.utils.*; |
|
10 |
+ |
|
|
11 |
+ |
public class CheckBoxValueAdapter implements InputWidgetValueAdapter<Boolean> { |
|
12 |
+ |
|
|
13 |
+ |
private final CheckBox inputWidget; |
|
14 |
+ |
|
|
15 |
+ |
private final NonDomChangeEvent changeEvent = new NonDomChangeEvent( this ); |
|
16 |
+ |
|
|
17 |
+ |
public CheckBoxValueAdapter( CheckBox inputWidget ) { |
|
18 |
+ |
Validate.notNull( "inputWidget", this.inputWidget = inputWidget ); |
|
19 |
+ |
} |
|
20 |
+ |
|
|
21 |
+ |
@Override |
|
22 |
+ |
public HandlerRegistration addChangeHandler( final ChangeHandler handler ) { |
|
23 |
+ |
return inputWidget.addValueChangeHandler( new ValueChangeHandler<Boolean>() { |
|
24 |
+ |
@Override |
|
25 |
+ |
public void onValueChange( ValueChangeEvent<Boolean> booleanValueChangeEvent ) { |
|
26 |
+ |
changeEvent.dispatch( handler ); |
|
27 |
+ |
} |
|
28 |
+ |
} ); |
|
29 |
+ |
} |
|
30 |
+ |
|
|
31 |
+ |
@Override |
|
32 |
+ |
public Boolean getValue() { |
|
33 |
+ |
return ObjectUtils.deNull( inputWidget.getValue(), Boolean.FALSE ); |
|
34 |
+ |
} |
|
35 |
+ |
|
|
36 |
+ |
@Override |
|
37 |
+ |
public void setValue( Boolean value ) { |
|
38 |
+ |
inputWidget.setValue( ObjectUtils.deNull( value, Boolean.FALSE ) ); |
|
39 |
+ |
} |
|
40 |
+ |
} |