rsence-pre 2.1.0.1.pre

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