ComponentDecoratorAdapter.java
01 /*
02  * Copyright 2008-2015 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.effects.Decorator;
20 
21 /**
22  @author Andres Almiray
23  @since 2.0.0
24  */
25 public class ComponentDecoratorAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.ComponentDecoratorListener {
26     private CallableWithArgs<Void> decoratorInserted;
27     private CallableWithArgs<Void> decoratorUpdated;
28     private CallableWithArgs<Void> decoratorsRemoved;
29 
30     public CallableWithArgs<Void> getDecoratorInserted() {
31         return this.decoratorInserted;
32     }
33 
34     public CallableWithArgs<Void> getDecoratorUpdated() {
35         return this.decoratorUpdated;
36     }
37 
38     public CallableWithArgs<Void> getDecoratorsRemoved() {
39         return this.decoratorsRemoved;
40     }
41 
42 
43     public void setDecoratorInserted(CallableWithArgs<Void> decoratorInserted) {
44         this.decoratorInserted = decoratorInserted;
45     }
46 
47     public void setDecoratorUpdated(CallableWithArgs<Void> decoratorUpdated) {
48         this.decoratorUpdated = decoratorUpdated;
49     }
50 
51     public void setDecoratorsRemoved(CallableWithArgs<Void> decoratorsRemoved) {
52         this.decoratorsRemoved = decoratorsRemoved;
53     }
54 
55 
56     public void decoratorInserted(org.apache.pivot.wtk.Component arg0, int arg1) {
57         if (decoratorInserted != null) {
58             decoratorInserted.call(arg0, arg1);
59         }
60     }
61 
62     public void decoratorUpdated(org.apache.pivot.wtk.Component arg0, int arg1, org.apache.pivot.wtk.effects.Decorator arg2) {
63         if (decoratorUpdated != null) {
64             decoratorUpdated.call(arg0, arg1, arg2);
65         }
66     }
67 
68     public void decoratorsRemoved(org.apache.pivot.wtk.Component arg0, int arg1, org.apache.pivot.collections.Sequence<Decorator> arg2) {
69         if (decoratorsRemoved != null) {
70             decoratorsRemoved.call(arg0, arg1, arg2);
71         }
72     }
73 
74 }