1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Class for holding information about a mouse click event."""
17
18 from muntjac.terminal.gwt.client.mouse_event_details import MouseEventDetails
19 from muntjac.event.component_event_listener import IComponentEventListener
20 from muntjac.ui.component import Event as ComponentEvent
21
22
24 """Class for holding information about a mouse click event. A
25 L{ClickEvent} is fired when the user clicks on a C{Component}.
26
27 The information available for click events are terminal dependent.
28 Correct values for all event details cannot be guaranteed.
29
30 @author: Vaadin Ltd.
31 @author: Richard Lincoln
32 @see: L{ClickListener}
33 @version: 1.1.2
34 """
35
36 BUTTON_LEFT = MouseEventDetails.BUTTON_LEFT
37 BUTTON_MIDDLE = MouseEventDetails.BUTTON_MIDDLE
38 BUTTON_RIGHT = MouseEventDetails.BUTTON_RIGHT
39
40 - def __init__(self, source, mouseEventDetails):
43
44
53
54
56 """Returns the mouse position (x coordinate) when the click took place.
57 The position is relative to the browser client area.
58
59 @return: The mouse cursor x position
60 """
61 return self._details.getClientX()
62
63
65 """Returns the mouse position (y coordinate) when the click took place.
66 The position is relative to the browser client area.
67
68 @return: The mouse cursor y position
69 """
70 return self._details.getClientY()
71
72
74 """Returns the relative mouse position (x coordinate) when the click
75 took place. The position is relative to the clicked component.
76
77 @return: The mouse cursor x position relative to the clicked layout
78 component or -1 if no x coordinate available
79 """
80 return self._details.getRelativeX()
81
82
84 """Returns the relative mouse position (y coordinate) when the click
85 took place. The position is relative to the clicked component.
86
87 @return: The mouse cursor y position relative to the clicked layout
88 component or -1 if no y coordinate available
89 """
90 return self._details.getRelativeY()
91
92
94 """Checks if the event is a double click event.
95
96 @return: true if the event is a double click event, false otherwise
97 """
98 return self._details.isDoubleClick()
99
100
102 """Checks if the Alt key was down when the mouse event took place.
103
104 @return: true if Alt was down when the event occured, false otherwise
105 """
106 return self._details.isAltKey()
107
108
110 """Checks if the Ctrl key was down when the mouse event took place.
111
112 @return: true if Ctrl was pressed when the event occured, false
113 otherwise
114 """
115 return self._details.isCtrlKey()
116
117
125
126
128 """Checks if the Shift key was down when the mouse event took place.
129
130 @return: true if Shift was pressed when the event occured, false
131 otherwise
132 """
133 return self._details.isShiftKey()
134
135
144
145
147 """Interface for listening for a L{ClickEvent} fired by a L{Component}.
148
149 @see: L{ClickEvent}
150 @author: Vaadin Ltd.
151 @author: Richard Lincoln
152 @version: 1.1.2
153 """
154
156 """Called when a L{Component} has been clicked. A reference to the
157 component is given by L{ClickEvent.getComponent}.
158
159 @param event:
160 An event containing information about the click.
161 """
162 raise NotImplementedError
163
164 clickMethod = click
165
166
168 """Class for holding additional event information for DoubleClick events.
169 Fired when the user double-clicks on a C{Component}.
170
171 @see: L{ClickEvent}
172 @author: Vaadin Ltd.
173 @author: Richard Lincoln
174 @version: 1.1.2
175 """
176
179
180
182 """Interface for listening for a L{DoubleClickEvent} fired by a
183 L{Component}.
184
185 @see: L{DoubleClickEvent}
186 @author: Vaadin Ltd.
187 @author: Richard Lincoln
188 @version: 1.1.2
189 """
190
192 """Called when a L{Component} has been double clicked. A reference
193 to the component is given by L{DoubleClickEvent.getComponent}.
194
195 @param event:
196 An event containing information about the double click.
197 """
198 raise NotImplementedError
199
200 doubleClickMethod = doubleClick
201