TableViewSortAdapter.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 TableViewSortAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.TableViewSortListener {
25     private CallableWithArgs<Void> sortChanged;
26     private CallableWithArgs<Void> sortAdded;
27     private CallableWithArgs<Void> sortUpdated;
28     private CallableWithArgs<Void> sortRemoved;
29 
30     public CallableWithArgs<Void> getSortChanged() {
31         return this.sortChanged;
32     }
33 
34     public CallableWithArgs<Void> getSortAdded() {
35         return this.sortAdded;
36     }
37 
38     public CallableWithArgs<Void> getSortUpdated() {
39         return this.sortUpdated;
40     }
41 
42     public CallableWithArgs<Void> getSortRemoved() {
43         return this.sortRemoved;
44     }
45 
46 
47     public void setSortChanged(CallableWithArgs<Void> sortChanged) {
48         this.sortChanged = sortChanged;
49     }
50 
51     public void setSortAdded(CallableWithArgs<Void> sortAdded) {
52         this.sortAdded = sortAdded;
53     }
54 
55     public void setSortUpdated(CallableWithArgs<Void> sortUpdated) {
56         this.sortUpdated = sortUpdated;
57     }
58 
59     public void setSortRemoved(CallableWithArgs<Void> sortRemoved) {
60         this.sortRemoved = sortRemoved;
61     }
62 
63 
64     public void sortChanged(org.apache.pivot.wtk.TableView arg0) {
65         if (sortChanged != null) {
66             sortChanged.call(arg0);
67         }
68     }
69 
70     public void sortAdded(org.apache.pivot.wtk.TableView arg0, java.lang.String arg1) {
71         if (sortAdded != null) {
72             sortAdded.call(arg0, arg1);
73         }
74     }
75 
76     public void sortUpdated(org.apache.pivot.wtk.TableView arg0, java.lang.String arg1, org.apache.pivot.wtk.SortDirection arg2) {
77         if (sortUpdated != null) {
78             sortUpdated.call(arg0, arg1, arg2);
79         }
80     }
81 
82     public void sortRemoved(org.apache.pivot.wtk.TableView arg0, java.lang.String arg1, org.apache.pivot.wtk.SortDirection arg2) {
83         if (sortRemoved != null) {
84             sortRemoved.call(arg0, arg1, arg2);
85         }
86     }
87 
88 }