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