SpinnerAdapter.java
01 /*
02  * Copyright 2008-2016 the original author or authors.
03  *
04  * Licensed under the Apache License, Version 2.0 (the "License");
05  * you may not use this file except in compliance with the License.
06  * You may obtain a copy of the License at
07  *
08  *     http://www.apache.org/licenses/LICENSE-2.0
09  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package griffon.pivot.support.adapters;
17 
18 import griffon.core.CallableWithArgs;
19 
20 /**
21  @author Andres Almiray
22  @since 2.0.0
23  */
24 public class SpinnerAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.SpinnerListener {
25     private CallableWithArgs<Void> itemRendererChanged;
26     private CallableWithArgs<Void> spinnerDataChanged;
27     private CallableWithArgs<Void> circularChanged;
28 
29     public CallableWithArgs<Void> getItemRendererChanged() {
30         return this.itemRendererChanged;
31     }
32 
33     public CallableWithArgs<Void> getSpinnerDataChanged() {
34         return this.spinnerDataChanged;
35     }
36 
37     public CallableWithArgs<Void> getCircularChanged() {
38         return this.circularChanged;
39     }
40 
41 
42     public void setItemRendererChanged(CallableWithArgs<Void> itemRendererChanged) {
43         this.itemRendererChanged = itemRendererChanged;
44     }
45 
46     public void setSpinnerDataChanged(CallableWithArgs<Void> spinnerDataChanged) {
47         this.spinnerDataChanged = spinnerDataChanged;
48     }
49 
50     public void setCircularChanged(CallableWithArgs<Void> circularChanged) {
51         this.circularChanged = circularChanged;
52     }
53 
54 
55     public void itemRendererChanged(org.apache.pivot.wtk.Spinner arg0, org.apache.pivot.wtk.Spinner.ItemRenderer arg1) {
56         if (itemRendererChanged != null) {
57             itemRendererChanged.call(arg0, arg1);
58         }
59     }
60 
61     public void spinnerDataChanged(org.apache.pivot.wtk.Spinner arg0, org.apache.pivot.collections.List<?> arg1) {
62         if (spinnerDataChanged != null) {
63             spinnerDataChanged.call(arg0, arg1);
64         }
65     }
66 
67     public void circularChanged(org.apache.pivot.wtk.Spinner arg0) {
68         if (circularChanged != null) {
69             circularChanged.call(arg0);
70         }
71     }
72 
73 }