ComponentMouseButtonAdapter.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 
20 /**
21  @author Andres Almiray
22  @since 2.0.0
23  */
24 public class ComponentMouseButtonAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.ComponentMouseButtonListener {
25     private CallableWithArgs<Boolean> mouseClick;
26     private CallableWithArgs<Boolean> mouseDown;
27     private CallableWithArgs<Boolean> mouseUp;
28 
29     public CallableWithArgs<Boolean> getMouseClick() {
30         return this.mouseClick;
31     }
32 
33     public CallableWithArgs<Boolean> getMouseDown() {
34         return this.mouseDown;
35     }
36 
37     public CallableWithArgs<Boolean> getMouseUp() {
38         return this.mouseUp;
39     }
40 
41 
42     public void setMouseClick(CallableWithArgs<Boolean> mouseClick) {
43         this.mouseClick = mouseClick;
44     }
45 
46     public void setMouseDown(CallableWithArgs<Boolean> mouseDown) {
47         this.mouseDown = mouseDown;
48     }
49 
50     public void setMouseUp(CallableWithArgs<Boolean> mouseUp) {
51         this.mouseUp = mouseUp;
52     }
53 
54 
55     public boolean mouseClick(org.apache.pivot.wtk.Component arg0, org.apache.pivot.wtk.Mouse.Button arg1, int arg2, int arg3, int arg4) {
56         return mouseClick != null && mouseClick.call(arg0, arg1, arg2, arg3, arg4);
57     }
58 
59     public boolean mouseDown(org.apache.pivot.wtk.Component arg0, org.apache.pivot.wtk.Mouse.Button arg1, int arg2, int arg3) {
60         return mouseDown != null && mouseDown.call(arg0, arg1, arg2, arg3);
61     }
62 
63     public boolean mouseUp(org.apache.pivot.wtk.Component arg0, org.apache.pivot.wtk.Mouse.Button arg1, int arg2, int arg3) {
64         return mouseUp != null && mouseUp.call(arg0, arg1, arg2, arg3);
65     }
66 
67 }