TreeViewSelectionAdapter.java
01 /*
02  * Copyright 2008-2014 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 import org.apache.pivot.collections.Sequence;
20 
21 /**
22  @author Andres Almiray
23  @since 2.0.0
24  */
25 public class TreeViewSelectionAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.TreeViewSelectionListener {
26     private CallableWithArgs<Void> selectedPathsChanged;
27     private CallableWithArgs<Void> selectedNodeChanged;
28     private CallableWithArgs<Void> selectedPathAdded;
29     private CallableWithArgs<Void> selectedPathRemoved;
30 
31     public CallableWithArgs<Void> getSelectedPathsChanged() {
32         return this.selectedPathsChanged;
33     }
34 
35     public CallableWithArgs<Void> getSelectedNodeChanged() {
36         return this.selectedNodeChanged;
37     }
38 
39     public CallableWithArgs<Void> getSelectedPathAdded() {
40         return this.selectedPathAdded;
41     }
42 
43     public CallableWithArgs<Void> getSelectedPathRemoved() {
44         return this.selectedPathRemoved;
45     }
46 
47 
48     public void setSelectedPathsChanged(CallableWithArgs<Void> selectedPathsChanged) {
49         this.selectedPathsChanged = selectedPathsChanged;
50     }
51 
52     public void setSelectedNodeChanged(CallableWithArgs<Void> selectedNodeChanged) {
53         this.selectedNodeChanged = selectedNodeChanged;
54     }
55 
56     public void setSelectedPathAdded(CallableWithArgs<Void> selectedPathAdded) {
57         this.selectedPathAdded = selectedPathAdded;
58     }
59 
60     public void setSelectedPathRemoved(CallableWithArgs<Void> selectedPathRemoved) {
61         this.selectedPathRemoved = selectedPathRemoved;
62     }
63 
64 
65     public void selectedPathsChanged(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence<Sequence.Tree.Path> arg1) {
66         if (selectedPathsChanged != null) {
67             selectedPathsChanged.call(arg0, arg1);
68         }
69     }
70 
71     public void selectedNodeChanged(org.apache.pivot.wtk.TreeView arg0, java.lang.Object arg1) {
72         if (selectedNodeChanged != null) {
73             selectedNodeChanged.call(arg0, arg1);
74         }
75     }
76 
77     public void selectedPathAdded(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1) {
78         if (selectedPathAdded != null) {
79             selectedPathAdded.call(arg0, arg1);
80         }
81     }
82 
83     public void selectedPathRemoved(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1) {
84         if (selectedPathRemoved != null) {
85             selectedPathRemoved.call(arg0, arg1);
86         }
87     }
88 
89 }