riojs 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +24 -0
  3. data/VERSION +1 -0
  4. data/bin/rio +5 -0
  5. data/generators/rio_app/USAGE +19 -0
  6. data/generators/rio_app/rio_app_generator.rb +40 -0
  7. data/generators/rio_app/templates/app.build +10 -0
  8. data/generators/rio_app/templates/app.css +0 -0
  9. data/generators/rio_app/templates/app.js +20 -0
  10. data/generators/rio_app/templates/app_view.html.erb +19 -0
  11. data/generators/rio_app/templates/fixture.js +4 -0
  12. data/generators/rio_app/templates/rio.html.erb +18 -0
  13. data/generators/rio_app/templates/rio_controller.rb +2 -0
  14. data/generators/rio_app/templates/spec.js +7 -0
  15. data/generators/rio_component/USAGE +13 -0
  16. data/generators/rio_component/rio_component_generator.rb +16 -0
  17. data/generators/rio_component/templates/component.css +0 -0
  18. data/generators/rio_component/templates/component.js +11 -0
  19. data/generators/rio_component/templates/fixture.js +3 -0
  20. data/generators/rio_component/templates/spec.js +6 -0
  21. data/generators/rio_model/USAGE +12 -0
  22. data/generators/rio_model/rio_model_generator.rb +21 -0
  23. data/generators/rio_model/templates/fixture.js +3 -0
  24. data/generators/rio_model/templates/model.js +9 -0
  25. data/generators/rio_model/templates/spec.js +6 -0
  26. data/generators/rio_page/USAGE +14 -0
  27. data/generators/rio_page/rio_page_generator.rb +16 -0
  28. data/generators/rio_page/templates/fixture.js +3 -0
  29. data/generators/rio_page/templates/page.css +12 -0
  30. data/generators/rio_page/templates/page.js +12 -0
  31. data/generators/rio_page/templates/page.jst +64 -0
  32. data/generators/rio_page/templates/spec.js +6 -0
  33. data/generators/rio_resource/USAGE +20 -0
  34. data/generators/rio_resource/rio_resource_generator.rb +10 -0
  35. data/generators/rio_resource/templates/controller.rb +3 -0
  36. data/init.rb +4 -0
  37. data/install/config/juggernaut_hosts.yml +18 -0
  38. data/install/lib/tasks/rio.rake +1 -0
  39. data/install/script/rio_server +37 -0
  40. data/lib/rio/autospec.rb +86 -0
  41. data/lib/rio/install.rb +90 -0
  42. data/lib/rio/juggernaut.rb +212 -0
  43. data/lib/rio/path.rb +3 -0
  44. data/lib/rio/rio_compressor.rb +219 -0
  45. data/lib/rio/rio_file_controller.rb +16 -0
  46. data/lib/rio/rio_on_rails.rb +586 -0
  47. data/lib/rio/rio_proxy_controller.rb +60 -0
  48. data/lib/rio/rio_push_controller.rb +48 -0
  49. data/lib/rio/rio_routes.rb +24 -0
  50. data/lib/rio/rio_spec_controller.rb +70 -0
  51. data/lib/riojs.rb +14 -0
  52. data/lib/tasks/rio.rb +63 -0
  53. data/public/images/background-chiffon.png +0 -0
  54. data/public/images/button-gradient-overlay-down.png +0 -0
  55. data/public/images/button-gradient-overlay.png +0 -0
  56. data/public/images/icons/add.png +0 -0
  57. data/public/images/icons/error-big.png +0 -0
  58. data/public/images/icons/warning-big.png +0 -0
  59. data/public/images/rio-logo-big.png +0 -0
  60. data/public/images/rio-logo.png +0 -0
  61. data/public/images/splitter-handle-horizontal.png +0 -0
  62. data/public/images/splitter-handle-vertical.png +0 -0
  63. data/public/images/tab-bar-gradient-overlay.png +0 -0
  64. data/public/images/title-gradient-overlay.png +0 -0
  65. data/public/images/trash.gif +0 -0
  66. data/public/javascripts/components/accordion.js +144 -0
  67. data/public/javascripts/components/alert_box.js +59 -0
  68. data/public/javascripts/components/base.js +47 -0
  69. data/public/javascripts/components/box.js +63 -0
  70. data/public/javascripts/components/button.js +98 -0
  71. data/public/javascripts/components/checkbox.js +44 -0
  72. data/public/javascripts/components/container.js +265 -0
  73. data/public/javascripts/components/grid_view.js +107 -0
  74. data/public/javascripts/components/image.js +19 -0
  75. data/public/javascripts/components/input.js +171 -0
  76. data/public/javascripts/components/label.js +15 -0
  77. data/public/javascripts/components/lightbox.js +160 -0
  78. data/public/javascripts/components/link.js +43 -0
  79. data/public/javascripts/components/list_item.js +44 -0
  80. data/public/javascripts/components/list_view.js +192 -0
  81. data/public/javascripts/components/marquee.js +131 -0
  82. data/public/javascripts/components/menu.js +89 -0
  83. data/public/javascripts/components/notification.js +75 -0
  84. data/public/javascripts/components/overlay.js +134 -0
  85. data/public/javascripts/components/panel.js +146 -0
  86. data/public/javascripts/components/radio.js +46 -0
  87. data/public/javascripts/components/splitter.js +65 -0
  88. data/public/javascripts/components/tab_bar.js +64 -0
  89. data/public/javascripts/components/tab_panel.js +57 -0
  90. data/public/javascripts/components/textarea.js +223 -0
  91. data/public/javascripts/components/toggle_button.js +22 -0
  92. data/public/javascripts/components/tooltip.js +80 -0
  93. data/public/javascripts/lib/application.js +482 -0
  94. data/public/javascripts/lib/attr.js +760 -0
  95. data/public/javascripts/lib/benchmark.js +235 -0
  96. data/public/javascripts/lib/blank.html +39 -0
  97. data/public/javascripts/lib/boot.js +300 -0
  98. data/public/javascripts/lib/clipboard.js +96 -0
  99. data/public/javascripts/lib/collection_entity.js +46 -0
  100. data/public/javascripts/lib/component.js +129 -0
  101. data/public/javascripts/lib/console.js +75 -0
  102. data/public/javascripts/lib/console/apps/console.build +43 -0
  103. data/public/javascripts/lib/console/apps/console.js +28 -0
  104. data/public/javascripts/lib/console/blank.html +39 -0
  105. data/public/javascripts/lib/console/components/benchmark.js +196 -0
  106. data/public/javascripts/lib/console/components/console.js +352 -0
  107. data/public/javascripts/lib/console/components/dependencies_list.js +17 -0
  108. data/public/javascripts/lib/console/components/docs.js +66 -0
  109. data/public/javascripts/lib/console/components/playground.js +30 -0
  110. data/public/javascripts/lib/console/console.html +27 -0
  111. data/public/javascripts/lib/console/console_commands.js +287 -0
  112. data/public/javascripts/lib/console/console_commands.js.rej +21 -0
  113. data/public/javascripts/lib/console/console_mixin.js +22 -0
  114. data/public/javascripts/lib/console/docs/files.html +579 -0
  115. data/public/javascripts/lib/console/docs/index.html +323 -0
  116. data/public/javascripts/lib/console/docs/symbols/Object.html +291 -0
  117. data/public/javascripts/lib/console/docs/symbols/_global_.html +413 -0
  118. data/public/javascripts/lib/console/docs/symbols/rio.AIM.html +490 -0
  119. data/public/javascripts/lib/console/docs/symbols/rio.Application.html +841 -0
  120. data/public/javascripts/lib/console/docs/symbols/rio.Attr.html +1075 -0
  121. data/public/javascripts/lib/console/docs/symbols/rio.Binding.html +272 -0
  122. data/public/javascripts/lib/console/docs/symbols/rio.Component.html +419 -0
  123. data/public/javascripts/lib/console/docs/symbols/rio.Cookie.html +543 -0
  124. data/public/javascripts/lib/console/docs/symbols/rio.DelayedTask#initialize.html +270 -0
  125. data/public/javascripts/lib/console/docs/symbols/rio.DelayedTask.html +391 -0
  126. data/public/javascripts/lib/console/docs/symbols/rio.JsTemplate.html +271 -0
  127. data/public/javascripts/lib/console/docs/symbols/rio.Juggernaut.html +329 -0
  128. data/public/javascripts/lib/console/docs/symbols/rio.Model.html +822 -0
  129. data/public/javascripts/lib/console/docs/symbols/rio.Page.html +383 -0
  130. data/public/javascripts/lib/console/docs/symbols/rio.Template.html +328 -0
  131. data/public/javascripts/lib/console/docs/symbols/rio.Utils.html +617 -0
  132. data/public/javascripts/lib/console/docs/symbols/rio.html +506 -0
  133. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_components_base.js.html +54 -0
  134. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_application.js.html +490 -0
  135. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_attr.js.html +768 -0
  136. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_boot.js.html +308 -0
  137. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_clipboard.js.html +103 -0
  138. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_collection_entity.js.html +53 -0
  139. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_component.js.html +137 -0
  140. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_cookie.js.html +81 -0
  141. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_delayed_task.js.html +68 -0
  142. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_file.js.html +80 -0
  143. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_flash_detect.js.html +129 -0
  144. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_form.js.html +95 -0
  145. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_id.js.html +50 -0
  146. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_inflector.js.html +167 -0
  147. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_js_template.js.html +283 -0
  148. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_juggernaut.js.html +303 -0
  149. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_key_map.js.html +68 -0
  150. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_layout_manager.js.html +175 -0
  151. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_log.js.html +17 -0
  152. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_model.js.html +1074 -0
  153. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_page.js.html +246 -0
  154. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_parameters.js.html +66 -0
  155. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_protohack.js.html +305 -0
  156. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_push.js.html +12 -0
  157. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_rsh.js.html +659 -0
  158. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_swfobject.js.html +12 -0
  159. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_tag.js.html +60 -0
  160. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_template.js.html +64 -0
  161. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_theme.js.html +105 -0
  162. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_undo.js.html +142 -0
  163. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_utils.js.html +87 -0
  164. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_yaml.js.html +88 -0
  165. data/public/javascripts/lib/console/file-small.png +0 -0
  166. data/public/javascripts/lib/console/green-circle.png +0 -0
  167. data/public/javascripts/lib/console/loading.gif +0 -0
  168. data/public/javascripts/lib/console/pages/console_page.js +149 -0
  169. data/public/javascripts/lib/console/pages/console_page.jst +27 -0
  170. data/public/javascripts/lib/console/red-circle.png +0 -0
  171. data/public/javascripts/lib/cookie.js +74 -0
  172. data/public/javascripts/lib/delayed_task.js +61 -0
  173. data/public/javascripts/lib/dependencies.js +76 -0
  174. data/public/javascripts/lib/environment.js +30 -0
  175. data/public/javascripts/lib/event.simulate.js +137 -0
  176. data/public/javascripts/lib/expressinstall.swf +0 -0
  177. data/public/javascripts/lib/file.js +72 -0
  178. data/public/javascripts/lib/flash_detect.js +122 -0
  179. data/public/javascripts/lib/flashembed.min.js +16 -0
  180. data/public/javascripts/lib/form.js +88 -0
  181. data/public/javascripts/lib/id.js +43 -0
  182. data/public/javascripts/lib/inflector.js +160 -0
  183. data/public/javascripts/lib/instrumenter.js +106 -0
  184. data/public/javascripts/lib/js_template.js +275 -0
  185. data/public/javascripts/lib/jslint.js +4950 -0
  186. data/public/javascripts/lib/juggernaut.js +295 -0
  187. data/public/javascripts/lib/juggernaut.swf +0 -0
  188. data/public/javascripts/lib/key_map.js +60 -0
  189. data/public/javascripts/lib/layout_manager.js +167 -0
  190. data/public/javascripts/lib/model.js +1067 -0
  191. data/public/javascripts/lib/page.js +238 -0
  192. data/public/javascripts/lib/parameters.js +59 -0
  193. data/public/javascripts/lib/png_fix.js +75 -0
  194. data/public/javascripts/lib/protohack.js +297 -0
  195. data/public/javascripts/lib/push.js +5 -0
  196. data/public/javascripts/lib/rio.build +28 -0
  197. data/public/javascripts/lib/rio_development.build +5 -0
  198. data/public/javascripts/lib/rio_lint.js +66 -0
  199. data/public/javascripts/lib/rsh.js +651 -0
  200. data/public/javascripts/lib/spec.js +545 -0
  201. data/public/javascripts/lib/spec_runner.js +242 -0
  202. data/public/javascripts/lib/swfobject.js +5 -0
  203. data/public/javascripts/lib/tag.js +52 -0
  204. data/public/javascripts/lib/undo.js +134 -0
  205. data/public/javascripts/lib/utils.js +80 -0
  206. data/public/javascripts/lib/yaml.js +80 -0
  207. data/public/javascripts/pages/playground_page.js +15 -0
  208. data/public/javascripts/prototype/builder.js +146 -0
  209. data/public/javascripts/prototype/controls.js +1004 -0
  210. data/public/javascripts/prototype/dragdrop.js +1030 -0
  211. data/public/javascripts/prototype/effects.js +1137 -0
  212. data/public/javascripts/prototype/prototype.js +4320 -0
  213. data/public/javascripts/prototype/slider.js +283 -0
  214. data/public/javascripts/prototype/sound.js +67 -0
  215. data/public/javascripts/specs/components/box_spec.js +6 -0
  216. data/public/javascripts/specs/components/checkbox_spec.js +26 -0
  217. data/public/javascripts/specs/components/container_spec.js +6 -0
  218. data/public/javascripts/specs/components/input_spec.js +71 -0
  219. data/public/javascripts/specs/components/panel_spec.js +6 -0
  220. data/public/javascripts/specs/components/radio_spec.js +40 -0
  221. data/public/javascripts/specs/fixtures/components/box.js +3 -0
  222. data/public/javascripts/specs/fixtures/components/checkbox.js +9 -0
  223. data/public/javascripts/specs/fixtures/components/container.js +3 -0
  224. data/public/javascripts/specs/fixtures/components/input.js +12 -0
  225. data/public/javascripts/specs/fixtures/components/menu.js +19 -0
  226. data/public/javascripts/specs/fixtures/components/menu_item.js +18 -0
  227. data/public/javascripts/specs/fixtures/components/radio.js +11 -0
  228. data/public/javascripts/specs/lib/application_spec.js +281 -0
  229. data/public/javascripts/specs/lib/attr_spec.js +1514 -0
  230. data/public/javascripts/specs/lib/benchmark_spec.js +361 -0
  231. data/public/javascripts/specs/lib/collection_entity_spec.js +131 -0
  232. data/public/javascripts/specs/lib/component_spec.js +86 -0
  233. data/public/javascripts/specs/lib/form_spec.js +171 -0
  234. data/public/javascripts/specs/lib/id_spec.js +21 -0
  235. data/public/javascripts/specs/lib/instrumenter_spec.js +5 -0
  236. data/public/javascripts/specs/lib/js_template_spec.js +131 -0
  237. data/public/javascripts/specs/lib/key_map_spec.js +227 -0
  238. data/public/javascripts/specs/lib/model_spec.js +2268 -0
  239. data/public/javascripts/specs/lib/parameters_spec.js +94 -0
  240. data/public/javascripts/specs/lib/spec_spec.js +943 -0
  241. data/public/javascripts/specs/lib/undo_spec.js +105 -0
  242. data/public/javascripts/specs/lib/yaml_spec.js +127 -0
  243. data/public/sounds/basso.wav +0 -0
  244. data/public/sounds/purr.wav +0 -0
  245. data/public/stylesheets/components/accordion.css +24 -0
  246. data/public/stylesheets/components/alert_box.css +35 -0
  247. data/public/stylesheets/components/box.css +0 -0
  248. data/public/stylesheets/components/button.css +39 -0
  249. data/public/stylesheets/components/checkbox.css +9 -0
  250. data/public/stylesheets/components/container.css +3 -0
  251. data/public/stylesheets/components/grid_view.css +52 -0
  252. data/public/stylesheets/components/input.css +10 -0
  253. data/public/stylesheets/components/label.css +3 -0
  254. data/public/stylesheets/components/lightbox.css +31 -0
  255. data/public/stylesheets/components/link.css +4 -0
  256. data/public/stylesheets/components/list_view.css +23 -0
  257. data/public/stylesheets/components/marquee.css +29 -0
  258. data/public/stylesheets/components/menu.css +34 -0
  259. data/public/stylesheets/components/notification.css +52 -0
  260. data/public/stylesheets/components/overlay.css +8 -0
  261. data/public/stylesheets/components/panel.css +36 -0
  262. data/public/stylesheets/components/radio.css +9 -0
  263. data/public/stylesheets/components/splitter.css +35 -0
  264. data/public/stylesheets/components/tab_bar.css +59 -0
  265. data/public/stylesheets/components/tab_panel.css +15 -0
  266. data/public/stylesheets/components/textarea.css +11 -0
  267. data/public/stylesheets/components/tooltip.css +10 -0
  268. data/public/stylesheets/console.css +151 -0
  269. data/public/stylesheets/css_reset.css +55 -0
  270. metadata +343 -0
@@ -0,0 +1,59 @@
1
+ rio.components.AlertBox = rio.Component.create("AlertBox", {
2
+ require: ["components/lightbox", "components/button"],
3
+ requireCss: "alert_box",
4
+ attrReaders: [
5
+ "body",
6
+ ["title", "Alert"],
7
+ ["buttonText", "OK"],
8
+ ["deactivateOnEscape", true],
9
+ ["deactivateOnClick", true]
10
+ ],
11
+ attrHtmls: ["body"],
12
+ attrEvents: ["close"],
13
+ methods: {
14
+ initialize: function() {
15
+ this._lightbox = new rio.components.Lightbox({
16
+ content: this.bodyHtml(),
17
+ deactivateOnClick: this.getDeactivateOnClick(),
18
+ deactivateOnEscape: this.getDeactivateOnEscape(),
19
+ deactivate: this.fire.bind(this, "close")
20
+ });
21
+ this._lightbox.activate();
22
+ },
23
+
24
+ buildBodyHtml: function() {
25
+ var bodyHtml = rio.Tag.div("", { className: "alertBoxBody" });
26
+
27
+ bodyHtml.update(this.getBody());
28
+
29
+ var okButton = new rio.components.Button({
30
+ text: this.getButtonText(),
31
+ useNative: false,
32
+ onClick: this.close.bind(this)
33
+ });
34
+
35
+ var okHtml = rio.Tag.div(okButton, { className: "ok" });
36
+
37
+ var headerHtml = rio.Tag.div(this.getTitle(), {
38
+ className: "alertBoxTitle"
39
+ });
40
+
41
+ var innerHtml = rio.Tag.div([
42
+ headerHtml,
43
+ bodyHtml,
44
+ okHtml
45
+ ], {
46
+ className: "alertBoxInner"
47
+ });
48
+
49
+ return rio.Tag.div(innerHtml, {
50
+ className: "alertBox"
51
+ });
52
+ },
53
+
54
+ close: function() {
55
+ this._lightbox.deactivate();
56
+ this.fire("close");
57
+ }
58
+ }
59
+ });
@@ -0,0 +1,47 @@
1
+ rio.components.Base = rio.Component.create("Base", {
2
+ attrReaders: [
3
+ ["className", ""],
4
+ ["seleniumId", ""]
5
+ ],
6
+ styles: ["position", "top", "right", "bottom", "left", "display"],
7
+ methods: {
8
+ html: function() {
9
+ if (!this._html) {
10
+ this._html = this.buildHtml();
11
+ this._html.addClassName(this.getClassName());
12
+
13
+ if (rio.environment.supportSelenium) {
14
+ this._html.id = this.getSeleniumId();
15
+ }
16
+
17
+ this._html.applyStyle({
18
+ position: this.position,
19
+ top: this.top,
20
+ right: this.right,
21
+ bottom: this.bottom,
22
+ left: this.left,
23
+ display: this.display
24
+ });
25
+ }
26
+ return this._html;
27
+ },
28
+
29
+ addClassName: function(className) {
30
+ this.html().addClassName(className);
31
+ this._className = this.html().className;
32
+ },
33
+
34
+ removeClassName: function(className) {
35
+ this.html().removeClassName(className);
36
+ this._className = this.html().className;
37
+ },
38
+
39
+ show: function() {
40
+ this.setDisplay("");
41
+ },
42
+
43
+ hide: function() {
44
+ this.setDisplay("none");
45
+ }
46
+ }
47
+ });
@@ -0,0 +1,63 @@
1
+ rio.components.Box = rio.Component.create(rio.components.Base, "Box", {
2
+ requireCss: "box",
3
+ attrAccessors: [
4
+ ["showing", true]
5
+ ],
6
+ attrReaders: ["region"],
7
+ attrHtmls: ["box"],
8
+ styles: [
9
+ "backgroundColor",
10
+ "fontSize", "fontWeight",
11
+ "height", "width",
12
+ "border", "borderTop", "borderRight", "borderBottom", "borderLeft",
13
+ "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft",
14
+ "margin", "marginTop", "marginRight", "marginBottom", "marginLeft",
15
+ "overflow", "overflowX", "overflowY"
16
+ ],
17
+ methods: {
18
+
19
+ buildHtml: function() {
20
+ return this.boxHtml();
21
+ },
22
+
23
+ buildBoxHtml: function() {
24
+ this.showing.bind(function() {
25
+ rio.ContainerLayout.resize();
26
+ }, true);
27
+ var boxHtml = rio.Tag.div("");
28
+ boxHtml.applyStyle(this.boxStyles());
29
+ return boxHtml;
30
+ },
31
+
32
+ resize: function() {
33
+ // This method will be called when the layout manager resizes the Box
34
+ },
35
+
36
+ boxStyles: function() {
37
+ return {
38
+ height: this.height,
39
+ width: this.width,
40
+ margin: this.margin,
41
+ marginTop: this.marginTop,
42
+ marginRight: this.marginRight,
43
+ marginBottom: this.marginBottom,
44
+ marginLeft: this.marginLeft,
45
+ paddingTop: this.paddingTop,
46
+ paddingRight: this.paddingRight,
47
+ paddingBottom: this.paddingBottom,
48
+ paddingLeft: this.paddingLeft,
49
+ padding: this.padding,
50
+ border: this.border,
51
+ borderTop: this.borderTop,
52
+ borderRight: this.borderRight,
53
+ borderBottom: this.borderBottom,
54
+ borderLeft: this.borderLeft,
55
+ backgroundColor: this.backgroundColor,
56
+ fontSize: this.fontSize,
57
+ overflow: this.overflow,
58
+ overflowX: this.overflowX,
59
+ overflowY: this.overflowY
60
+ };
61
+ }
62
+ }
63
+ });
@@ -0,0 +1,98 @@
1
+ rio.components.Button = rio.Component.create(rio.components.Base, "Button", {
2
+ require: ["components/tooltip", "components/image"],
3
+ requireCss: "button",
4
+ attrAccessors: [
5
+ "text",
6
+ "tip",
7
+ "imageSrc",
8
+ "hoverImageSrc",
9
+ "disabledImageSrc",
10
+ "iconSrc",
11
+ ["enabled", true]
12
+ ],
13
+ attrReaders: [
14
+ ["useNative", true]
15
+ ],
16
+ attrEvents: ["click"],
17
+ methods: {
18
+ buildHtml: function() {
19
+ var buttonHtml;
20
+ if (this.getImageSrc() != undefined) {
21
+ var image = new rio.components.Image({ src: this.getImageSrc() });
22
+ buttonHtml = image.html();
23
+
24
+ this.enabled.bind(function(enabled) {
25
+ buttonHtml.setStyle({ cursor: enabled ? "pointer" : "default" });
26
+ if (this.getDisabledImageSrc()) {
27
+ image.setSrc(enabled ? this.getImageSrc() : this.getDisabledImageSrc());
28
+ }
29
+ }.bind(this));
30
+
31
+ if (this.getHoverImageSrc()) {
32
+ buttonHtml.observe("mouseover", function() {
33
+ if (this.getDisabledImageSrc() && !this.getEnabled()) { return; }
34
+ image.setSrc(this.getHoverImageSrc());
35
+ }.bind(this));
36
+ buttonHtml.observe("mouseout", function() {
37
+ if (this.getDisabledImageSrc() && !this.getEnabled()) { return; }
38
+ image.setSrc(this.getImageSrc());
39
+ }.bind(this));
40
+ }
41
+ } else {
42
+ if (this.getUseNative()) {
43
+ buttonHtml = rio.Tag.button("");
44
+ this.enabled.bind(function(enabled) {
45
+ buttonHtml.disabled = !enabled;
46
+ });
47
+
48
+ this.bind("text", function(text) {
49
+ buttonHtml.update(text);
50
+ });
51
+ } else {
52
+ buttonHtml = rio.Tag.div("", { className: "button" });
53
+ buttonHtml.addHoverClass("buttonHover");
54
+
55
+ var updateContent = function() {
56
+ var iconSrc = this.getIconSrc("/images/icons/plus.png");
57
+ buttonHtml.update();
58
+ if (iconSrc) {
59
+ buttonHtml.insert(rio.Tag.img("", { src: rio.url(iconSrc) }));
60
+ }
61
+ buttonHtml.insert(this.getText());
62
+ }.bind(this);
63
+
64
+ this.text.bind(updateContent);
65
+ this.iconSrc.bind(updateContent);
66
+
67
+ buttonHtml.observe("mousedown", function() {
68
+ buttonHtml.addClassName("buttonDown");
69
+ });
70
+ buttonHtml.observe("mouseup", function() {
71
+ buttonHtml.removeClassName("buttonDown");
72
+ });
73
+ buttonHtml.observe("mouseout", function() {
74
+ buttonHtml.removeClassName("buttonDown");
75
+ });
76
+
77
+ this.enabled.bind(function(enabled) {
78
+ buttonHtml[enabled ? "removeClassName" : "addClassName"]("buttonDisabled");
79
+ });
80
+ }
81
+ }
82
+
83
+ this.bind("tip", function(tip) {
84
+ if (tip && !tip.blank() && !this._tooltip) {
85
+ new rio.components.Tooltip({ elt: buttonHtml, tip: this.tip, fixed: true });
86
+ }
87
+ }.bind(this));
88
+
89
+ buttonHtml.observe("click", function(e) {
90
+ if (!this.getEnabled()) { return; }
91
+ this.fire("click");
92
+ e.stop();
93
+ }.bindAsEventListener(this));
94
+
95
+ return buttonHtml;
96
+ }
97
+ }
98
+ });
@@ -0,0 +1,44 @@
1
+ rio.components.Checkbox = rio.Component.create(rio.components.Base, "Checkbox", {
2
+ require: ["components/label"],
3
+ requireCss: "checkbox",
4
+ attrAccessors: [
5
+ "checked",
6
+ "label",
7
+ ["disabled", false]
8
+ ],
9
+ attrReaders: [],
10
+ attrEvents: ["click"],
11
+ methods: {
12
+ buildHtml: function() {
13
+ var randomId = "_rio_label_" + Math.random();
14
+
15
+ var checkboxHtml = rio.Tag.input("", {
16
+ id: randomId,
17
+ type: "checkbox"
18
+ });
19
+ var labelHtml = rio.Tag.label("", {
20
+ htmlFor: randomId,
21
+ className: "checkboxLabel"
22
+ });
23
+
24
+ this.label.bind(function(label) {
25
+ labelHtml.update(label);
26
+ });
27
+
28
+ this.bind("checked", function(checked) {
29
+ checkboxHtml.checked = checked;
30
+ });
31
+
32
+ this.bind("disabled", function(disabled) {
33
+ checkboxHtml.disabled = disabled;
34
+ });
35
+
36
+ checkboxHtml.observe("click", function() {
37
+ this.setChecked(checkboxHtml.checked);
38
+ this.fire("click");
39
+ }.bind(this));
40
+
41
+ return rio.Tag.span([checkboxHtml, labelHtml], { className: "checkbox" });
42
+ }
43
+ }
44
+ });
@@ -0,0 +1,265 @@
1
+ rio.Application.require("components/box");
2
+
3
+ rio.components.Container = rio.Component.create(rio.components.Box, "Container", {
4
+ requireCss: "container",
5
+ attrAccessors: [["items", []]],
6
+ attrReaders: [
7
+ ["layout", false]
8
+ ],
9
+ methods: {
10
+ buildHtml: function() {
11
+ var html = this.boxHtml();
12
+
13
+ html.observe("selectstart", function(e) {
14
+ if (e.target == html) {
15
+ e.stop();
16
+ }
17
+ }.bindAsEventListener(this));
18
+
19
+ html.addClassName("container");
20
+
21
+ this.items.bind(function(items) {
22
+ items = [items].flatten();
23
+ html.update();
24
+ items.each(function(item) {
25
+ html.insert(item);
26
+ });
27
+
28
+ if (this.getLayout()) {
29
+ html.setStyle({ overflow: "hidden" });
30
+ if (this.getLayout() == "fit") {
31
+ var fitLayout = new rio.FitLayout({
32
+ parent: html,
33
+ items: items
34
+ });
35
+ this._resize = fitLayout.resize.bind(fitLayout);
36
+ } else {
37
+ var containerLayout = new rio.ContainerLayout({
38
+ parent: html,
39
+ items: items
40
+ });
41
+ this._resize = containerLayout.resize.bind(containerLayout);
42
+ }
43
+ }
44
+ }.bind(this));
45
+
46
+ return html;
47
+ },
48
+
49
+ resize: function() {
50
+ if (this._resize) { this._resize(); }
51
+ if (!this.getLayout()) {
52
+ [this.getItems()].flatten().each(function(item) {
53
+ if (item.resize && !(item.getLayout && item.getLayout())) {
54
+ item.resize();
55
+ }
56
+ });
57
+ }
58
+ }
59
+ }
60
+ });
61
+
62
+ rio.Layout = Class.create({
63
+ initialize: function(options) {
64
+ this.parent = options.parent;
65
+ this.items = options.items;
66
+ this.parent.setStyle({
67
+ position: "relative"
68
+ });
69
+
70
+ $w("top left right bottom").each(function(key) {
71
+ this.parent[key] = this.padding(this.parent, key);
72
+ }.bind(this));
73
+ },
74
+
75
+ fullPadding: function(element, s) {
76
+ return this.padding(element, s) + this.border(element, s) + this.margin(element, s);
77
+ },
78
+
79
+ border: function(element, s) {
80
+ var border = parseInt(element.getStyle("border-" + s + "-width") || 0, 10);
81
+ if (isNaN(border)) { // Test for IE!!
82
+ border = 0;
83
+ }
84
+ return border;
85
+ },
86
+
87
+ padding: function(element, s) {
88
+ var padding = parseInt(element.getStyle("padding-" + s) || 0, 10);
89
+ if (isNaN(padding)) { // Test for IE!!
90
+ padding = 0;
91
+ }
92
+ return padding;
93
+ },
94
+
95
+ margin: function(element, s) {
96
+ var margin = parseInt(element.getStyle("margin-" + s) || 0, 10);
97
+ if (isNaN(margin)) { // Test for IE!!
98
+ margin = 0;
99
+ }
100
+ return margin;
101
+ },
102
+
103
+ setPositivePxValue:function(objet, key, value) {
104
+ objet[key] = (value > 0 ? value : 0) + "px";
105
+ },
106
+
107
+ setPixelMetrics: function(element) {
108
+ element.style.position = "absolute";
109
+ element.paddingWidth = this.fullPadding(element, "left") + this.fullPadding(element, "right");
110
+ element.paddingHeight = this.fullPadding(element, "top") + this.fullPadding(element, "bottom");
111
+ element.marginWidth = this.margin(element, "left") + this.margin(element, "right");
112
+ element.marginHeight = this.margin(element, "top") + this.margin(element, "bottom");
113
+ }
114
+ });
115
+
116
+ rio.FitLayout = Class.create(rio.Layout, {
117
+ initialize: function($super, options) {
118
+ $super(options);
119
+
120
+ if (this.items.length != 1) {
121
+ throw("Fit layouts require exactly one element");
122
+ }
123
+ this.setPixelMetrics(this.element());
124
+ },
125
+
126
+ element: function() {
127
+ var item = this.items.first();
128
+ return item.html ? item.html() : item;
129
+ },
130
+
131
+ resize: function() {
132
+ if (!Element.isRendered(this.parent)) { return; }
133
+
134
+ var element = this.element();
135
+ var parent = this.parent;
136
+
137
+ var d = this.parent.getDimensions();
138
+
139
+ var leftOffset = this.padding(parent, "left") + this.border(parent, "left");
140
+ var rightOffset = this.padding(parent, "right") + this.border(parent, "right");
141
+ var topOffset = this.padding(parent, "top") + this.border(parent, "top");
142
+ var bottomOffset = this.padding(parent, "bottom") + this.border(parent, "bottom");
143
+ var w = d.width - leftOffset - rightOffset;
144
+ var h = d.height - topOffset - bottomOffset;
145
+
146
+ var s = element.style;
147
+ s.top = topOffset + "px";
148
+ s.left = leftOffset + "px";
149
+ s.width = (w - element.horizontalMBP()) + "px";
150
+ s.height = (h - element.verticalMBP()) + "px";
151
+ }
152
+ });
153
+
154
+ rio.ContainerLayout = Class.create(rio.Layout, {
155
+ initialize: function($super, options) {
156
+ $super(options);
157
+ this.manageParentHeight = this.parent.getStyle("height") == "100%";
158
+
159
+ this.items.each(function(item) {
160
+ this.setPixelMetrics(item.html());
161
+ this[item.getRegion()] = item;
162
+ }.bind(this));
163
+
164
+ if (!rio.ContainerLayout._containers) { rio.ContainerLayout._containers = []; }
165
+ rio.ContainerLayout._containers.unshift(this);
166
+ rio.ContainerLayout.resize.bind(this).defer();
167
+ },
168
+
169
+ // This method needs some serious refactoring.
170
+ resize: function() {
171
+ if (!Element.isRendered(this.parent)) { return; }
172
+ if (this.manageParentHeight) {
173
+ this.parent.setStyle({
174
+ height: this.parent.ancestors()[0].getHeight() - this.padding(this.parent, "bottom") + "px"
175
+ });
176
+ }
177
+
178
+ var d = this.parent.getDimensions();
179
+ var w = d.width - this.parent.left - this.border(this.parent, "left") - this.border(this.parent, "right") - this.padding(this.parent, "right");
180
+ var h = d.height - this.parent.top - this.parent.bottom - this.border(this.parent, "top") - this.border(this.parent, "bottom") - this.padding(this.parent, "bottom") - this.padding(this.parent, "top");
181
+ var that = this; // To avoid too many binds
182
+
183
+ // Set position and size of all top elements
184
+ var s;
185
+ var top = this.parent.top + this.padding(this.parent, "top");
186
+ var lessTop = (!this.north || this.north.getShowing()) ? 0 : this.north.html().getHeight();
187
+ if (this.north) {
188
+ s = this.north.html().style;
189
+ that.setPositivePxValue(s, 'width', w - this.north.html().paddingWidth);
190
+ s.top = top - lessTop + "px";
191
+ top += this.north.html().getHeight() + this.north.html().marginHeight + this.border(this.north.html(), "top") + this.border(this.north.html(), "bottom");
192
+ }
193
+ h -= top - this.parent.top - this.padding(this.parent, "top");
194
+
195
+ // Set position and size of all bottom elements
196
+ var bottom = this.parent.bottom + this.padding(this.parent, "bottom");
197
+ var lessBottom = (!this.south || this.south.getShowing()) ? 0 : this.south.html().getHeight();
198
+ if (this.south) {
199
+ s = this.south.html().style;
200
+ that.setPositivePxValue(s, 'width', w - this.south.html().paddingWidth);
201
+ s.bottom = bottom - lessBottom + "px";
202
+ bottom += this.south.html().getHeight() + this.south.html().marginHeight + this.border(this.south.html(), "top") + this.border(this.south.html(), "bottom");
203
+ }
204
+ h -= bottom - this.parent.bottom - this.padding(this.parent, "bottom");
205
+
206
+ // Set position and size of all left elements
207
+ var left = this.parent.left;
208
+ var lessLeft = (!this.west || this.west.getShowing()) ? 0 : this.west.html().getWidth();
209
+ if (this.west) {
210
+ s = this.west.html().style;
211
+ that.setPositivePxValue(s, 'height', h - this.west.html().paddingHeight + lessTop + lessBottom);
212
+ s.top = top - lessTop + "px";
213
+ s.left = left - lessLeft + "px";
214
+ left += this.west.html().getWidth() + this.west.html().marginWidth;
215
+ }
216
+ w -= left - this.padding(this.parent, "left");
217
+
218
+ // Set position and size of all right elements
219
+ var right = this.parent.right;
220
+ var lessRight = (!this.east || this.east.getShowing()) ? 0 : this.east.html().getWidth() + this.margin(this.east.html(), "left") + this.margin(this.east.html(), "right");
221
+ if (this.east) {
222
+ s = this.east.html().style;
223
+ that.setPositivePxValue(s, 'height', h - this.east.html().paddingHeight + lessTop + lessBottom);
224
+ s.top = top - lessTop + "px";
225
+ s.right = right - lessRight + "px";
226
+ right += this.east.html().getWidth() + this.east.html().marginWidth;
227
+ }
228
+ w -= right - this.padding(this.parent, "right");
229
+
230
+ // Set position and size of all center elements
231
+ // Only one center for this version
232
+ var center = this.center.html();
233
+ s = center.style;
234
+ s.top = top - lessTop + "px";
235
+ s.left = left - lessLeft + "px";
236
+
237
+ // var extra = 0;
238
+ this.setPositivePxValue(s, 'width', w - center.horizontalMBP() + lessLeft + lessRight);
239
+ this.setPositivePxValue(s, 'height', h - center.paddingHeight + lessTop + lessBottom);
240
+
241
+ if(this.north) { this.north.resize(); }
242
+ if(this.south) { this.south.resize(); }
243
+ if(this.east) { this.east.resize(); }
244
+ if(this.west) { this.west.resize(); }
245
+ if(this.center) { this.center.resize(); }
246
+ }
247
+ });
248
+
249
+ rio.ContainerLayout.resize = function() {
250
+ if (rio.ContainerLayout._containers) {
251
+ rio.ContainerLayout._containers.invoke("resize");
252
+ }
253
+ };
254
+ Event.observe(window, "resize", rio.ContainerLayout.resize.bind(rio.ContainerLayout));
255
+ Event.observe(window, "load", rio.ContainerLayout.resize.bind(rio.ContainerLayout));
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+