rsence-pre 2.1.0.1.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. data/.yardopts +10 -0
  2. data/INSTALL.rdoc +330 -0
  3. data/LICENSE.txt +622 -0
  4. data/README.rdoc +98 -0
  5. data/VERSION +1 -0
  6. data/bin/rsence +25 -0
  7. data/bin/rsence-pre +25 -0
  8. data/conf/default_conf.yaml +346 -0
  9. data/conf/default_strings.yaml +76 -0
  10. data/conf/rsence_command_strings.yaml +444 -0
  11. data/docs/ExampleGuiPlugin.rdoc +193 -0
  12. data/docs/JavascriptBundles.rdoc +0 -0
  13. data/docs/PluginBundleInfo.rdoc +173 -0
  14. data/docs/PluginBundles.rdoc +96 -0
  15. data/docs/Values.rdoc +163 -0
  16. data/js/comm/autosync/autosync.js +17 -0
  17. data/js/comm/autosync/js.inc +0 -0
  18. data/js/comm/comm.js +203 -0
  19. data/js/comm/js.inc +0 -0
  20. data/js/comm/jsloader/js.inc +0 -0
  21. data/js/comm/jsloader/jsloader.js +112 -0
  22. data/js/comm/queue/js.inc +0 -0
  23. data/js/comm/queue/queue.js +184 -0
  24. data/js/comm/session/js.inc +0 -0
  25. data/js/comm/session/session.js +52 -0
  26. data/js/comm/sessionwatcher/js.inc +0 -0
  27. data/js/comm/sessionwatcher/sessionwatcher.js +44 -0
  28. data/js/comm/transporter/js.inc +0 -0
  29. data/js/comm/transporter/transporter.js +261 -0
  30. data/js/comm/urlresponder/js.inc +0 -0
  31. data/js/comm/urlresponder/urlresponder.js +149 -0
  32. data/js/comm/values/js.inc +0 -0
  33. data/js/comm/values/values.js +433 -0
  34. data/js/controls/button/button.js +72 -0
  35. data/js/controls/button/js.inc +0 -0
  36. data/js/controls/button/themes/bright/button.css +89 -0
  37. data/js/controls/button/themes/bright/button.html +7 -0
  38. data/js/controls/button/themes/bright/button_parts1-ie6.gif +0 -0
  39. data/js/controls/button/themes/bright/button_parts1.png +0 -0
  40. data/js/controls/button/themes/default/button.css +89 -0
  41. data/js/controls/button/themes/default/button.html +7 -0
  42. data/js/controls/button/themes/default/button_parts1-ie6.gif +0 -0
  43. data/js/controls/button/themes/default/button_parts1.png +0 -0
  44. data/js/controls/checkbox/checkbox.js +49 -0
  45. data/js/controls/checkbox/js.inc +0 -0
  46. data/js/controls/checkbox/themes/default/checkbox.css +69 -0
  47. data/js/controls/checkbox/themes/default/checkbox.html +5 -0
  48. data/js/controls/checkbox/themes/default/checkbox_parts1-ie6.gif +0 -0
  49. data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
  50. data/js/controls/dialogs/alert_sheet/alert_sheet.js +63 -0
  51. data/js/controls/dialogs/alert_sheet/js.inc +0 -0
  52. data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +37 -0
  53. data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
  54. data/js/controls/dialogs/sheet/js.inc +0 -0
  55. data/js/controls/dialogs/sheet/sheet.js +84 -0
  56. data/js/controls/dialogs/sheet/themes/default/sheet.css +64 -0
  57. data/js/controls/dialogs/sheet/themes/default/sheet.html +14 -0
  58. data/js/controls/dialogs/sheet/themes/default/sheet_bg-ie6.gif +0 -0
  59. data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
  60. data/js/controls/dialogs/sheet/themes/default/sheet_dim-ie6.gif +0 -0
  61. data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
  62. data/js/controls/dialogs/sheet/themes/default/sheet_parts1-ie6.gif +0 -0
  63. data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
  64. data/js/controls/dialogs/sheet/themes/default/sheet_parts2-ie6.gif +0 -0
  65. data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
  66. data/js/controls/dialogs/sheet/themes/default/sheet_warning-ie6.gif +0 -0
  67. data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
  68. data/js/controls/imageview/imageview.js +109 -0
  69. data/js/controls/imageview/js.inc +0 -0
  70. data/js/controls/imageview/themes/default/blank.gif +0 -0
  71. data/js/controls/passwordcontrol/js.inc +0 -0
  72. data/js/controls/passwordcontrol/passwordcontrol.js +23 -0
  73. data/js/controls/passwordcontrol/themes/default/passwordcontrol.css +0 -0
  74. data/js/controls/passwordcontrol/themes/default/passwordcontrol.html +18 -0
  75. data/js/controls/progress/progressbar/js.inc +0 -0
  76. data/js/controls/progress/progressbar/progressbar.js +40 -0
  77. data/js/controls/progress/progressbar/themes/default/progressbar.css +16 -0
  78. data/js/controls/progress/progressbar/themes/default/progressbar.html +2 -0
  79. data/js/controls/progress/progressindicator/js.inc +0 -0
  80. data/js/controls/progress/progressindicator/progressindicator.js +44 -0
  81. data/js/controls/radiobutton/js.inc +0 -0
  82. data/js/controls/radiobutton/radiobutton.js +43 -0
  83. data/js/controls/radiobutton/themes/default/radiobutton.css +69 -0
  84. data/js/controls/radiobutton/themes/default/radiobutton.html +5 -0
  85. data/js/controls/radiobutton/themes/default/radiobutton_parts1-ie6.gif +0 -0
  86. data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
  87. data/js/controls/sliders/slider/js.inc +0 -0
  88. data/js/controls/sliders/slider/slider.js +357 -0
  89. data/js/controls/sliders/slider/themes/default/hslider_tracks-ie6.gif +0 -0
  90. data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
  91. data/js/controls/sliders/slider/themes/default/slider.css +108 -0
  92. data/js/controls/sliders/slider/themes/default/slider.html +5 -0
  93. data/js/controls/sliders/slider/themes/default/slider_thumbs-ie6.gif +0 -0
  94. data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
  95. data/js/controls/sliders/vslider/js.inc +0 -0
  96. data/js/controls/sliders/vslider/themes/default/vslider.css +52 -0
  97. data/js/controls/sliders/vslider/themes/default/vslider.html +5 -0
  98. data/js/controls/sliders/vslider/themes/default/vslider_tracks-ie6.gif +0 -0
  99. data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
  100. data/js/controls/sliders/vslider/vslider.js +41 -0
  101. data/js/controls/stepper/js.inc +0 -0
  102. data/js/controls/stepper/stepper.js +213 -0
  103. data/js/controls/stepper/themes/default/stepper-ie6.gif +0 -0
  104. data/js/controls/stepper/themes/default/stepper.css +14 -0
  105. data/js/controls/stepper/themes/default/stepper.html +2 -0
  106. data/js/controls/stepper/themes/default/stepper.png +0 -0
  107. data/js/controls/stringview/js.inc +0 -0
  108. data/js/controls/stringview/stringview.js +49 -0
  109. data/js/controls/stringview/themes/default/stringview.css +8 -0
  110. data/js/controls/stringview/themes/default/stringview.html +1 -0
  111. data/js/controls/tab/js.inc +0 -0
  112. data/js/controls/tab/tab.js +280 -0
  113. data/js/controls/tab/themes/bright/tab.css +76 -0
  114. data/js/controls/tab/themes/bright/tab.html +6 -0
  115. data/js/controls/tab/themes/bright/tab_bg_color-ie6.gif +0 -0
  116. data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
  117. data/js/controls/tab/themes/bright/tab_border_pattern-ie6.gif +0 -0
  118. data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
  119. data/js/controls/tab/themes/bright/tab_parts1-ie6.gif +0 -0
  120. data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
  121. data/js/controls/tab/themes/default/tab.css +77 -0
  122. data/js/controls/tab/themes/default/tab.html +6 -0
  123. data/js/controls/tab/themes/default/tab_bg_color-ie6.gif +0 -0
  124. data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
  125. data/js/controls/tab/themes/default/tab_border_pattern-ie6.gif +0 -0
  126. data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
  127. data/js/controls/tab/themes/default/tab_parts1-ie6.gif +0 -0
  128. data/js/controls/tab/themes/default/tab_parts1.png +0 -0
  129. data/js/controls/textarea/js.inc +0 -0
  130. data/js/controls/textarea/textarea.js +24 -0
  131. data/js/controls/textarea/themes/default/textarea.css +21 -0
  132. data/js/controls/textarea/themes/default/textarea.html +18 -0
  133. data/js/controls/textcontrol/js.inc +0 -0
  134. data/js/controls/textcontrol/textcontrol.js +374 -0
  135. data/js/controls/textcontrol/themes/default/textcontrol.css +107 -0
  136. data/js/controls/textcontrol/themes/default/textcontrol.html +18 -0
  137. data/js/controls/textcontrol/themes/default/textcontrol_parts1-ie6.gif +0 -0
  138. data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
  139. data/js/controls/textcontrol/themes/default/textcontrol_parts2-ie6.gif +0 -0
  140. data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
  141. data/js/controls/textcontrol/themes/default/textcontrol_parts3-ie6.gif +0 -0
  142. data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
  143. data/js/controls/uploader/js.inc +0 -0
  144. data/js/controls/uploader/themes/default/upload_progress.gif +0 -0
  145. data/js/controls/uploader/themes/default/uploader.css +108 -0
  146. data/js/controls/uploader/themes/default/uploader.html +27 -0
  147. data/js/controls/uploader/uploader.js +154 -0
  148. data/js/controls/validatorview/js.inc +0 -0
  149. data/js/controls/validatorview/themes/default/validator-ie6.gif +0 -0
  150. data/js/controls/validatorview/themes/default/validator.png +0 -0
  151. data/js/controls/validatorview/themes/default/validatorview.css +0 -0
  152. data/js/controls/validatorview/themes/default/validatorview.html +0 -0
  153. data/js/controls/validatorview/validatorview.js +62 -0
  154. data/js/controls/window/js.inc +0 -0
  155. data/js/controls/window/themes/default/window.css +219 -0
  156. data/js/controls/window/themes/default/window.html +17 -0
  157. data/js/controls/window/themes/default/window_bg_active-ie6.gif +0 -0
  158. data/js/controls/window/themes/default/window_bg_active.png +0 -0
  159. data/js/controls/window/themes/default/window_bg_inactive-ie6.gif +0 -0
  160. data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
  161. data/js/controls/window/themes/default/window_buttons-ie6.gif +0 -0
  162. data/js/controls/window/themes/default/window_buttons.png +0 -0
  163. data/js/controls/window/themes/default/window_parts1-ie6.gif +0 -0
  164. data/js/controls/window/themes/default/window_parts1.png +0 -0
  165. data/js/controls/window/themes/default/window_parts2-ie6.gif +0 -0
  166. data/js/controls/window/themes/default/window_parts2.png +0 -0
  167. data/js/controls/window/window.js +286 -0
  168. data/js/core/class/class.js +318 -0
  169. data/js/core/class/js.inc +0 -0
  170. data/js/core/elem/elem.js +1383 -0
  171. data/js/core/elem/js.inc +0 -0
  172. data/js/core/event/event.js +153 -0
  173. data/js/core/event/js.inc +0 -0
  174. data/js/core/iefix/ie_css_element.htc +5 -0
  175. data/js/core/iefix/ie_css_style.htc +5 -0
  176. data/js/core/iefix/iefix.js +359 -0
  177. data/js/core/iefix/js.inc +0 -0
  178. data/js/core/rsence_ns/js.inc +0 -0
  179. data/js/core/rsence_ns/rsence_ns.js +21 -0
  180. data/js/datetime/calendar/calendar.js +198 -0
  181. data/js/datetime/calendar/js.inc +0 -0
  182. data/js/datetime/calendar/themes/default/calendar.css +108 -0
  183. data/js/datetime/calendar/themes/default/calendar.html +9 -0
  184. data/js/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
  185. data/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  186. data/js/datetime/datetimevalue/datetimevalue.js +247 -0
  187. data/js/datetime/datetimevalue/js.inc +0 -0
  188. data/js/datetime/timesheet/js.inc +0 -0
  189. data/js/datetime/timesheet/themes/default/timesheet.css +30 -0
  190. data/js/datetime/timesheet/themes/default/timesheet.html +2 -0
  191. data/js/datetime/timesheet/timesheet.js +183 -0
  192. data/js/datetime/timesheet_item/js.inc +0 -0
  193. data/js/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
  194. data/js/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
  195. data/js/datetime/timesheet_item/timesheet_item.js +248 -0
  196. data/js/datetime/timesheet_item_edit/js.inc +0 -0
  197. data/js/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
  198. data/js/foundation/application/application.js +208 -0
  199. data/js/foundation/application/js.inc +0 -0
  200. data/js/foundation/control/control.js +339 -0
  201. data/js/foundation/control/controldefaults/controldefaults.js +56 -0
  202. data/js/foundation/control/controldefaults/js.inc +0 -0
  203. data/js/foundation/control/dummyvalue/dummyvalue.js +51 -0
  204. data/js/foundation/control/dummyvalue/js.inc +0 -0
  205. data/js/foundation/control/dyncontrol/dyncontrol.js +500 -0
  206. data/js/foundation/control/dyncontrol/js.inc +0 -0
  207. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.css +0 -0
  208. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.html +0 -0
  209. data/js/foundation/control/eventresponder/eventresponder.js +750 -0
  210. data/js/foundation/control/eventresponder/js.inc +0 -0
  211. data/js/foundation/control/js.inc +0 -0
  212. data/js/foundation/control/valuematrix/js.inc +0 -0
  213. data/js/foundation/control/valuematrix/valuematrix.js +135 -0
  214. data/js/foundation/control/valueresponder/js.inc +0 -0
  215. data/js/foundation/control/valueresponder/valueresponder.js +79 -0
  216. data/js/foundation/eventmanager/eventmanager.js +991 -0
  217. data/js/foundation/eventmanager/js.inc +0 -0
  218. data/js/foundation/geom/point/js.inc +0 -0
  219. data/js/foundation/geom/point/point.js +202 -0
  220. data/js/foundation/geom/rect/js.inc +0 -0
  221. data/js/foundation/geom/rect/rect.js +651 -0
  222. data/js/foundation/json_renderer/js.inc +0 -0
  223. data/js/foundation/json_renderer/json_renderer.js +246 -0
  224. data/js/foundation/system/js.inc +0 -0
  225. data/js/foundation/system/system.js +381 -0
  226. data/js/foundation/thememanager/js.inc +0 -0
  227. data/js/foundation/thememanager/thememanager.js +393 -0
  228. data/js/foundation/value/js.inc +0 -0
  229. data/js/foundation/value/value.js +183 -0
  230. data/js/foundation/view/js.inc +0 -0
  231. data/js/foundation/view/markupview/js.inc +0 -0
  232. data/js/foundation/view/markupview/markupview.js +114 -0
  233. data/js/foundation/view/morphanimation/js.inc +0 -0
  234. data/js/foundation/view/morphanimation/morphanimation.js +237 -0
  235. data/js/foundation/view/view.js +1812 -0
  236. data/js/foundation/view/viewdefaults/js.inc +0 -0
  237. data/js/foundation/view/viewdefaults/viewdefaults.js +26 -0
  238. data/js/lists/checkboxlist/checkboxlist.js +171 -0
  239. data/js/lists/checkboxlist/js.inc +0 -0
  240. data/js/lists/listitems/js.inc +0 -0
  241. data/js/lists/listitems/listitems.js +88 -0
  242. data/js/lists/propertylist/js.inc +0 -0
  243. data/js/lists/propertylist/propertylist.js +326 -0
  244. data/js/lists/radiobuttonlist/js.inc +0 -0
  245. data/js/lists/radiobuttonlist/radiobuttonlist.js +116 -0
  246. data/js/util/reloadapp/js.inc +0 -0
  247. data/js/util/reloadapp/reloadapp.js +152 -0
  248. data/js/util/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
  249. data/js/util/reloadapp/themes/default/reloadapp_warning.png +0 -0
  250. data/js/util/sha/js.inc +0 -0
  251. data/js/util/sha/sha.js +426 -0
  252. data/js/views/centerview/centerview.js +75 -0
  253. data/js/views/centerview/js.inc +0 -0
  254. data/js/views/inlineview/inlineview.js +15 -0
  255. data/js/views/inlineview/js.inc +0 -0
  256. data/js/views/scrollview/js.inc +0 -0
  257. data/js/views/scrollview/scrollview.js +40 -0
  258. data/lib/conf/argv.rb +850 -0
  259. data/lib/conf/default.rb +219 -0
  260. data/lib/daemon/daemon.rb +387 -0
  261. data/lib/daemon/sigcomm.rb +64 -0
  262. data/lib/http/broker.rb +150 -0
  263. data/lib/http/rackup.rb +91 -0
  264. data/lib/http/request.rb +66 -0
  265. data/lib/http/response.rb +65 -0
  266. data/lib/plugins/dependencies.rb +285 -0
  267. data/lib/plugins/gui_plugin.rb +160 -0
  268. data/lib/plugins/guiparser.rb +123 -0
  269. data/lib/plugins/plugin.rb +438 -0
  270. data/lib/plugins/plugin_base.rb +162 -0
  271. data/lib/plugins/plugin_plugins.rb +81 -0
  272. data/lib/plugins/plugin_sqlite_db.rb +98 -0
  273. data/lib/plugins/pluginmanager.rb +635 -0
  274. data/lib/plugins/plugins.rb +169 -0
  275. data/lib/plugins/servlet.rb +108 -0
  276. data/lib/rsence.rb +32 -0
  277. data/lib/session/msg.rb +327 -0
  278. data/lib/session/sessionmanager.rb +522 -0
  279. data/lib/session/sessionstorage.rb +340 -0
  280. data/lib/transporter/transporter.rb +263 -0
  281. data/lib/util/gzstring.rb +9 -0
  282. data/lib/util/ruby19_fixes.rb +18 -0
  283. data/lib/values/hvalue.rb +378 -0
  284. data/lib/values/valuemanager.rb +172 -0
  285. data/plugins/client_pkg/client_pkg.rb +157 -0
  286. data/plugins/client_pkg/info.yaml +25 -0
  287. data/plugins/client_pkg/lib/client_pkg_build.rb +561 -0
  288. data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
  289. data/plugins/client_pkg/lib/client_pkg_serve.rb +218 -0
  290. data/plugins/index_html/img/loading.gif +0 -0
  291. data/plugins/index_html/img/riassence.gif +0 -0
  292. data/plugins/index_html/index_html.rb +120 -0
  293. data/plugins/index_html/info.yaml +18 -0
  294. data/plugins/index_html/tmpl/index.html +15 -0
  295. data/plugins/main/info.yaml +18 -0
  296. data/plugins/main/js/main.js +84 -0
  297. data/plugins/main/main.rb +255 -0
  298. data/plugins/main/values.yaml +8 -0
  299. data/plugins/ticket/info.yaml +21 -0
  300. data/plugins/ticket/lib/common.rb +392 -0
  301. data/plugins/ticket/lib/favicon.rb +39 -0
  302. data/plugins/ticket/lib/file.rb +58 -0
  303. data/plugins/ticket/lib/img.rb +50 -0
  304. data/plugins/ticket/lib/objblob.rb +66 -0
  305. data/plugins/ticket/lib/rsrc.rb +34 -0
  306. data/plugins/ticket/lib/upload.rb +236 -0
  307. data/plugins/ticket/ticket.rb +333 -0
  308. data/setup/welcome/gui/welcome.yaml +92 -0
  309. data/setup/welcome/info.yaml +13 -0
  310. data/setup/welcome/text/welcome.html +9 -0
  311. data/setup/welcome/values.yaml +9 -0
  312. data/setup/welcome/welcome.rb +54 -0
  313. metadata +407 -0
@@ -0,0 +1,750 @@
1
+ /* RSence
2
+ * Copyright 2006 Riassence Inc.
3
+ * http://riassence.com/
4
+ *
5
+ * You should have received a copy of the GNU General Public License along
6
+ * with this software package. If not, contact licensing@riassence.com
7
+ */
8
+
9
+ /*** = Description
10
+ ** Automatic event responder. Defines what events HControl listens to
11
+ ** and actions to be taken.
12
+ **
13
+ ** = Event handler methods
14
+ ** Pre-defined event handler methods, extend these in your subclass.
15
+ **
16
+ ** +focus+:: Called when the component gets focus
17
+ ** +blur+:: Called when the component loses focus
18
+ ** +mouseDown+:: Called when the mouse button is pushed down
19
+ ** +mouseUp+:: Called when the mouse button is released
20
+ ** +mouseWheel+:: Called when the mouse wheel is used
21
+ ** +startDrag+:: Called when the mouse button
22
+ ** is pressed (and item is draggable).
23
+ ** +endDrag+:: Called when the mouse button
24
+ ** is released (and item is draggable).
25
+ ** +drag+:: Called when the mouse is moved and mouse button
26
+ ** is down (and item is draggable).
27
+ ** +drop+:: Called when a draggable item is released
28
+ ** on the droppable.
29
+ ** +startHover+:: Called when a draggable item is moved
30
+ ** over the droppable.
31
+ ** +endHover+:: Called when a draggable item is moved out
32
+ ** of the droppable.
33
+ ** +keyDown+:: Called when the user presses a key, and
34
+ ** the control is active.
35
+ ** +keyUp+:: Called when the user releases a key, and
36
+ ** the control is active.
37
+ ** +textEnter+:: Called when the user releases a key regardless
38
+ ** if the control is active or not.
39
+ ** +gainedActiveStatus+:: Called when the component gets activated.
40
+ ** +lostActiveStatus+:: Called when the component gets deactivated.
41
+ ***/
42
+ var//RSence.Foundation
43
+ HEventResponder = HClass.extend({
44
+
45
+ /** Default event listeners.
46
+ **/
47
+ defaultEvents: {
48
+ },
49
+
50
+ /** = Description
51
+ * The event responder interface for +HControl+.
52
+ * Registers the events defined by boolean properties of
53
+ * the events object to the control instance. The event manager
54
+ * handles the event mapping and abstraction itself.
55
+ * NOTE startDrag vs mouseDown and endDrag vs mouseUp events
56
+ * conflict, if both are set simultaneously.
57
+ *
58
+ * = Parameters
59
+ * +_events+:: A +{ event: state }+ Object structure, sets events based on the
60
+ * keys and the flag. All states are Booleans (true or false).
61
+ * A true state means the event listening for the event is
62
+ * enabled and a false state means the event listening is disabled.
63
+ * See the Event Types below:
64
+ *
65
+ * == Event States
66
+ * Event State:: Description
67
+ * +mouseMove+:: The global +mouseMove+ event state. The component receives
68
+ * this event regardless if it's focused or not. The event
69
+ * responder method for it is +mouseMove+ and it receives the
70
+ * absolute x and y coordinates of the mouse pointer when the
71
+ * mouse cursor position changes. Can also be toggled
72
+ * separately by using the +setMouseMove+ method.
73
+ * +textEnter+:: The global +textEnter+ event state. The component receives
74
+ * this event regardless if it's focused or not. The event
75
+ * responder method for it is +textEnter+ and it receives a
76
+ * every time a key on the keyboard is pressed. Can also
77
+ * be toggled separately by using the +setTextEnter+ method.
78
+ * +click+:: The local +click+ event state. The component receives
79
+ * this event only if it's focused. The event responder
80
+ * method for it is +click+ and it receives the absolute x
81
+ * and y coordinates of the mouse pointer as well as which
82
+ * mouse button was used to trigger the event. Can also be
83
+ * toggled separately by using the +setClickable+ method.
84
+ * +mouseDown+:: The local +mouseDown+ event state. The component receives
85
+ * this event only if it's focused. The event responder
86
+ * method for it is +mouseDown+ and it receives the absolute x
87
+ * and y coordinates of the mouse pointer as well as which
88
+ * mouse button was used to trigger the event. Can also be
89
+ * toggled separately by using the +setMouseDown+ method.
90
+ * +mouseUp+:: The local +mouseUp+ event state. The component receives
91
+ * this event only if it's focused. The event responder
92
+ * method for it is +mouseUp+ and it receives the absolute x
93
+ * and y coordinates of the mouse pointer as well as which
94
+ * mouse button was used to trigger the event. Can also be
95
+ * toggled separately by using the +setMouseUp+ method.
96
+ * +mouseWheel+:: The local +mouseWheel+ event state. The component receives
97
+ * this event only if it's focused. The event responder
98
+ * method for it is +mouseWheel+ and it receives the delta of
99
+ * the amount of the mouse scroll wheel was rolled: a floating
100
+ * point number, larger or smaller than 0, depending on the
101
+ * direction the scroll wheel was rolled. Can also be
102
+ * toggled separately by using the +setMouseWheel+ method.
103
+ * +draggable+:: The local +draggable+ event states. The component receives
104
+ * these events only if it's focused. The event responders
105
+ * methods are +startDrag+, +drag+ and +endDrag+. The events
106
+ * receive the mouse cursor coordinates.
107
+ * Can also be toggled separately by using the +setDraggable+
108
+ * method.
109
+ * +droppable+:: The local +droppable+ event states. The component receives
110
+ * this event only if another component is dragged (hovered)
111
+ * or dropped with the area of this component as the target.
112
+ * The event responders method for it are +hoverStart+,
113
+ * +drop+ and +hoverEnd+.
114
+ * Can also be toggled separately by using the
115
+ * +setDroppable+ method.
116
+ * +keyDown+:: The local +keyDown+ event state. The component receives
117
+ * this event only if it's focused. The event responder
118
+ * method for it is +keyDown+ and it receives the ascii key
119
+ * code whenever a keyboard key is pressed. Can also be
120
+ * toggled separately by using the +setKeyDown+ method.
121
+ * +keyUp+:: The local +keyUp+ event state. The component receives
122
+ * this event only if it's focused. The event responder
123
+ * method for it is +keyUp+ and it receives the ascii key
124
+ * code whenever a keyboard key is released. Can also be
125
+ * toggled separately by using the +setKeyUp+ method.
126
+ *
127
+ * = Usage
128
+ * HControl.new(
129
+ * [0,0,100,20],
130
+ * HApplication.nu()
131
+ * ).setEvents({
132
+ * mouseUp: true,
133
+ * mouseDown: true
134
+ * });
135
+ *
136
+ * = Returns
137
+ * +self+
138
+ *
139
+ **/
140
+ setEvents: function(_events) {
141
+ if(!this.events) {
142
+ this.events = HClass.extend( {
143
+ mouseMove: false,
144
+ mouseDown: false,
145
+ mouseUp: false,
146
+ draggable: false,
147
+ droppable: false,
148
+ keyDown: false,
149
+ keyUp: false,
150
+ mouseWheel: false,
151
+ textEnter: false,
152
+ click: false,
153
+ resize: false,
154
+ doubleClick: false
155
+ } ).extend( this.defaultEvents ).extend( _events?_events:{} ).nu();
156
+ }
157
+ this.events.ctrl = this;
158
+ EVENT.reg( this, this.events );
159
+ return this;
160
+ },
161
+
162
+ /** = Description
163
+ * Enables the HControl instance, if the enabled flag is true, and disables
164
+ * it if enabled is false. A disabled HControl won't respond events.
165
+ * Component themes reflect the disabled state typically with
166
+ * a dimmer appearance.
167
+ *
168
+ * = Parameters
169
+ * +_flag+:: Boolean; true enables, false disables.
170
+ *
171
+ * = Returns
172
+ * +this+
173
+ *
174
+ **/
175
+ setEnabled: function(_flag) {
176
+
177
+ var _this = this,
178
+ _elemId = this.elemId,
179
+ _sysViews = HSystem.views,
180
+ i = 0,
181
+ _views = _this.views,
182
+ _view,
183
+ _viewsLen = _views.length;
184
+
185
+ // Enable/disable the children first.
186
+ for (; i < _viewsLen; i++) {
187
+ _view = _sysViews[_views[i]];
188
+ _view['setEnabled'] && _view.setEnabled(_flag);
189
+ }
190
+
191
+ if (_this.enabled === _flag) {
192
+ // No change in enabled status, do nothing.
193
+ return this;
194
+ }
195
+
196
+ _this.enabled = _flag;
197
+
198
+ if(_flag) {
199
+ EVENT.reg(_this, _this.events);
200
+ }
201
+ else {
202
+ EVENT.unreg(_this);
203
+ }
204
+
205
+ // Toggle the CSS class: enabled/disabled
206
+ _this.toggleCSSClass(_elemId, HControl.CSS_ENABLED, _flag);
207
+ _this.toggleCSSClass(_elemId, HControl.CSS_DISABLED, !_flag);
208
+ return this;
209
+ },
210
+
211
+
212
+ /** = Description
213
+ * Alternative flag setter for the mouseMove event type. If set to true,
214
+ * starts listening to mouseDown events when the component has focus.
215
+ *
216
+ * = Parameters
217
+ * +_flag+:: Set the mouseDown event listening on/off (true/false) for
218
+ * the component instance.
219
+ *
220
+ * = Returns
221
+ * +self+
222
+ *
223
+ **/
224
+ setMouseMove: function(_flag) {
225
+ this.events.mouseMove = _flag;
226
+ this.setEvents();
227
+ return this;
228
+ },
229
+
230
+ /** = Description
231
+ * Alternative flag setter for the click event type. If set to true,
232
+ * starts listening to click events when the component has focus.
233
+ *
234
+ * = Parameters
235
+ * +_flag+:: Set the click event listening on/off (true/false) for
236
+ * the component instance.
237
+ *
238
+ * = Returns
239
+ * +self+
240
+ *
241
+ **/
242
+ setClickable: function(_flag) {
243
+ this.events.click = _flag;
244
+ this.setEvents();
245
+ return this;
246
+ },
247
+
248
+ /** = Description
249
+ * Registers or releases event listening for mouseDown events depending on
250
+ * the value of the flag argument.
251
+ *
252
+ * = Parameters
253
+ * +_flag+:: Set the mouseDown event listening on/off (true/false) for
254
+ * the component instance.
255
+ *
256
+ * = Returns
257
+ * +self+
258
+ *
259
+ **/
260
+ setMouseDown: function(_flag) {
261
+ this.events.mouseDown = _flag;
262
+ this.setEvents();
263
+ return this;
264
+ },
265
+
266
+ /** = Description
267
+ * Registers or releases event listening for doubleClick events depending on
268
+ * the value of the flag argument.
269
+ *
270
+ * = Parameters
271
+ * +_flag+:: Set the doubleClick event listening on/off (true/false) for
272
+ * the component instance.
273
+ *
274
+ * = Returns
275
+ * +self+
276
+ *
277
+ **/
278
+ setDoubleClickable: function(_flag) {
279
+ this.events.doubleClick = _flag;
280
+ this.setEvents();
281
+ return this;
282
+ },
283
+
284
+ /** = Description
285
+ * Registers or releases event listening for mouseUp events depending on the
286
+ * value of the flag argument.
287
+ *
288
+ * = Parameters
289
+ * +_flag+:: Set the mouseUp event listening on/off (true/false) for
290
+ * the component instance.
291
+ *
292
+ * = Returns
293
+ * +self+
294
+ *
295
+ **/
296
+ setMouseUp: function(_flag) {
297
+ this.events.mouseUp = _flag;
298
+ this.setEvents();
299
+ return this;
300
+ },
301
+
302
+ /** = Description
303
+ * Alternative flag setter for the mouseWheel event type. If set to true,
304
+ * starts listening to mouseWheel events when the component has focus.
305
+ *
306
+ * = Parameters
307
+ * +_flag+:: Set the mouseWheel event listening on/off (true/false) for
308
+ * the component instance.
309
+ *
310
+ * = Returns
311
+ * +self+
312
+ *
313
+ **/
314
+ setMouseWheel: function(_flag) {
315
+ this.events.mouseWheel = _flag;
316
+ this.setEvents();
317
+ return this;
318
+ },
319
+
320
+ /** = Description
321
+ * Registers or releases event listening for startDrag, drag and
322
+ * endDrag -events depending on the value of the flag argument.
323
+ *
324
+ * = Parameters
325
+ * +_flag+:: Set the startDrag, drag and endDrag event listening
326
+ * on/off (true/false) for the component instance.
327
+ *
328
+ * = Returns
329
+ * +self+
330
+ *
331
+ **/
332
+ setDraggable: function(_flag) {
333
+ this.events.draggable = _flag;
334
+ this.setEvents();
335
+ return this;
336
+ },
337
+
338
+ /** = Description
339
+ * Registers or releases event listening for startHover, drop and
340
+ * endHover -events depending on the value of the flag argument.
341
+ *
342
+ * = Parameters
343
+ * +_flag+:: Set the startHover, drop and endHover event listening
344
+ * on/off (true/false) for the component instance.
345
+ *
346
+ * = Returns
347
+ * +self+
348
+ *
349
+ **/
350
+ setDroppable: function(_flag) {
351
+ this.events.droppable = _flag;
352
+ this.setEvents();
353
+ return this;
354
+ },
355
+
356
+
357
+ /** = Description
358
+ * Registers or releases event listening for keyDown events depending on the
359
+ * value of the flag argument.
360
+ *
361
+ * = Parameters
362
+ * +_flag+:: Set the keyDown event listening on/off (true/false) for
363
+ * the component instance.
364
+ *
365
+ * = Returns
366
+ * +self+
367
+ *
368
+ **/
369
+ setKeyDown: function(_flag) {
370
+ this.events.keyDown = _flag;
371
+ this.setEvents();
372
+ return this;
373
+ },
374
+
375
+
376
+ /** = Description
377
+ * Registers or releases event listening for keyUp events depending on
378
+ * the value of the flag argument.
379
+ *
380
+ * = Parameters
381
+ * +_flag+:: Set the keyUp event listening on/off (true/false) for
382
+ * the component instance.
383
+ *
384
+ * = Returns
385
+ * +self+
386
+ *
387
+ **/
388
+ setKeyUp: function(_flag) {
389
+ this.events.keyUp = _flag;
390
+ this.setEvents();
391
+ return this;
392
+ },
393
+
394
+ /** = Description
395
+ * Registers or releases event listening for textEnter events
396
+ * depending on the value of the flag argument.
397
+ *
398
+ * = Returns
399
+ * +self+
400
+ *
401
+ **/
402
+ setTextEnter: function(_flag) {
403
+ this.events.textEnter = _flag;
404
+ this.setEvents();
405
+ return this;
406
+ },
407
+
408
+ /** Same as +setClickable+
409
+ **/
410
+ setClick: function(_flag) {
411
+ return this.setClickable(_flag);
412
+ },
413
+
414
+ /** Same as +setDoubleClickable+
415
+ **/
416
+ setDoubleClick: function(_flag) {
417
+ return this.setDoubleClickable(_flag);
418
+ },
419
+
420
+ /** = Description
421
+ * Default focus event responder method. Does nothing by default.
422
+ * Called when the component gets focus.
423
+ *
424
+ **/
425
+ focus: function() {},
426
+
427
+ /** = Description
428
+ * Default blur event responder method. Does nothing by default.
429
+ * Called when the component loses focus.
430
+ *
431
+ **/
432
+ blur: function() {},
433
+
434
+
435
+ /** = Description
436
+ * Default gainedActiveStatus event responder method. Does nothing by default.
437
+ * Called when the component gains active status; both focused and clicked.
438
+ *
439
+ * = Parameters
440
+ * +_lastActiveControl+:: A reference to the control that was active
441
+ * before this control became active. Can
442
+ * be null if there was no active control.
443
+ *
444
+ **/
445
+ gainedActiveStatus: function(_lastActiveControl) {
446
+
447
+ var
448
+ _parents = this.parents,
449
+ _parentIdx = _parents.length-1;
450
+
451
+ if ( (HSystem.windowFocusMode === 1) && ( _parentIdx > 1 ) ) {
452
+ for( ; _parentIdx > 0; _parentIdx-- ){
453
+ // Send gainedActiveStatus to HWindow parent(s)
454
+ if(_parents[_parentIdx]['windowFocus']!==undefined){
455
+ _parents[_parentIdx].gainedActiveStatus();
456
+ }
457
+ }
458
+ }
459
+
460
+ },
461
+
462
+ // A low-level handler for active status, don't extend this.
463
+ _gainedActiveStatus: function(_lastActiveControl) {
464
+ if(this.enabled) {
465
+ this.toggleCSSClass(this.elemId, HControl.CSS_ACTIVE, true);
466
+ }
467
+ this.gainedActiveStatus(_lastActiveControl);
468
+ },
469
+
470
+
471
+ /** = Description
472
+ * Default lostActiveStatus event responder method. Does nothing by default.
473
+ * Called when the component loses active status; another component was
474
+ * focused and clicked.
475
+ *
476
+ * = Parameters
477
+ * +_newActiveControl+:: A reference to the control that became the currently
478
+ * active control. Can be null if there is no active
479
+ * control.
480
+ *
481
+ **/
482
+ lostActiveStatus: function(_newActiveControl) {
483
+
484
+ },
485
+
486
+ // --A low-level handler for lost active status, don't extend this.++
487
+ _lostActiveStatus: function(_newActiveControl) {
488
+ if(this.enabled) {
489
+ this.toggleCSSClass(this.elemId, HControl.CSS_ACTIVE, false);
490
+ }
491
+ this.lostActiveStatus(_newActiveControl);
492
+ },
493
+
494
+
495
+ /** = Description
496
+ * Default mouseMove event responder method. Does nothing by default.
497
+ * Called whenever the mouse cursor is moved regardless if the
498
+ * component is active or has focus.
499
+ *
500
+ * = Parameters
501
+ * +x+:: The horizontal coordinate units (px) of the mouse cursor position.
502
+ * +y+:: The vertical coordinate units (px) of the mouse cursor position.
503
+ *
504
+ **/
505
+ mouseMove: function(x,y) {},
506
+
507
+
508
+ /** = Description
509
+ * Default click event responder method. Does nothing by default.
510
+ *
511
+ * = Parameters
512
+ * +x+:: The horizontal coordinate units (px) of the
513
+ * mouse cursor position.
514
+ * +y+:: The vertical coordinate units (px) of the
515
+ * mouse cursor position.
516
+ * +_isLeftButton+:: Boolean flag; false if the right(context) mouse
517
+ * button is pressed.
518
+ *
519
+ **/
520
+ click: function(x,y,_isLeftButton){},
521
+
522
+ /** = Description
523
+ * Default click event responder method. Does nothing by default.
524
+ *
525
+ * = Parameters
526
+ * +x+:: The horizontal coordinate units (px) of the
527
+ * mouse cursor position.
528
+ * +y+:: The vertical coordinate units (px) of the
529
+ * mouse cursor position.
530
+ * +_isLeftButton+:: Boolean flag; false if the right(context) mouse
531
+ * button is pressed.
532
+ *
533
+ **/
534
+ doubleClick: function(x,y,_isLeftButton){},
535
+
536
+ /** = Description
537
+ * Default mouseDown event responder method. Does nothing by default.
538
+ *
539
+ * = Parameters
540
+ * +x+:: The horizontal coordinate units (px) of the
541
+ * mouse cursor position.
542
+ * +y+:: The vertical coordinate units (px) of the
543
+ * mouse cursor position.
544
+ * +_isLeftButton+:: Boolean flag; false if the right(context) mouse
545
+ * button is pressed.
546
+ *
547
+ **/
548
+ mouseDown: function(x,y,_isLeftButton) {},
549
+
550
+
551
+ /** = Description
552
+ * Default mouseDown event responder method. Does nothing by default.
553
+ *
554
+ * = Parameters
555
+ * +x+:: The horizontal coordinate units (px) of the
556
+ * mouse cursor position.
557
+ * +y+:: The vertical coordinate units (px) of the
558
+ * mouse cursor position.
559
+ * +_isLeftButton+:: Boolean flag; false if the right(context) mouse
560
+ * button is pressed.
561
+ *
562
+ **/
563
+ mouseUp: function(x,y,_isLeftButton) {},
564
+
565
+ /** = Description
566
+ * Default mouseWheel event responder method. Does nothing by default.
567
+ *
568
+ * = Parameters
569
+ * +_delta+:: Scrolling delta, the wheel angle change. If delta is positive,
570
+ * wheel was scrolled up. Otherwise, it was scrolled down.
571
+ *
572
+ **/
573
+ mouseWheel: function(_delta) {},
574
+
575
+ /** = Description
576
+ * Default startDrag event responder method. Sets internal flags by default.
577
+ * This is the preferred method to extend if you want to do something
578
+ * when a drag event starts. If you extend, remember to call +this.base();+
579
+ *
580
+ * = Parameters
581
+ * +x+:: The horizontal coordinate units (px) of the mouse cursor position.
582
+ * +y+:: The vertical coordinate units (px) of the mouse cursor position.
583
+ *
584
+ **/
585
+ startDrag: function(x, y) {},
586
+
587
+ /** = Description
588
+ * Default drag event responder method. Does nothing by default.
589
+ * This is the preferred method to extend while a drag method is ongoing.
590
+ * Called whenever the mouse cursor moves and a drag event has been started.
591
+ *
592
+ * = Parameters
593
+ * +x+:: The horizontal coordinate units (px) of the mouse cursor position.
594
+ * +y+:: The vertical coordinate units (px) of the mouse cursor position.
595
+ *
596
+ **/
597
+ drag: function(x,y){
598
+ this.doDrag(x,y);
599
+ },
600
+ doDrag: function(x, y) {},
601
+
602
+
603
+ /** = Description
604
+ * Default endDrag event responder method. Sets internal flags by default.
605
+ * This is the preferred method to extend if you want to do something
606
+ * when a drag event ends. If you extend, remember to call +this.base();+
607
+ *
608
+ * = Parameters
609
+ * +x+:: The horizontal coordinate units (px) of the mouse cursor position.
610
+ * +y+:: The vertical coordinate units (px) of the mouse cursor position.
611
+ *
612
+ **/
613
+ endDrag: function(x, y) {
614
+ this.invalidatePositionCache();
615
+ },
616
+
617
+ /** = Description
618
+ * Default drop event responder method. Does nothing by default.
619
+ * Extend the drop method, if you want to do something
620
+ * when this instance is the target of another instance's endDrag event.
621
+ * Called when a dragged component instance is dropped on the target instance.
622
+ *
623
+ * = Parameters
624
+ * +obj+:: The dragged component object.
625
+ *
626
+ **/
627
+ drop: function(obj) {
628
+ this.onDrop(obj);
629
+ },
630
+ onDrop: function(obj) {},
631
+
632
+ /** = Description
633
+ * Default startHover event responder method. Does nothing by default.
634
+ * Extend the startHover method, if you want to do something
635
+ * when this instance is the target of another instance's drag event.
636
+ * Called when a dragged component instance is dragged over
637
+ * the target instance.
638
+ *
639
+ * = Parameters
640
+ * +obj+:: The dragged component object.
641
+ *
642
+ **/
643
+ startHover: function(obj) {
644
+ this.onHoverStart(obj);
645
+ },
646
+ onHoverStart: function(obj) {},
647
+
648
+ /** = Description
649
+ * Default endHover event responder method. Does nothing by default.
650
+ * Extend the endHover method, if you want to do something
651
+ * when this instance is no longer the target of another instance's
652
+ * drag event. Called when a dragged component instance is dragged
653
+ * away from the target instance.
654
+ *
655
+ * = Parameters
656
+ * +obj+:: The dragged component object.
657
+ *
658
+ **/
659
+ endHover: function(obj) {
660
+ this.onHoverEnd(obj);
661
+ },
662
+ onHoverEnd: function(obj) {},
663
+
664
+ /** = Description
665
+ * Default keyDown event responder method. Does nothing by default.
666
+ * Extend the keyDown method, if you want to do something
667
+ * when a key is pressed and the component is active.
668
+ *
669
+ * = Parameters
670
+ * +_keycode+:: The ascii key code of the key that was pressed.
671
+ *
672
+ **/
673
+ keyDown: function(_keycode) {},
674
+
675
+ /** = Description
676
+ * Default keyUp event responder method. Does nothing by default.
677
+ * Extend the keyUp method, if you want to do something
678
+ * when a key is released and the component is active.
679
+ *
680
+ * = Parameters
681
+ * +_keycode+:: The ascii key code of the key that was released.
682
+ *
683
+ **/
684
+ keyUp: function(_keycode) {},
685
+
686
+ /** = Description
687
+ * Default textEnter event responder method. Does nothing by default.
688
+ * Extend the textEnter method, if you want to do something
689
+ * when a key is released regardless if the component is active,
690
+ * has focus or not.
691
+ *
692
+ * = Parameters
693
+ * +_keycode+:: The ascii key code of the key that was released.
694
+ *
695
+ **/
696
+ textEnter: function() {},
697
+
698
+ /** -- DON'T TOUCH _mouseOver, IT IS A LOW-LEVEL HANDLER, use focus() instead ++ **/
699
+ _mouseOver: function(e) {
700
+ if (!Event.element) {
701
+ return;
702
+ }
703
+ var _that = Event.element(e);
704
+ while(_that && _that.ctrl === undefined) {
705
+ _that = _that.parentNode;
706
+ }
707
+ if (!_that) {
708
+ return;
709
+ }
710
+ var _this = _that.ctrl;
711
+
712
+ EVENT.focus(_this);
713
+ Event.stop(e);
714
+ },
715
+
716
+ /** -- DON'T TOUCH _mouseOut, IT IS A LOW-LEVEL HANDLER, use blur() instead ++ **/
717
+ _mouseOut: function(e) {
718
+ if (!Event.element) {
719
+ return;
720
+ }
721
+ var _that = Event.element(e);
722
+ while(_that && _that.ctrl === undefined) {
723
+ _that = _that.parentNode;
724
+ }
725
+ if (!_that) {
726
+ return;
727
+ }
728
+ var _this = _that.owner;
729
+
730
+ EVENT.blur(_this);
731
+ Event.stop(e);
732
+ },
733
+
734
+
735
+ /** = Description
736
+ * Forces retrieving this control's DOM element position directly rather than
737
+ * using the cached version when the position is needed by +EVENT+.
738
+ * Child controls are invalidated recursively by +HView+.
739
+ *
740
+ * = Returns
741
+ * +self+
742
+ *
743
+ **/
744
+ invalidatePositionCache: function() {
745
+ this.base();
746
+ EVENT.coordCacheFlush(this.elemId);
747
+ return this;
748
+ }
749
+
750
+ });