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