01: /* MoveEvent.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Fri Aug 12 08:34:35 2005, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2005 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zk.ui.event;
20:
21: import org.zkoss.zk.ui.Component;
22:
23: /**
24: * Represents an event caused by a component being moved.
25: *
26: * <p>Component Implementation Note:<br/>
27: * A movable component must implement {@link org.zkoss.zk.ui.ext.client.Movable}
28: * for the returned object of {@link org.zkoss.zk.ui.sys.ComponentCtrl#getExtraCtrl}.
29: *
30: * @author tomyeh
31: */
32: public class MoveEvent extends Event {
33: private final String _left, _top;
34: private final int _keys;
35:
36: /** Indicates whether the Alt key is pressed.
37: * It might be returned as part of {@link #getKeys}.
38: */
39: public static final int ALT_KEY = MouseEvent.ALT_KEY;
40: /** Indicates whether the Ctrl key is pressed.
41: * It might be returned as part of {@link #getKeys}.
42: */
43: public static final int CTRL_KEY = MouseEvent.CTRL_KEY;
44: /** Indicates whether the Shift key is pressed.
45: * It might be returned as part of {@link #getKeys}.
46: */
47: public static final int SHIFT_KEY = MouseEvent.SHIFT_KEY;
48:
49: /** Constructs a mouse relevant event.
50: */
51: public MoveEvent(String name, Component target, String left,
52: String top, int keys) {
53: super (name, target);
54: _left = left;
55: _top = top;
56: _keys = keys;
57: }
58:
59: /** Returns the left of the component after moved.
60: */
61: public final String getLeft() {
62: return _left;
63: }
64:
65: /** Returns the top of the component after moved.
66: */
67: public final String getTop() {
68: return _top;
69: }
70:
71: /** Returns what keys were pressed when the component is moved, or 0 if
72: * none of them was pressed.
73: * It is a combination of {@link #CTRL_KEY}, {@link #SHIFT_KEY}
74: * and {@link #ALT_KEY}.
75: */
76: public final int getKeys() {
77: return _keys;
78: }
79: }
|