rsence 2.0.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
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,494 @@
1
+ /* Riassence Framework
2
+ * Copyright 2008 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
+ ** The +HControl+ extension that defines a draggable and
11
+ ** resizable foundation container view.
12
+ **
13
+ ** It's used like a HControl, but contains pre-defined active areas
14
+ ** for resizing and moving its view. The resizable areas are defined
15
+ ** by the edges (only horizontal or vertical resizability) and corners
16
+ ** (both horizontal and vertical resizability). The rest triggers
17
+ ** the movable area.
18
+ **
19
+ ** The droppable events are enabled by default and
20
+ ** a lot more constructor options can be defined: see +controlDefaults+
21
+ **
22
+ **
23
+ ***/
24
+ HDynControl = HControl.extend({
25
+
26
+ componentBehaviour: ['view','control','window'],
27
+
28
+ preserveTheme: true,
29
+
30
+ defaultEvents: {
31
+ draggable: true
32
+ },
33
+
34
+ /** = Description
35
+ * In addition to the standard HControl#constructor options,
36
+ * the following properties can be set:
37
+ *
38
+ * Key:: Description
39
+ * +minX+:: The minimum X-coordinate allowed to be dragged or resized to.
40
+ * Defaults to +0+.
41
+ * +minY+:: The minimum Y-coordinate allowed to be dragged or resized to.
42
+ * Defaults to +0+.
43
+ * +maxX+:: The maximum X-coordinate allowed to be dragged or resized to.
44
+ * Defaults to the browser window width.
45
+ * +maxY+:: The maximum Y-coordinate allowed to be dragged or resized to.
46
+ * Defaults to the browser window height.
47
+ * +minSize+:: An array containing exactly two values: +[ width, height ]+.
48
+ * Defines the minimum size allowed for resizing.
49
+ * Defaults to +[ 24, 54 ]+
50
+ * +maxSize+:: An array containing exactly two values: +[ width, height ]+.
51
+ * Defines the maximum size allowed for resizing.
52
+ * Defaults to the browser window size.
53
+ * +resizeW+:: The size of the west (left) resizable edge. Defaults to +1+.
54
+ * +resizeE+:: The size of the east (right) resizable edge. Defaults to +1+.
55
+ * +resizeN+:: The size of the north (top) resizable edge. Defaults to +1+.
56
+ * +resizeS+:: The size of the south (bottom) resizable edge. Default to +1+.
57
+ * +resizeNW+:: The size of the north-west (left top) resizable corner.
58
+ * Defaults to +[ 1, 1 ]+
59
+ * +resizeNE+:: The size of the north-east (right top) resizable corner.
60
+ * Defaults to +[ 1, 1 ]+
61
+ * +resizeSW+:: The size of the south-west (left bottom) resizable corner.
62
+ * Defaults to +[ 1, 1 ]+
63
+ * +resizeSE+:: The size of the south-east (right bottom) resizable corner.
64
+ * Defaults to +[ 1, 1 ]+
65
+ * +noResize+:: A flag (when true) disables all resizing and only allows
66
+ * moving.
67
+ *
68
+ **/
69
+ controlDefaults: (HControlDefaults.extend({
70
+ constructor: function(_ctrl){
71
+ var _winSize = ELEM.windowSize(),
72
+ _winWidth = _winSize[0],
73
+ _winHeight = _winSize[1];
74
+ if(!this.minSize){
75
+ this.minSize = [24,54];
76
+ }
77
+ if(!this.maxSize){
78
+ this.maxSize = _winSize;
79
+ }
80
+ if(!this.maxX){
81
+ this.maxX = _winWidth-this.minSize[0];
82
+ }
83
+ if(!this.maxY){
84
+ this.maxY = _winHeight-this.minSize[1];
85
+ }
86
+ if(!this.resizeNW){
87
+ this.resizeNW = [ 1, 1 ];
88
+ }
89
+ if(!this.resizeNE){
90
+ this.resizeNE = [ 1, 1 ];
91
+ }
92
+ if(!this.resizeSW){
93
+ this.resizeSW = [ 1, 1 ];
94
+ }
95
+ if(!this.resizeSE){
96
+ this.resizeSE = [ 1, 1 ];
97
+ }
98
+ },
99
+ minX: 0,
100
+ minY: 0,
101
+ maxX: null,
102
+ maxY: null,
103
+ minSize: null,
104
+ maxSize: null,
105
+ resizeW: 1,
106
+ resizeE: 1,
107
+ resizeN: 1,
108
+ resizeS: 1,
109
+ resizeNW: null,
110
+ resizeNE: null,
111
+ resizeSW: null,
112
+ resizeSE: null,
113
+ noResize: false
114
+ })),
115
+
116
+ draw: function(){
117
+ this.base();
118
+ this._initActionFns();
119
+ this._initActionFlag();
120
+ },
121
+
122
+ /* Method for checking the change is within the limits */
123
+ _checkConstraints: function(_leftChange,_topChange){
124
+ var _this = this, _rect = _this.rect,
125
+ _options = _this.options,
126
+ _dw, _dh;
127
+ if(_rect.width < _options.minSize[0]){
128
+ _dw=0-(_options.minSize[0]-_rect.width);
129
+ _rect.setWidth( _options.minSize[0]);
130
+ if(_leftChange){
131
+ _rect.offsetBy( _dw, 0 );
132
+ }
133
+ }
134
+ else if(_rect.width > _options.maxSize[0]){
135
+ _dw=0-(_options.maxSize[0]-_rect.width);
136
+ _rect.setWidth( _options.maxSize[0]);
137
+ if(_leftChange){
138
+ _rect.offsetBy( _dw, 0 );
139
+ }
140
+ }
141
+ if(_rect.height < _options.minSize[1]){
142
+ _dh=0-(_options.minSize[1]-_rect.height);
143
+ _rect.setHeight(_options.minSize[1]);
144
+ if(_topChange){
145
+ _rect.offsetBy( 0, _dh );
146
+ }
147
+ }
148
+ else if(_rect.height > _options.maxSize[1]){
149
+ _dh=0-(_options.maxSize[1]-_rect.height);
150
+ _rect.setHeight(_options.maxSize[1]);
151
+ if(_topChange){
152
+ _rect.offsetBy( 0, _dh );
153
+ }
154
+ }
155
+ if(_rect.left < _options.minX){
156
+ _rect.offsetTo( _options.minX, _rect.top );
157
+ }
158
+ else if(_rect.left > _options.maxX){
159
+ _rect.offsetTo( _options.maxX, _rect.top );
160
+ }
161
+ if(_rect.top < _options.minY){
162
+ _rect.offsetTo( _rect.left, _options.minY );
163
+ }
164
+ else if(_rect.top > _options.maxY){
165
+ _rect.offsetTo( _rect.left, _options.maxY );
166
+ }
167
+ _this.drawRect();
168
+ },
169
+
170
+ /* Method for returning the coordinate difference as a HPoint instance */
171
+ _diffPoint: function(x,y){
172
+ return this._startPoint.subtract(x,y);
173
+ },
174
+
175
+ /** = Description
176
+ * Sub-event method responder when the north-west (left-top) corner is being
177
+ * moved to resize the view.
178
+ *
179
+ * By default calculates the dimensions and checks the constraints.
180
+ *
181
+ * = Parameters
182
+ * +_this+:: The instance of the class it belongs to (+self+).
183
+ * +x+:: The current x coordinate of the mouse cursor.
184
+ * +y+:: The current y coordinate of the mouse cursor.
185
+ *
186
+ **/
187
+ dynResizeNW: function(_this,x,y){
188
+ var _dp = _this._diffPoint(x,y);
189
+ _this.rect.setLeftTop(_this._startRect.leftTop.subtract(_dp));
190
+ _this._checkConstraints(1,1);
191
+ },
192
+
193
+ /** = Description
194
+ * Sub-event method responder when the north-east (right-top) corner is being
195
+ * moved to resize the view.
196
+ *
197
+ * By default calculates the dimensions and checks the constraints.
198
+ *
199
+ * = Parameters
200
+ * +_this+:: The instance of the class it belongs to (+self+).
201
+ * +x+:: The current x coordinate of the mouse cursor.
202
+ * +y+:: The current y coordinate of the mouse cursor.
203
+ *
204
+ **/
205
+ dynResizeNE: function(_this,x,y){
206
+ var _dp = _this._diffPoint(x,y);
207
+ _this.rect.setRightTop(_this._startRect.rightTop.subtract(_dp));
208
+ _this._checkConstraints(0,1);
209
+ },
210
+
211
+ /** = Description
212
+ * Sub-event method responder when the south-west (left-bottom) corner is being
213
+ * moved to resize the view.
214
+ *
215
+ * By default calculates the dimensions and checks the constraints.
216
+ *
217
+ * = Parameters
218
+ * +_this+:: The instance of the class it belongs to (+self+).
219
+ * +x+:: The current x coordinate of the mouse cursor.
220
+ * +y+:: The current y coordinate of the mouse cursor.
221
+ *
222
+ **/
223
+ dynResizeSW: function(_this,x,y){
224
+ var _dp = _this._diffPoint(x,y);
225
+ _this.rect.setLeftBottom(_this._startRect.leftBottom.subtract(_dp));
226
+ _this._checkConstraints(1,0);
227
+ },
228
+
229
+ /** = Description
230
+ * Sub-event method responder when the south-east (right-bottom) corner is being
231
+ * moved to resize the view.
232
+ *
233
+ * By default calculates the dimensions and checks the constraints.
234
+ *
235
+ * = Parameters
236
+ * +_this+:: The instance of the class it belongs to (+self+).
237
+ * +x+:: The current x coordinate of the mouse cursor.
238
+ * +y+:: The current y coordinate of the mouse cursor.
239
+ *
240
+ **/
241
+ dynResizeSE: function(_this,x,y){
242
+ var _dp = _this._diffPoint(x,y);
243
+ _this.rect.setRightBottom(_this._startRect.rightBottom.subtract(_dp));
244
+ _this._checkConstraints(0,0);
245
+ },
246
+
247
+ /** = Description
248
+ * Sub-event method responder when the west (left) edge is being
249
+ * moved to resize the view.
250
+ *
251
+ * By default calculates the dimensions and checks the constraints.
252
+ *
253
+ * = Parameters
254
+ * +_this+:: The instance of the class it belongs to (+self+).
255
+ * +x+:: The current x coordinate of the mouse cursor.
256
+ * +y+:: The current y coordinate of the mouse cursor.
257
+ *
258
+ **/
259
+ dynResizeW: function(_this,x,y){
260
+ var _dp = _this._diffPoint(x,y);
261
+ _this.rect.setLeft(_this._startRect.left-_dp.x);
262
+ _this._checkConstraints(1,0);
263
+ },
264
+
265
+ /** = Description
266
+ * Sub-event method responder when the east (right) edge is being
267
+ * moved to resize the view.
268
+ *
269
+ * By default calculates the dimensions and checks the constraints.
270
+ *
271
+ * = Parameters
272
+ * +_this+:: The instance of the class it belongs to (+self+).
273
+ * +x+:: The current x coordinate of the mouse cursor.
274
+ * +y+:: The current y coordinate of the mouse cursor.
275
+ *
276
+ **/
277
+ dynResizeE: function(_this,x,y){
278
+ var _dp = _this._diffPoint(x,y);
279
+ _this.rect.setRight(_this._startRect.right-_dp.x);
280
+ _this._checkConstraints(0,0);
281
+ },
282
+
283
+ /** = Description
284
+ * Sub-event method responder when the north (top) edge is being
285
+ * moved to resize the view.
286
+ *
287
+ * By default calculates the dimensions and checks the constraints.
288
+ *
289
+ * = Parameters
290
+ * +_this+:: The instance of the class it belongs to (+self+).
291
+ * +x+:: The current x coordinate of the mouse cursor.
292
+ * +y+:: The current y coordinate of the mouse cursor.
293
+ *
294
+ **/
295
+ dynResizeN: function(_this,x,y){
296
+ var _dp = _this._diffPoint(x,y);
297
+ _this.rect.setTop(_this._startRect.top-_dp.y);
298
+ _this._checkConstraints(0,1);
299
+ },
300
+
301
+ /** = Description
302
+ * Sub-event method responder when the south (bottom) edge is being
303
+ * moved to resize the view.
304
+ *
305
+ * By default calculates the dimensions and checks the constraints.
306
+ *
307
+ * = Parameters
308
+ * +_this+:: The instance of the class it belongs to (+self+).
309
+ * +x+:: The current x coordinate of the mouse cursor.
310
+ * +y+:: The current y coordinate of the mouse cursor.
311
+ *
312
+ **/
313
+ dynResizeS: function(_this,x,y){
314
+ var _dp = _this._diffPoint(x,y);
315
+ _this.rect.setBottom(_this._startRect.bottom-_dp.y);
316
+ _this._checkConstraints(0,0);
317
+ },
318
+
319
+ /** = Description
320
+ * Sub-event method responder when moving the offset of the view.
321
+ * This is called when no resize areas are triggered.
322
+ *
323
+ * By default calculates the dimensions and checks the constraints.
324
+ *
325
+ * = Parameters
326
+ * +_this+:: The instance of the class it belongs to (+self+).
327
+ * +x+:: The current x coordinate of the mouse cursor.
328
+ * +y+:: The current y coordinate of the mouse cursor.
329
+ *
330
+ **/
331
+ dynDrag: function(_this,x,y){
332
+ var _dp = _this._diffPoint(x,y);
333
+ _this.rect.offsetTo(_this._startRect.leftTop.subtract(_dp));
334
+ _this._checkConstraints(1,1);
335
+ },
336
+
337
+ /* Method to initialize the rules */
338
+ _initActionFns: function(){
339
+ this._actionFns = [];
340
+ this._actionCrsr = [
341
+ 'nw-resize', 'ne-resize', 'sw-resize', 'se-resize',
342
+ 'w-resize', 'e-resize', 'n-resize', 's-resize', 'move'
343
+ ];
344
+ var i, _this = this,
345
+ _resizeNW=0,_resizeNE=1,_resizeSW=2,_resizeSE=3,
346
+ _resizeW =4, _resizeE=5, _resizeN=6, _resizeS=7, _drag=8,
347
+ _actionFns=this._actionFns;
348
+ _actionFns[_resizeNW] = _this.dynResizeNW;
349
+ _actionFns[_resizeNE] = _this.dynResizeNE;
350
+ _actionFns[_resizeSW] = _this.dynResizeSW;
351
+ _actionFns[_resizeSE] = _this.dynResizeSE;
352
+
353
+ _actionFns[_resizeW] = _this.dynResizeW;
354
+ _actionFns[_resizeE] = _this.dynResizeE;
355
+ _actionFns[_resizeN] = _this.dynResizeN;
356
+ _actionFns[_resizeS] = _this.dynResizeS;
357
+
358
+ _actionFns[_drag] = _this.dynDrag;
359
+
360
+ },
361
+
362
+
363
+ /** Calculates the rectangles for all the active areas.
364
+ **/
365
+ makeRectRules: function(){
366
+ var _opts=this.options, _rect=this.rect;
367
+ return [
368
+ // corners:
369
+ [0,0,_opts.resizeNW[0],_opts.resizeNW[1]], // NW
370
+ [_rect.width-_opts.resizeNE[0],0,_rect.width,_opts.resizeNE[1]], // NE
371
+ [0,_rect.height-_opts.resizeSW[1],_opts.resizeSW[0],_rect.height], // SW
372
+ [_rect.width-_opts.resizeSE[0],_rect.height-_opts.resizeSE[1],_rect.width,_rect.height], // SE
373
+ // borders:
374
+ [0,_opts.resizeN,_opts.resizeW,_rect.height-_opts.resizeS], // W
375
+ [_rect.width-_opts.resizeE,_opts.resizeN,_rect.width,_rect.height-_opts.resizeS], // E
376
+ [_opts.resizeW,0,_rect.width-_opts.resizeE,_opts.resizeN], // N
377
+ [_opts.resizeW,_rect.height-_opts.resizeS,_rect.width-_opts.resizeE,_rect.height], // S
378
+ // drag-area:
379
+ [_opts.resizeW,_opts.resizeN,_rect.width-_opts.resizeE,_rect.height-_opts.resizeS]
380
+ ];
381
+ },
382
+
383
+ /* Method used for initializing the action flags. */
384
+ _initActionFlag: function(){
385
+ this._actionFlag = -1;
386
+ this._actionRects = [];
387
+ var i=0,_rr,_rectRules = this.makeRectRules();
388
+ for(;i<9;i++){
389
+ _rr = _rectRules[i];
390
+ this._actionRects.push( HRect.nu(_rr[0],_rr[1],_rr[2],_rr[3]) );
391
+ }
392
+ },
393
+
394
+ /* Method used to detect the action flags. Also sets the cursor. */
395
+ _detectActionFlag: function(){
396
+ var i,
397
+ _actionPoint = this._startPoint.subtract(this.rect.left,this.rect.top),
398
+ _actionRects = this._actionRects;
399
+ if(this.options.noResize && _actionRects[8].contains(_actionPoint)){
400
+ this._actionFlag = 8;
401
+ this.setStyle('cursor',this._actionCrsr[8]);
402
+ return;
403
+ }
404
+ for(i=0;i!==9;i++){
405
+ if(_actionRects[i].contains(_actionPoint)){
406
+ this._actionFlag=i;
407
+ this.setStyle('cursor',this._actionCrsr[i]);
408
+ return;
409
+ }
410
+ }
411
+ },
412
+
413
+ /** = Description
414
+ * Event method responder that decides and initializes
415
+ * a resize or move operation on the drag events.
416
+ *
417
+ * = Parameters
418
+ * +x+:: The current x coordinate of the mouse cursor.
419
+ * +y+:: The current y coordinate of the mouse cursor.
420
+ * +_isRightButton+:: A flag that is true when right (or context) clicking.
421
+ *
422
+ * = Returns
423
+ * +true+
424
+ *
425
+ **/
426
+ startDrag: function(x,y,_isRightButton){
427
+ var _parent = this.parent;
428
+ if(_parent.elemId){
429
+ x-=_parent.pageX();
430
+ y-=_parent.pageY();
431
+ }
432
+ this._startPoint = new HPoint(x,y);
433
+ this._startRect = new HRect( this.rect );
434
+ this._detectActionFlag();
435
+ if(this._actionFlag!==-1){
436
+ this._actionFns[this._actionFlag](this,x,y);
437
+ }
438
+ return true; // prevents text selection
439
+ },
440
+
441
+ /** = Description
442
+ * Event method responder that performs a resize or move recalculation
443
+ * and redraw call when dragging one of the corners or edges to resize or
444
+ * any other area to move.
445
+ *
446
+ * = Parameters
447
+ * +x+:: The current x coordinate of the mouse cursor.
448
+ * +y+:: The current y coordinate of the mouse cursor.
449
+ *
450
+ * = Returns
451
+ * +true+
452
+ *
453
+ **/
454
+ drag: function(x,y){
455
+ var _parent = this.parent;
456
+ if(_parent.elemId){
457
+ x-=_parent.pageX();
458
+ y-=_parent.pageY();
459
+ }
460
+ if(this._actionFlag!==-1){
461
+ this._actionFns[this._actionFlag](this,x,y);
462
+ }
463
+ return true; // prevents text selection
464
+ },
465
+
466
+ /** = Description
467
+ * Event method responder that ends a resize or move operation.
468
+ * Also restores the mouse cursor.
469
+ *
470
+ * = Parameters
471
+ * +x+:: The current x coordinate of the mouse cursor.
472
+ * +y+:: The current y coordinate of the mouse cursor.
473
+ * +_isRightButton+:: A flag that is true when right (or context) clicking.
474
+ *
475
+ * = Returns
476
+ * +true+
477
+ *
478
+ **/
479
+ endDrag: function(x,y,_isRightButton){
480
+ this.base();
481
+ var _parent = this.parent;
482
+ if(_parent.elemId){
483
+ x-=_parent.pageX();
484
+ y-=_parent.pageY();
485
+ }
486
+ if(this._actionFlag!==-1){
487
+ this._actionFns[this._actionFlag](this,x,y);
488
+ }
489
+ this.setStyle('cursor','default');
490
+ this._initActionFlag();
491
+ EVENT.resize(); // Triggers the window resize event (automatic event for the browser's window).
492
+ return true; // prevents text selection
493
+ }
494
+ });