ContainerAdapter.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.Component;
20 
21 /**
22  @author Andres Almiray
23  @since 2.0.0
24  */
25 public class ContainerAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.ContainerListener {
26     private CallableWithArgs<Void> componentInserted;
27     private CallableWithArgs<Void> componentsRemoved;
28     private CallableWithArgs<Void> focusTraversalPolicyChanged;
29     private CallableWithArgs<Void> componentMoved;
30 
31     public CallableWithArgs<Void> getComponentInserted() {
32         return this.componentInserted;
33     }
34 
35     public CallableWithArgs<Void> getComponentsRemoved() {
36         return this.componentsRemoved;
37     }
38 
39     public CallableWithArgs<Void> getFocusTraversalPolicyChanged() {
40         return this.focusTraversalPolicyChanged;
41     }
42 
43     public CallableWithArgs<Void> getComponentMoved() {
44         return this.componentMoved;
45     }
46 
47 
48     public void setComponentInserted(CallableWithArgs<Void> componentInserted) {
49         this.componentInserted = componentInserted;
50     }
51 
52     public void setComponentsRemoved(CallableWithArgs<Void> componentsRemoved) {
53         this.componentsRemoved = componentsRemoved;
54     }
55 
56     public void setFocusTraversalPolicyChanged(CallableWithArgs<Void> focusTraversalPolicyChanged) {
57         this.focusTraversalPolicyChanged = focusTraversalPolicyChanged;
58     }
59 
60     public void setComponentMoved(CallableWithArgs<Void> componentMoved) {
61         this.componentMoved = componentMoved;
62     }
63 
64 
65     public void componentInserted(org.apache.pivot.wtk.Container arg0, int arg1) {
66         if (componentInserted != null) {
67             componentInserted.call(arg0, arg1);
68         }
69     }
70 
71     public void componentsRemoved(org.apache.pivot.wtk.Container arg0, int arg1, org.apache.pivot.collections.Sequence<Component> arg2) {
72         if (componentsRemoved != null) {
73             componentsRemoved.call(arg0, arg1, arg2);
74         }
75     }
76 
77     public void focusTraversalPolicyChanged(org.apache.pivot.wtk.Container arg0, org.apache.pivot.wtk.FocusTraversalPolicy arg1) {
78         if (focusTraversalPolicyChanged != null) {
79             focusTraversalPolicyChanged.call(arg0, arg1);
80         }
81     }
82 
83     public void componentMoved(org.apache.pivot.wtk.Container arg0, int arg1, int arg2) {
84         if (componentMoved != null) {
85             componentMoved.call(arg0, arg1, arg2);
86         }
87     }
88 
89 }