WindowActionMappingAdapter.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.wtk.Window;
22 
23 /**
24  @author Andres Almiray
25  @since 2.0.0
26  */
27 public class WindowActionMappingAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.WindowActionMappingListener {
28     private CallableWithArgs<Void> actionMappingAdded;
29     private CallableWithArgs<Void> actionMappingsRemoved;
30     private CallableWithArgs<Void> keyStrokeChanged;
31     private CallableWithArgs<Void> actionChanged;
32 
33     public CallableWithArgs<Void> getActionMappingAdded() {
34         return this.actionMappingAdded;
35     }
36 
37     public CallableWithArgs<Void> getActionMappingsRemoved() {
38         return this.actionMappingsRemoved;
39     }
40 
41     public CallableWithArgs<Void> getKeyStrokeChanged() {
42         return this.keyStrokeChanged;
43     }
44 
45     public CallableWithArgs<Void> getActionChanged() {
46         return this.actionChanged;
47     }
48 
49 
50     public void setActionMappingAdded(CallableWithArgs<Void> actionMappingAdded) {
51         this.actionMappingAdded = actionMappingAdded;
52     }
53 
54     public void setActionMappingsRemoved(CallableWithArgs<Void> actionMappingsRemoved) {
55         this.actionMappingsRemoved = actionMappingsRemoved;
56     }
57 
58     public void setKeyStrokeChanged(CallableWithArgs<Void> keyStrokeChanged) {
59         this.keyStrokeChanged = keyStrokeChanged;
60     }
61 
62     public void setActionChanged(CallableWithArgs<Void> actionChanged) {
63         this.actionChanged = actionChanged;
64     }
65 
66 
67     public void actionMappingAdded(org.apache.pivot.wtk.Window arg0) {
68         if (actionMappingAdded != null) {
69             actionMappingAdded.call(arg0);
70         }
71     }
72 
73     public void actionMappingsRemoved(org.apache.pivot.wtk.Window arg0, int arg1, org.apache.pivot.collections.Sequence<Window.ActionMapping> arg2) {
74         if (actionMappingsRemoved != null) {
75             actionMappingsRemoved.call(arg0, arg1, arg2);
76         }
77     }
78 
79     public void keyStrokeChanged(org.apache.pivot.wtk.Window.ActionMapping arg0, org.apache.pivot.wtk.Keyboard.KeyStroke arg1) {
80         if (keyStrokeChanged != null) {
81             keyStrokeChanged.call(arg0, arg1);
82         }
83     }
84 
85     public void actionChanged(org.apache.pivot.wtk.Window.ActionMapping arg0, org.apache.pivot.wtk.Action arg1) {
86         if (actionChanged != null) {
87             actionChanged.call(arg0, arg1);
88         }
89     }
90 
91 }