glimmer-dsl-opal 0.9.3 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +114 -49
  5. data/VERSION +1 -1
  6. data/lib/display.rb +1 -1
  7. data/lib/glimmer-dsl-opal.rb +3 -2
  8. data/lib/glimmer-dsl-opal/ext/file.rb +1 -1
  9. data/lib/glimmer-dsl-opal/ext/glimmer/dsl/engine.rb +8 -4
  10. data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact_repository.rb +4 -4
  11. data/lib/glimmer-dsl-opal/samples/elaborate/login.rb +7 -7
  12. data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +3 -3
  13. data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +1 -1
  14. data/lib/glimmer-dsl-opal/samples/hello/hello_button.rb +2 -2
  15. data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +5 -5
  16. data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +1 -1
  17. data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +2 -2
  18. data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +6 -6
  19. data/lib/glimmer-dsl-opal/samples/hello/hello_computed/contact.rb +1 -1
  20. data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +1 -1
  21. data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +1 -1
  22. data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +5 -5
  23. data/lib/glimmer-dsl-opal/samples/hello/hello_dialog.rb +78 -0
  24. data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +7 -7
  25. data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +2 -2
  26. data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +2 -2
  27. data/lib/glimmer-dsl-opal/samples/hello/hello_menu_bar.rb +1 -1
  28. data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +1 -1
  29. data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +1 -1
  30. data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +7 -7
  31. data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +1 -1
  32. data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +1 -1
  33. data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +1 -1
  34. data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +1 -1
  35. data/lib/glimmer-dsl-swt.rb +1 -1
  36. data/lib/glimmer/data_binding/table_items_binding.rb +2 -1
  37. data/lib/glimmer/dsl/opal/async_exec_expression.rb +1 -1
  38. data/lib/glimmer/dsl/opal/bind_expression.rb +24 -25
  39. data/lib/glimmer/dsl/opal/block_property_expression.rb +1 -1
  40. data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +1 -1
  41. data/lib/glimmer/dsl/opal/color_expression.rb +1 -1
  42. data/lib/glimmer/dsl/opal/custom_widget_expression.rb +7 -7
  43. data/lib/glimmer/dsl/opal/dialog_expression.rb +20 -0
  44. data/lib/glimmer/dsl/opal/display_expression.rb +1 -1
  45. data/lib/glimmer/dsl/opal/dsl.rb +5 -1
  46. data/lib/glimmer/dsl/opal/exec_expression.rb +1 -1
  47. data/lib/glimmer/dsl/opal/font_expression.rb +1 -1
  48. data/lib/glimmer/dsl/opal/menu_bar_expression.rb +1 -1
  49. data/lib/glimmer/dsl/opal/menu_expression.rb +2 -2
  50. data/lib/glimmer/dsl/opal/message_box_expression.rb +1 -1
  51. data/lib/glimmer/dsl/opal/property_expression.rb +2 -1
  52. data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +1 -1
  53. data/lib/glimmer/dsl/opal/rgb_expression.rb +1 -1
  54. data/lib/glimmer/dsl/opal/rgba_expression.rb +1 -1
  55. data/lib/glimmer/dsl/opal/shape_expression.rb +26 -0
  56. data/lib/glimmer/dsl/opal/shell_expression.rb +1 -1
  57. data/lib/glimmer/dsl/opal/shine_data_binding_expression.rb +49 -0
  58. data/lib/glimmer/dsl/opal/swt_expression.rb +4 -4
  59. data/lib/glimmer/dsl/opal/sync_exec_expression.rb +1 -1
  60. data/lib/glimmer/dsl/opal/widget_expression.rb +1 -1
  61. data/lib/glimmer/swt.rb +1 -1
  62. data/lib/glimmer/swt/color_proxy.rb +1 -1
  63. data/lib/glimmer/swt/combo_proxy.rb +1 -0
  64. data/lib/glimmer/swt/composite_proxy.rb +18 -2
  65. data/lib/glimmer/swt/control_editor.rb +1 -1
  66. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  67. data/lib/glimmer/swt/custom/radio_group.rb +1 -1
  68. data/lib/glimmer/swt/dialog_proxy.rb +188 -0
  69. data/lib/glimmer/swt/display_proxy.rb +132 -9
  70. data/lib/glimmer/swt/font_proxy.rb +1 -1
  71. data/lib/glimmer/swt/grid_layout_proxy.rb +28 -33
  72. data/lib/glimmer/swt/label_proxy.rb +1 -1
  73. data/lib/glimmer/swt/latest_dialog_proxy.rb +44 -0
  74. data/lib/glimmer/swt/latest_message_box_proxy.rb +4 -2
  75. data/lib/glimmer/swt/latest_shell_proxy.rb +7 -3
  76. data/lib/glimmer/swt/layout_data_proxy.rb +4 -0
  77. data/lib/glimmer/swt/layout_proxy.rb +9 -6
  78. data/lib/glimmer/swt/make_shift_shell_proxy.rb +1 -1
  79. data/lib/glimmer/swt/menu_item_proxy.rb +1 -1
  80. data/lib/glimmer/swt/menu_proxy.rb +1 -1
  81. data/lib/glimmer/swt/message_box_proxy.rb +23 -17
  82. data/lib/glimmer/swt/row_layout_proxy.rb +34 -7
  83. data/lib/glimmer/swt/shell_proxy.rb +43 -9
  84. data/lib/glimmer/swt/style_constantizable.rb +1 -1
  85. data/lib/glimmer/swt/swt_proxy.rb +1 -1
  86. data/lib/glimmer/swt/tab_folder_proxy.rb +1 -1
  87. data/lib/glimmer/swt/table_editor.rb +1 -1
  88. data/lib/glimmer/swt/table_item_proxy.rb +1 -1
  89. data/lib/glimmer/swt/table_proxy.rb +1 -1
  90. data/lib/glimmer/swt/widget_proxy.rb +53 -21
  91. data/lib/glimmer/ui/custom_shell.rb +17 -3
  92. data/lib/glimmer/ui/custom_widget.rb +1 -1
  93. data/lib/glimmer/util/proc_tracker.rb +17 -6
  94. data/lib/net/http.rb +1 -1
  95. data/lib/os.rb +1 -1
  96. metadata +17 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 413c672e156087e669f81c8c73c6dfcc6b29146f058c6c317c80cfa1f10d9e31
4
- data.tar.gz: 930793a35af93d316d44652ba386fab64b73bef069feb6a8919136db61879238
3
+ metadata.gz: c9eec417d33069c8ecf49c9450b46f7552702d2e83993334f7289739c4b61440
4
+ data.tar.gz: 2d3a8606327d4686ef21d18e605a29679a8f47663959b6e971777fca928b2fe4
5
5
  SHA512:
6
- metadata.gz: 606f6324b4018f8a3dfd4df28c885825cf889d39674a6c80cc835f3035b3e58d64e3b88a18f258cd940ba99ad12b679d381f34cf4c171eb4d5ccb43bf2d91efa
7
- data.tar.gz: 79ede1aea3bc7639489eb10feef5f12a89d75150b04a750ad44b3b2934f8a485e97ce71d6061e2500b96b11e42fa501f32ebc467b2a5c647d9bdd2dd6e615ef4
6
+ metadata.gz: d5b668bd3ddf0629e4c335de3c530622d30a4aeb472ac6e615bc5aca62798552b652ca8f6b4a6a4e90421f06231364a1ffa88ab9b339805f053e387de7ffefec
7
+ data.tar.gz: 397097b8640b63d2ef8e9b72c4be169c79fa276c46f0aad3cb8d0f69b0fec3716d710498b35309dcd58c3f951711a1bb3d011a27533e452107958189333932f0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.11.0
4
+
5
+ - Upgrade to glimmer 2.0.0
6
+ - Support Shine syntax for basic widgets (no support for table, tree, shapes, custom widgets, or custom shells)
7
+ - Update samples to use Shine syntax
8
+
9
+ ## 0.10.3
10
+
11
+ - Upgrade to glimmer 1.0.10
12
+ - Improvements to row_layout and grid_layout
13
+ - Adding launch/shutdown class methods to Custom Shells
14
+
15
+ ## 0.10.2
16
+
17
+ - Support multiple dialogs/message_box'es opened from a listener, handling correct ordering of display with a queue scheduler
18
+
19
+ ## 0.10.1
20
+
21
+ - Delaying shell rendering till `#open` method is called as per the right expectation
22
+ - When nesting dialogs on top of each other, disable all previously opened ones leaving only the top-most dialog active
23
+
24
+ ## 0.10.0
25
+
26
+ - Hello, Dialog! Sample
27
+ - Support `dialog` widget
28
+ - Support `width` and `height` on `layout_data` for `row_layout`
29
+ - Support `center` for `row_layout`
30
+
3
31
  ## 0.9.3
4
32
 
5
33
  - Extracted pure Ruby Struct to pure-struct gem (since it's also used by YASL)
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 Andy Maleh
1
+ Copyright (c) 2020-2021 Andy Maleh
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,16 +1,16 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 0.9.3 (Pure Ruby Web GUI)
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 0.10.3 (Pure Ruby Web GUI)
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-opal.svg)](http://badge.fury.io/rb/glimmer-dsl-opal)
3
3
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
 
5
- ### You can finally live in pure Ruby land on the web!
5
+ ### You can finally live in pure Rubyland on the web!
6
6
 
7
- [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [Opal](https://opalrb.com/) is an **alpha** [gem](https://rubygems.org/gems/glimmer-dsl-opal) that enables building web GUI in pure Ruby via [Opal](https://opalrb.com/) on [Rails](https://rubyonrails.org/).
7
+ [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [Opal](https://opalrb.com/) is an **alpha** [gem](https://rubygems.org/gems/glimmer-dsl-opal) that enables building web GUI in pure Ruby via [Opal](https://opalrb.com/) on [Rails](https://rubyonrails.org/) **(now comes with the new Shine data-binding syntax)**.
8
8
 
9
9
  Use in one of two ways:
10
10
  - **Direct:** build the GUI of web apps with the same friendly desktop GUI Ruby syntax as [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt), thus requiring a lot less code than web technologies that is in pure Ruby and avoiding opaque web concepts like 'render' and 'reactive'. No HTML/JS/CSS skills are even required. Web designers may be involved with CSS styling only if needed.
11
11
  - **Adapter:** auto-webify [Glimmer](https://github.com/AndyObtiva/glimmer) desktop apps (i.e. apps built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)) via [Opal](https://opalrb.com/) on [Rails](https://rubyonrails.org/) without changing a line of code. Just insert them as a single require statement in a Rails app, and BOOM! They're running on the web! Apps may then optionally be custom-styled for the web by web designers with standard CSS if needed.
12
12
 
13
- Glimmer DSL for Opal successfully reuses the entire [Glimmer](https://github.com/AndyObtiva/glimmer) core DSL engine in [Opal Ruby](https://opalrb.com/) inside a web browser, and as such inherits the full range of powerful Glimmer desktop [data-binding](https://github.com/AndyObtiva/glimmer#data-binding) capabilities for the web.
13
+ Glimmer DSL for Opal successfully reuses the entire [Glimmer](https://github.com/AndyObtiva/glimmer) core DSL engine in [Opal Ruby](https://opalrb.com/) inside a web browser, and as such inherits the full range of Glimmer desktop [data-binding](https://github.com/AndyObtiva/glimmer#data-binding) capabilities for the web (including Shine syntax using `<=>` and `<=` for bidirectional [two-way] and unidirectional [one-way] data-binding respectively).
14
14
 
15
15
  #### Hello, Table! Sample
16
16
 
@@ -141,50 +141,17 @@ Hello, Table! Game Booked
141
141
 
142
142
  NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
143
143
 
144
- **Alpha Version** 0.9.3 only supports bare-minimum capabilities for the following [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt)):
145
-
146
- [Hello samples](#hello-samples):
147
-
148
- - [Hello, World!](#hello-world)
149
- - [Hello, Combo!](#hello-combo)
150
- - [Hello, Computed!](#hello-computed)
151
- - [Hello, List Single Selection!](#hello-list-single-selection)
152
- - [Hello, List Multi Selection!](#hello-list-multi-selection)
153
- - [Hello, Browser!](#hello-browser)
154
- - [Hello, Tab!](#hello-tab)
155
- - [Hello, Custom Widget!](#hello-custom-widget)
156
- - [Hello, Custom Shell!](#hello-custom-shell)
157
- - [Hello, Radio!](#hello-radio)
158
- - [Hello, Radio Group!](#hello-radio-group)
159
- - [Hello, Group!](#hello-group)
160
- - [Hello, Checkbox!](#hello-checkbox)
161
- - [Hello, Checkbox Group!](#hello-checkbox-group)
162
- - [Hello, Date Time!](#hello-date-time)
163
- - [Hello, Table!](#hello-table)
164
- - [Hello, Button!](#hello-button)
165
- - [Hello, Message Box!](#hello-message-box)
166
- - [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
167
- - [Hello, Menu Bar!](#hello-menu-bar)
168
-
169
- [Elaborate samples](#elaborate-samples):
170
-
171
- - [Login](#login)
172
- - [Tic Tac Toe](#tic-tac-toe)
173
- - [Contact Manager](#contact-manager)
174
-
175
- [External samples](#external-samples):
176
-
177
- - [Glimmer Calculator](#glimmer-calculator)
144
+ **Alpha Version** 0.10.3 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
178
145
 
179
146
  Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
180
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
181
- - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
147
+ - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
182
148
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
183
149
  - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
150
+ - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
184
151
 
185
152
  ## Table of Contents
186
153
 
187
- - [Glimmer DSL for Opal 0.9.2 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-092-pure-ruby-web-gui)
154
+ - [Glimmer DSL for Opal 0.10.3 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0101-pure-ruby-web-gui)
188
155
  - [Principles](#principles)
189
156
  - [Background](#background)
190
157
  - [Pre-requisites](#pre-requisites)
@@ -212,6 +179,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
212
179
  - [Hello, Message Box!](#hello-message-box)
213
180
  - [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
214
181
  - [Hello, Menu Bar!](#hello-menu-bar)
182
+ - [Hello, Dialog!](#hello-dialog)
215
183
  - [Elaborate Samples](#elaborate-samples)
216
184
  - [Login](#login)
217
185
  - [Tic Tac Toe](#tic-tac-toe)
@@ -231,15 +199,18 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
231
199
 
232
200
  ## Principles
233
201
 
234
- - **Live purely in Rubyland via the Glimmer GUI DSL**, completely oblivious to web browser technologies.
235
- - **Forget Routers!** Glimmer DSL for Opal supports auto-routing of custom shells (windows), which are opened as separate tabs in a web browser with automatically generated routes and bookmarkable URLs.
236
- - **HTML is strictly made for creating documents not interactive applications**. As such, software engineers can avoid it and focus on creating web applications more productively with Glimmer DSL for Opal in pure Ruby instead (just like they do in desktop development) while content creators and web designers can be the ones responsible for creating HTML documents for web content purposes only as HTML was originally intended. That way, Glimmer web GUI is used and embedded in web pages when providing users with applications while the rest of the web pages are maintained by non-engineers as pure HTML. This achieves a correct separation of responsibilities and better productivity and maintainability.
202
+ Please keep in mind this is a live list of innovative ideas, some of which have not been implemented yet. Watch the project on GitHub to stay up to date with its development.
203
+
204
+ - **Live purely in Rubyland via the Glimmer GUI DSL**, completely oblivious to web browser technologies, thanks to [Opal](https://opalrb.com/).
205
+ - **HTML is for creating documents not interactive applications**. As such, software engineers can avoid it and focus on creating web applications more productively with Glimmer DSL for Opal in pure Ruby instead (just like they do in desktop development) while content creators and web designers can be the ones responsible for creating HTML documents for web content purposes only as HTML was originally intended. That way, Glimmer web GUI is used and embedded in web pages when providing users with applications while the rest of the web pages are maintained by non-engineers as pure HTML. This achieves a correct separation of responsibilities and better productivity and maintainability.
237
206
  - **Approximate styles by developers via the Glimmer GUI DSL. Perfect styles by designers via pure CSS**. Developers can simply build GUI with approximate styling similar to desktop GUI and mockups without worrying about pixel-perfect aesthetics. Web designers can take styling further with pure CSS since every HTML element auto-generated by Glimmer DSL for Opal has a predictable ID and CSS class. This achieves a proper separation of responsibilities between developers and designers.
238
207
  - **Web servers are used just like servers in traditional client/server architecture**, meaning they simply provide RMI services to enable centralizing some of the application logic and data in the cloud to make available everywhere and enable data-sharing with others.
208
+ - **Everybody In!** All JS frameworks sadly suffer from very major software design handicaps because of trying to ensure data security, so you end up with a very strict separation between server data and client data, making your head spin and worrying more about hackers and attackers than serving users. Try again! Thanks to the principle of Everybody In, Glimmer DSL for Opal apps have a very unique software architecture that revolves around the idea of multi-tenancy. Basically, every user gets their own server-side real-estate, that is a fully-secure-and-independent server-side instance that has its own user database, so hackers are not only intentionally allowed in, they are WELCOMED! As such, instead of protecting all users' data with an iron fist over a shared server/database (a terribly insecure architecture no matter how profilerate), you simply provide each user their own fully-independent server/client real-estate, thus be able to focus on serving them in the best way possible by writing code that is so simple it is just like desktop application code, but living in the Cloud on the Web. In summary, just code web as if you're on the desktop and be happy!
209
+ - **Forget Routers!** Glimmer DSL for Opal supports auto-routing of custom shells (windows), which are opened as separate tabs in a web browser with automatically generated routes and bookmarkable URLs.
239
210
 
240
211
  ## Background
241
212
 
242
- The original idea behind Glimmer DSL for Opal was that you start by having a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) desktop app that communicates with a Rails API for any web/cloud concerns. The pure Ruby [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is very simple, so it is more productive to build GUI in it since it does not go through a server/client request/response cycle and can be iterated on locally with a much shorter feedback cycle. Once the GUI and the rest of the app is built. You simply embed it in a Rails app as a one line require statement, and BOOM, it just works on the web inside a web browser with the same server/client communication you had in the desktop app (I am working on adding minimal support for net/http in Opal so that desktop apps that use it continue to work in a web browser. Until then, just use [Opal-jQuery](https://github.com/opal/opal-jquery) http support). That way, you get two apps for one: desktop and web.
213
+ The original idea behind Glimmer DSL for Opal (which [later evolved](#principles)) was that you start by having a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) desktop app that communicates with a Rails API for any web/cloud concerns. The pure Ruby [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is very simple, so it is more productive to build GUI in it since it does not go through a server/client request/response cycle and can be iterated on locally with a much shorter feedback cycle. Once the GUI and the rest of the app is built. You simply embed it in a Rails app as a one line require statement, and BOOM, it just works on the web inside a web browser with the same server/client communication you had in the desktop app (I am working on adding minimal support for net/http in Opal so that desktop apps that use it continue to work in a web browser. Until then, just use [Opal-jQuery](https://github.com/opal/opal-jquery) http support). That way, you get two apps for one: desktop and web.
243
214
 
244
215
  Part of the idea is that web browsers just render GUI widgets similar to those of a desktop app (after all a web browser is a desktop app), so whether you run your GUI on the desktop or on the web should just be a low-level concern, hopefully automated completely with Glimmer DSL for Opal.
245
216
 
@@ -281,7 +252,7 @@ Add the following to `Gemfile`:
281
252
  gem 'opal-rails', '~> 1.1.2'
282
253
  gem 'opal-async', '~> 1.2.0'
283
254
  gem 'opal-jquery', '~> 0.4.4'
284
- gem 'glimmer-dsl-opal', '~> 0.9.3'
255
+ gem 'glimmer-dsl-opal', '~> 0.10.3'
285
256
  gem 'glimmer-dsl-xml', '~> 1.1.0', require: false
286
257
  gem 'glimmer-dsl-css', '~> 1.1.0', require: false
287
258
 
@@ -342,7 +313,7 @@ shell {
342
313
 
343
314
  ## Supported Glimmer DSL Keywords
344
315
 
345
- The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have partial support in Opal:
316
+ The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have fully functional partial support in Opal:
346
317
 
347
318
  Widgets:
348
319
  - `button`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Message Box!](#hello-message-box) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
@@ -354,6 +325,7 @@ Widgets:
354
325
  - `composite`: featured in [Hello, Radio!](#hello-radio) / [Hello, Computed!](#hello-computed) / [Hello, Checkbox!](#hello-checkbox) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login) / [Contact Manager](#contact-manager)
355
326
  - `date`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Shell!](#hello-custom-shell) / [Tic Tac Toe](#tic-tac-toe)
356
327
  - `date_drop_down`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
328
+ - `dialog`: featured in [Hello, Dialog!](#hello-dialog)
357
329
  - `group`: featured in [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager)
358
330
  - `label`: featured in [Hello, Computed!](#hello-computed) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, World!](#hello-world) / [Hello, Table!](#hello-table) / [Hello, Tab!](#hello-tab) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager) / [Login](#login)
359
331
  - `list` (w/ optional `:multi` SWT style): featured in [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Contact Manager](#contact-manager)
@@ -2565,6 +2537,99 @@ You should see "Hello, Menu Bar!"
2565
2537
 
2566
2538
  ![Hello Menu Bar Help Menu](images/glimmer-dsl-opal-hello-menu-bar-help-menu.png)
2567
2539
 
2540
+ #### Hello, Dialog!
2541
+
2542
+ This sample demonstrates a modal dialog similar to message_box, but allows adding arbitrary widgets, not just a message.
2543
+
2544
+ Add the following require statement to `app/assets/javascripts/application.rb`
2545
+
2546
+ ```ruby
2547
+ require 'glimmer-dsl-opal/samples/hello/hello_dialog'
2548
+ ```
2549
+
2550
+ Or add the Glimmer code directly if you prefer to play around with it:
2551
+
2552
+ ```ruby
2553
+ include Glimmer
2554
+
2555
+ shell {
2556
+ row_layout :vertical
2557
+
2558
+ text 'Hello, Dialog!'
2559
+
2560
+ 7.times { |n|
2561
+ dialog_number = n + 1
2562
+
2563
+ button {
2564
+ layout_data {
2565
+ width 200
2566
+ height 50
2567
+ }
2568
+ text "Dialog #{dialog_number}"
2569
+
2570
+ on_widget_selected {
2571
+ dialog { |dialog_proxy|
2572
+ row_layout(:vertical) {
2573
+ center true
2574
+ }
2575
+
2576
+ text "Dialog #{dialog_number}"
2577
+
2578
+ label {
2579
+ text "Given `dialog` is modal, you cannot interact with the main window till the dialog is closed."
2580
+ }
2581
+ composite {
2582
+ row_layout {
2583
+ margin_height 0
2584
+ margin_top 0
2585
+ margin_bottom 0
2586
+ }
2587
+
2588
+ label {
2589
+ text "Unlike `message_box`, `dialog` can contain arbitrary widgets:"
2590
+ }
2591
+ radio {
2592
+ text 'Radio'
2593
+ }
2594
+ checkbox {
2595
+ text 'Checkbox'
2596
+ }
2597
+ }
2598
+ button {
2599
+ text 'Close'
2600
+
2601
+ on_widget_selected {
2602
+ dialog_proxy.close
2603
+ }
2604
+ }
2605
+ }.open
2606
+ }
2607
+ }
2608
+ }
2609
+ }.open
2610
+ ```
2611
+
2612
+ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
2613
+
2614
+ ![Hello Dialog](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-dialog.png)
2615
+
2616
+ ![Hello Dialog Open Dialog](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-dialog-open-dialog.png)
2617
+
2618
+ Glimmer app on the web (using `glimmer-dsl-opal` gem):
2619
+
2620
+ Start the Rails server:
2621
+ ```
2622
+ rails s
2623
+ ```
2624
+
2625
+ Visit `http://localhost:3000`
2626
+
2627
+ You should see "Hello, Dialog!"
2628
+
2629
+ ![Hello Dialog](images/glimmer-dsl-opal-hello-dialog.png)
2630
+
2631
+ ![Hello Dialog Open Dialog](images/glimmer-dsl-opal-hello-dialog-open-dialog.png)
2632
+
2568
2633
  ### Elaborate Samples
2569
2634
 
2570
2635
  #### Login
@@ -3409,9 +3474,9 @@ These features have been suggested. You might see them in a future version of Gl
3409
3474
 
3410
3475
  [MIT](https://opensource.org/licenses/MIT)
3411
3476
 
3412
- Copyright (c) 2020 - Andy Maleh.
3477
+ Copyright (c) 2020-2021 - Andy Maleh.
3413
3478
  See [LICENSE.txt](LICENSE.txt) for further details.
3414
3479
 
3415
3480
  --
3416
3481
 
3417
- [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library).
3482
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (DSL Framework).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.3
1
+ 0.11.0
data/lib/display.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -82,8 +82,9 @@ if RUBY_ENGINE == 'opal'
82
82
  require 'glimmer-dsl-css'
83
83
  Element.alias_native :replace_with, :replaceWith
84
84
  Element.alias_native :select
85
+ Element.alias_native :dialog
85
86
 
86
- # Glimmer::Config.loop_max_count = 20 # TODO disable
87
+ Glimmer::Config.loop_max_count = 300 # TODO disable
87
88
 
88
89
  original_logger_level = Glimmer::Config.logger.level
89
90
  Glimmer::Config.logger = Glimmer::Config::OpalLogger.new(STDOUT)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -21,6 +21,8 @@
21
21
 
22
22
  require 'glimmer/swt/latest_shell_proxy'
23
23
  require 'glimmer/swt/latest_message_box_proxy'
24
+ require 'glimmer/swt/latest_dialog_proxy'
25
+ require 'glimmer/swt/display_proxy'
24
26
 
25
27
  module Glimmer
26
28
  module DSL
@@ -29,12 +31,14 @@ module Glimmer
29
31
  def interpret_expression(expression, keyword, *args, &block)
30
32
  work = lambda do
31
33
  expression.interpret(parent, keyword, *args, &block).tap do |ui_object|
32
- add_content(ui_object, expression, &block)
34
+ add_content(ui_object, expression, keyword, *args, &block)
33
35
  dsl_stack.pop
34
36
  end
35
37
  end
36
- if ['shell', 'message_box'].include?(keyword) && Glimmer::SWT::DisplayProxy.instance.shells.empty?
37
- Document.ready?(&work)
38
+ if ['shell', 'message_box', 'dialog'].include?(keyword) && Glimmer::SWT::DisplayProxy.instance.shells.empty?
39
+ Document.ready? do
40
+ Glimmer::SWT::DisplayProxy.instance.async_exec(&work)
41
+ end
38
42
  Glimmer::SWT.const_get("Latest#{keyword.camelcase(:upper)}Proxy").new
39
43
  else
40
44
  work.call
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -56,8 +56,8 @@ class Login
56
56
 
57
57
  label { text "Username:" } # goes in column 1
58
58
  @user_name_text = text { # goes in column 2
59
- text bind(presenter, :user_name)
60
- enabled bind(presenter, :logged_out)
59
+ text <=> [presenter, :user_name]
60
+ enabled <= [presenter, :logged_out]
61
61
  on_key_pressed { |event|
62
62
  @password_text.set_focus if event.keyCode == swt(:cr)
63
63
  }
@@ -65,19 +65,19 @@ class Login
65
65
 
66
66
  label { text "Password:" }
67
67
  @password_text = text(:password, :border) {
68
- text bind(presenter, :password)
69
- enabled bind(presenter, :logged_out)
68
+ text <=> [presenter, :password]
69
+ enabled <= [presenter, :logged_out]
70
70
  on_key_pressed { |event|
71
71
  presenter.login if event.keyCode == swt(:cr)
72
72
  }
73
73
  }
74
74
 
75
75
  label { text "Status:" }
76
- label { text bind(presenter, :status) }
76
+ label { text <= [presenter, :status] }
77
77
 
78
78
  button {
79
79
  text "Login"
80
- enabled bind(presenter, :logged_out)
80
+ enabled <= [presenter, :logged_out]
81
81
  on_widget_selected { presenter.login }
82
82
  on_key_pressed { |event|
83
83
  presenter.login if event.keyCode == swt(:cr)
@@ -86,7 +86,7 @@ class Login
86
86
 
87
87
  button {
88
88
  text "Logout"
89
- enabled bind(presenter, :logged_in)
89
+ enabled <= [presenter, :logged_in]
90
90
  on_widget_selected { presenter.logout }
91
91
  on_key_pressed { |event|
92
92
  if event.keyCode == swt(:cr)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -35,8 +35,8 @@ class TicTacToe
35
35
  (1..3).each { |column|
36
36
  button {
37
37
  layout_data :fill, :fill, true, true
38
- text bind(@tic_tac_toe_board[row, column], :sign)
39
- enabled bind(@tic_tac_toe_board[row, column], :empty)
38
+ text <= [@tic_tac_toe_board[row, column], :sign]
39
+ enabled <= [@tic_tac_toe_board[row, column], :empty]
40
40
  font style: :bold, height: 20
41
41
  on_widget_selected {
42
42
  @tic_tac_toe_board.mark(row, column)