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