TreeViewSelectionAdapter.java
01 /*
02  * SPDX-License-Identifier: Apache-2.0
03  *
04  * Copyright 2008-2017 the original author or authors.
05  *
06  * Licensed under the Apache License, Version 2.0 (the "License");
07  * you may not use this file except in compliance with the License.
08  * You may obtain a copy of the License at
09  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 package griffon.pivot.support.adapters;
19 
20 import griffon.core.CallableWithArgs;
21 import org.apache.pivot.collections.Sequence;
22 
23 /**
24  @author Andres Almiray
25  @since 2.0.0
26  */
27 public class TreeViewSelectionAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.TreeViewSelectionListener {
28     private CallableWithArgs<Void> selectedPathsChanged;
29     private CallableWithArgs<Void> selectedNodeChanged;
30     private CallableWithArgs<Void> selectedPathAdded;
31     private CallableWithArgs<Void> selectedPathRemoved;
32 
33     public CallableWithArgs<Void> getSelectedPathsChanged() {
34         return this.selectedPathsChanged;
35     }
36 
37     public CallableWithArgs<Void> getSelectedNodeChanged() {
38         return this.selectedNodeChanged;
39     }
40 
41     public CallableWithArgs<Void> getSelectedPathAdded() {
42         return this.selectedPathAdded;
43     }
44 
45     public CallableWithArgs<Void> getSelectedPathRemoved() {
46         return this.selectedPathRemoved;
47     }
48 
49 
50     public void setSelectedPathsChanged(CallableWithArgs<Void> selectedPathsChanged) {
51         this.selectedPathsChanged = selectedPathsChanged;
52     }
53 
54     public void setSelectedNodeChanged(CallableWithArgs<Void> selectedNodeChanged) {
55         this.selectedNodeChanged = selectedNodeChanged;
56     }
57 
58     public void setSelectedPathAdded(CallableWithArgs<Void> selectedPathAdded) {
59         this.selectedPathAdded = selectedPathAdded;
60     }
61 
62     public void setSelectedPathRemoved(CallableWithArgs<Void> selectedPathRemoved) {
63         this.selectedPathRemoved = selectedPathRemoved;
64     }
65 
66 
67     public void selectedPathsChanged(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence<Sequence.Tree.Path> arg1) {
68         if (selectedPathsChanged != null) {
69             selectedPathsChanged.call(arg0, arg1);
70         }
71     }
72 
73     public void selectedNodeChanged(org.apache.pivot.wtk.TreeView arg0, java.lang.Object arg1) {
74         if (selectedNodeChanged != null) {
75             selectedNodeChanged.call(arg0, arg1);
76         }
77     }
78 
79     public void selectedPathAdded(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1) {
80         if (selectedPathAdded != null) {
81             selectedPathAdded.call(arg0, arg1);
82         }
83     }
84 
85     public void selectedPathRemoved(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1) {
86         if (selectedPathRemoved != null) {
87             selectedPathRemoved.call(arg0, arg1);
88         }
89     }
90 
91 }