glimmer-dsl-opal 0.0.9 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/README.md +999 -177
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal.rb +49 -10
- data/lib/glimmer-dsl-opal/ext/date.rb +13 -0
- data/lib/glimmer-dsl-opal/ext/exception.rb +5 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager.rb +1 -1
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact_manager_presenter.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact_repository.rb +24 -99
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/login.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe/board.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe/cell.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_browser.rb +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +85 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +68 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +63 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_computed.rb +19 -19
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_computed/contact.rb +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +155 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +86 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +104 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_list_multi_selection.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_list_single_selection.rb +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +108 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +84 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +50 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +29 -0
- data/lib/glimmer-dsl-opal/vendor/jquery.js +2 -0
- data/lib/glimmer-dsl-swt.rb +37 -0
- data/lib/glimmer/data_binding/element_binding.rb +1 -0
- data/lib/glimmer/data_binding/ext/observable_model.rb +5 -5
- data/lib/glimmer/data_binding/list_selection_binding.rb +1 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +3 -3
- data/lib/glimmer/dsl/opal/async_exec_expression.rb +23 -7
- data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/opal/color_expression.rb +38 -0
- data/lib/glimmer/dsl/opal/column_properties_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/combo_selection_data_binding_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +94 -0
- data/lib/glimmer/dsl/opal/display_expression.rb +40 -0
- data/lib/glimmer/dsl/opal/dsl.rb +18 -16
- data/lib/glimmer/dsl/opal/exec_expression.rb +55 -0
- data/lib/glimmer/dsl/opal/font_expression.rb +47 -0
- data/lib/glimmer/dsl/opal/layout_data_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/layout_expression.rb +22 -0
- data/lib/glimmer/dsl/opal/list_selection_data_binding_expression.rb +2 -3
- data/lib/glimmer/dsl/opal/message_box_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/property_expression.rb +6 -2
- data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/opal/rgb_expression.rb +32 -0
- data/lib/glimmer/dsl/opal/rgba_expression.rb +32 -0
- data/lib/glimmer/dsl/opal/shell_expression.rb +20 -3
- data/lib/glimmer/dsl/opal/swt_expression.rb +46 -0
- data/lib/glimmer/dsl/opal/sync_exec_expression.rb +33 -0
- data/lib/glimmer/dsl/opal/table_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/table_items_data_binding_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/widget_expression.rb +24 -0
- data/lib/glimmer/dsl/opal/widget_listener_expression.rb +16 -3
- data/lib/glimmer/swt.rb +499 -0
- data/lib/glimmer/swt/browser_proxy.rb +27 -0
- data/lib/glimmer/swt/button_proxy.rb +54 -0
- data/lib/glimmer/swt/checkbox_proxy.rb +80 -0
- data/lib/glimmer/swt/color_proxy.rb +119 -0
- data/lib/glimmer/{opal/select_proxy.rb → swt/combo_proxy.rb} +23 -18
- data/lib/glimmer/swt/composite_proxy.rb +31 -0
- data/lib/glimmer/swt/custom/checkbox_group.rb +142 -0
- data/lib/glimmer/swt/custom/radio_group.rb +143 -0
- data/lib/glimmer/swt/display_proxy.rb +79 -0
- data/lib/glimmer/{opal → swt}/event_listener_proxy.rb +1 -1
- data/lib/glimmer/swt/fill_layout_proxy.rb +84 -0
- data/lib/glimmer/swt/font_proxy.rb +79 -0
- data/lib/glimmer/swt/grid_layout_proxy.rb +82 -0
- data/lib/glimmer/swt/group_proxy.rb +38 -0
- data/lib/glimmer/swt/label_proxy.rb +54 -0
- data/lib/glimmer/swt/layout_data_proxy.rb +105 -0
- data/lib/glimmer/swt/layout_proxy.rb +63 -0
- data/lib/glimmer/{opal → swt}/list_proxy.rb +30 -22
- data/lib/glimmer/swt/make_shift_shell_proxy.rb +38 -0
- data/lib/glimmer/swt/message_box_proxy.rb +143 -0
- data/lib/glimmer/{opal → swt}/point.rb +1 -1
- data/lib/glimmer/{opal → swt}/property_owner.rb +1 -1
- data/lib/glimmer/swt/radio_proxy.rb +81 -0
- data/lib/glimmer/swt/row_layout_proxy.rb +128 -0
- data/lib/glimmer/swt/scrolled_composite_proxy.rb +20 -0
- data/lib/glimmer/swt/shell_proxy.rb +260 -0
- data/lib/glimmer/swt/style_constantizable.rb +154 -0
- data/lib/glimmer/swt/styled_text_proxy.rb +44 -0
- data/lib/glimmer/swt/swt_proxy.rb +53 -0
- data/lib/glimmer/{opal/tab_folder.rb → swt/tab_folder_proxy.rb} +20 -21
- data/lib/glimmer/swt/tab_item_proxy.rb +84 -0
- data/lib/glimmer/{opal/table_column.rb → swt/table_column_proxy.rb} +13 -7
- data/lib/glimmer/{opal/table_item.rb → swt/table_item_proxy.rb} +59 -48
- data/lib/glimmer/{opal → swt}/table_proxy.rb +66 -56
- data/lib/glimmer/swt/text_proxy.rb +46 -0
- data/lib/glimmer/swt/widget_proxy.rb +511 -0
- data/lib/glimmer/ui/custom_shell.rb +92 -0
- data/lib/glimmer/ui/custom_widget.rb +292 -0
- data/lib/glimmer/util/proc_tracker.rb +39 -0
- data/lib/net/http.rb +17 -0
- data/lib/uri.rb +64 -0
- metadata +142 -67
- data/lib/glimmer/dsl/opal/browser_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/button_expression.rb +0 -18
- data/lib/glimmer/dsl/opal/combo_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/composite_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/grid_layout_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/label_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/list_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/tab_folder_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/tab_item_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/text_expression.rb +0 -22
- data/lib/glimmer/opal/display_proxy.rb +0 -23
- data/lib/glimmer/opal/div_proxy.rb +0 -29
- data/lib/glimmer/opal/document_proxy.rb +0 -187
- data/lib/glimmer/opal/element_proxy.rb +0 -304
- data/lib/glimmer/opal/grid_layout_proxy.rb +0 -54
- data/lib/glimmer/opal/iframe_proxy.rb +0 -23
- data/lib/glimmer/opal/input_proxy.rb +0 -45
- data/lib/glimmer/opal/label_proxy.rb +0 -25
- data/lib/glimmer/opal/layout_data_proxy.rb +0 -52
- data/lib/glimmer/opal/modal.rb +0 -94
- data/lib/glimmer/opal/tab_item.rb +0 -98
- data/lib/samples/elaborate/launch +0 -6
- data/lib/samples/hello/hello_combo.rb +0 -34
- data/lib/samples/hello/hello_tab.rb +0 -24
- data/lib/samples/hello/hello_world.rb +0 -8
- data/lib/samples/hello/launch +0 -10
- data/lib/samples/launch +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee0609b6cdf6300f68c5558c9341240e6db0a176dd1e8ed687042eeafd5fc5bc
|
4
|
+
data.tar.gz: 2d829b17f2f51266bbface2fb65d18875cb046e2168e4182f2cbc25b81f802af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b059c3db373177f98347631429fe74c573e49ded0497dd9ead80f88e77eb8331a7484e58239da7b063ab46ec351a38e463a9ae5c64bad78f5101b351dc32fe9d
|
7
|
+
data.tar.gz: db311a5065bd972a6a4b4968cfce227439978a9e42cf0be0fc2692b400f2dcd6c53e1cdff0ce59f43551bf1b0c6fc64523280f04e51c72abca1cd0c98f490223
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,55 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.5.0
|
4
|
+
|
5
|
+
- Add `margin_top`, `margin_right`, `margin_bottom`, and `margin_left` to RowLayoutProxy
|
6
|
+
- `radio`
|
7
|
+
- Hello, Radio! Sample
|
8
|
+
- `radio_group`
|
9
|
+
- Hello, Radio Group! Sample
|
10
|
+
- `checkbox`
|
11
|
+
- Hello, Checkbox! Sample
|
12
|
+
- `checkbox_group`
|
13
|
+
- Fix issue with `label` `alignment` property
|
14
|
+
- Fix issues with default `composite` `grid_layout` not getting its styles removed when setting `row_layout`
|
15
|
+
- `button(:radio)` alias for `radio`
|
16
|
+
- `check` alias for `checkbox`
|
17
|
+
- `button(:check)` alias for `checkbox`
|
18
|
+
- Hello, Group! Sample
|
19
|
+
- Group widget
|
20
|
+
|
21
|
+
## 0.4.0
|
22
|
+
|
23
|
+
- Support `display` keyword representing an SWT Display
|
24
|
+
- Support display `on_swt_keydown` event listener (display-wide widget observer)
|
25
|
+
- Support `DisplayProxy#shells` method keeping track of open shell
|
26
|
+
- Make a custom shell open in the same window if there is no shell open already
|
27
|
+
- Support `sync_exec` keyword as just an alias to `async_exec`
|
28
|
+
- Provide a makeshift require for 'glimmer-dsl-swt' that requires 'glimmer-dsl-opal' instead
|
29
|
+
- Fake APIs on the web for OS.os?, File.read, Display.setAppName, Display.setAppVersion
|
30
|
+
- Provide a minimal URI class that supports URI::encode_www_form_component and URI::decode_www_form_component from Ruby
|
31
|
+
|
32
|
+
## 0.3.0
|
33
|
+
|
34
|
+
- Support opening a custom shell in a browser tab/window by passing in query parameters to URL (e.g. ?custom_shell=keyword+option1=value1 etc...)
|
35
|
+
- Make custom shells automatically open in a new tab/window (while standard shells continue to open in the same window by replacing its content)
|
36
|
+
- Hello, Custom Shell! Sample
|
37
|
+
|
38
|
+
## 0.2.0
|
39
|
+
|
40
|
+
- Color support
|
41
|
+
- Font support
|
42
|
+
- Custom Widget Support
|
43
|
+
- Hello, Custom Widget! sample
|
44
|
+
- Updated Hello, Combo! sample to match the latest changes in Glimmer DSL for SWT
|
45
|
+
- `SWT` full re-implementation in Opal as `Glimmer::SWT` with all the `SWT` style constants
|
46
|
+
|
47
|
+
## 0.1.0
|
48
|
+
|
49
|
+
- Code redesign to better match the glimmer-dsl-swt APIs
|
50
|
+
- opal-jquery refactoring
|
51
|
+
- opal-rspec test coverage
|
52
|
+
|
3
53
|
## 0.0.9
|
4
54
|
|
5
55
|
- Upgraded to glimmer gem v0.9.3
|
data/README.md
CHANGED
@@ -1,10 +1,31 @@
|
|
1
|
-
# <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=
|
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.5.0 (Webify Desktop Apps)
|
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
|
-
|
5
|
+
### You can finally live in pure Ruby land on the web!
|
6
|
+
|
7
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [Opal](https://opalrb.com/) is an experimental proof-of-concept web GUI adapter for [Glimmer](https://github.com/AndyObtiva/glimmer) desktop apps (i.e. apps built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)). It webifies them via [Rails](https://rubyonrails.org/), allowing Ruby desktop apps to run on the web via [Opal Ruby](https://opalrb.com/) without changing a line of code. Apps may then be custom-styled by web designers for the web with standard CSS.
|
8
|
+
|
9
|
+
Example:
|
10
|
+
|
11
|
+
[Glimmer Calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) desktop GUI app running in Linux:
|
12
|
+
|
13
|
+
![Glimmer Calculator Linux](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-linux.png)
|
14
|
+
|
15
|
+
Same exact app code running on the web with Opal (no app code changes):
|
16
|
+
|
17
|
+
![Glimmer Calculator Opal](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal.png)
|
18
|
+
|
19
|
+
Apple Calculator CSS themed version (added CSS only with no app code changes):
|
20
|
+
|
21
|
+
![Glimmer Calculator Opal Apple Calculator Theme](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal-apple.png)
|
22
|
+
|
23
|
+
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.
|
24
|
+
|
25
|
+
NOTE: Alpha Version 0.5.0 only supports bare-minimum capabilities for the following [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) [samples](https://github.com/AndyObtiva/glimmer#samples):
|
26
|
+
|
27
|
+
Hello:
|
6
28
|
|
7
|
-
NOTE: Alpha Version 0.0.9 only supports bare-minimum capabilities for the following [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) [samples](https://github.com/AndyObtiva/glimmer#samples):
|
8
29
|
- [Hello, World!](#hello-world)
|
9
30
|
- [Hello, Combo!](#hello-combo)
|
10
31
|
- [Hello, Computed!](#hello-computed)
|
@@ -12,19 +33,43 @@ NOTE: Alpha Version 0.0.9 only supports bare-minimum capabilities for the follow
|
|
12
33
|
- [Hello, List Multi Selection!](#hello-list-multi-selection)
|
13
34
|
- [Hello, Browser!](#hello-browser)
|
14
35
|
- [Hello, Tab!](#hello-tab)
|
36
|
+
- [Hello, Custom Widget!](#hello-custom-widget)
|
37
|
+
- [Hello, Custom Shell!](#hello-custom-shell)
|
38
|
+
- [Hello, Radio!](#hello-radio)
|
39
|
+
- [Hello, Radio Group!](#hello-radio-group)
|
40
|
+
- [Hello, Group!](#hello-group)
|
41
|
+
- [Hello, Checkbox!](#hello-checkbox)
|
42
|
+
- [Hello, Checkbox Group!](#hello-checkbox-group)
|
43
|
+
|
44
|
+
Elaborate:
|
45
|
+
|
15
46
|
- [Login](#login)
|
16
47
|
- [Tic Tac Toe](#tic-tac-toe)
|
17
48
|
- [Contact Manager](#contact-manager)
|
18
49
|
|
19
|
-
|
20
|
-
|
50
|
+
External:
|
51
|
+
|
52
|
+
- [Glimmer Calculator](#glimmer-calculator)
|
53
|
+
|
54
|
+
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
55
|
+
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
|
56
|
+
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
21
57
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
22
58
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
|
23
59
|
|
60
|
+
## Background
|
61
|
+
|
62
|
+
The idea behind Glimmer DSL for Opal is 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 GUI DSL is very simple in Glimmer DSL for SWT. Once the app is built. You simply embed it in a Rails app as a one line require statement after adding the Glimmer DSL for Opal gem, 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).
|
63
|
+
|
64
|
+
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.
|
65
|
+
|
66
|
+
Last but not least, you would likely want some special branding on the web, so you can push that off to a web designer who would be more than happy to do the web graphic design and customize the look and feel with pure CSS (no need for programming with Ruby or JavaScript). This enables a clean separation of concerns and distribution of tasks among developers and designers, let alone saving effort on the web GUI by reusing the desktop GUI as a base right off the bat.
|
67
|
+
|
24
68
|
## Supported Glimmer DSL Keywords
|
25
69
|
|
26
70
|
The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have partial support in Opal:
|
27
71
|
|
72
|
+
Widgets:
|
28
73
|
- `shell`
|
29
74
|
- `label`
|
30
75
|
- `combo`
|
@@ -37,38 +82,61 @@ The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glim
|
|
37
82
|
- `table`
|
38
83
|
- `table_column`
|
39
84
|
- `message_box`
|
85
|
+
- Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget
|
86
|
+
- Glimmer::UI::CustomShell: ability to define any keyword as a custom shell (aka custom window) that opens in a new browser window (tab) automatically unless there is no shell open in the current browser window (tab)
|
87
|
+
|
88
|
+
Layouts:
|
89
|
+
- `grid_layout`
|
90
|
+
- `row_layout`
|
91
|
+
- `fill_layout`
|
92
|
+
- `layout_data`
|
93
|
+
|
94
|
+
Graphics:
|
95
|
+
- `color`
|
96
|
+
- `font`
|
97
|
+
|
98
|
+
Data-Binding/Observers:
|
99
|
+
- `bind`
|
100
|
+
- `observe`
|
40
101
|
- `on_widget_selected`
|
41
102
|
- `on_modify_text`
|
42
|
-
|
43
|
-
|
103
|
+
|
104
|
+
Event loop:
|
105
|
+
- `display`
|
44
106
|
- `async_exec`
|
45
|
-
- `grid_layout`
|
46
|
-
- `layout_data`
|
47
107
|
|
48
108
|
## Pre-requisites
|
49
109
|
|
50
110
|
- Rails 5: [https://github.com/rails/rails/tree/5-2-stable](https://github.com/rails/rails/tree/5-2-stable)
|
51
111
|
- Opal 1: [https://github.com/opal/opal-rails](https://github.com/opal/opal-rails)
|
112
|
+
- jQuery 3: [https://code.jquery.com/](https://code.jquery.com/) (jQuery 3.5.1 is included in the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem)
|
52
113
|
|
53
114
|
## Setup
|
54
115
|
|
55
|
-
(NOTE: if you run into issues,
|
116
|
+
(NOTE: if you run into issues, keep in mind this is a very early experimental and incomplete alpha. Also, there is a slight chance issues you encounter are fixed in master or some other branch that you could check out instead)
|
56
117
|
|
57
|
-
Please install a Rails 5 gem
|
118
|
+
Please install a Rails 5 gem:
|
119
|
+
|
120
|
+
```
|
121
|
+
gem install rails -v5.2.4.4
|
122
|
+
```
|
58
123
|
|
59
124
|
Start a new Rails 5 app:
|
60
125
|
|
61
126
|
```
|
62
|
-
rails new
|
127
|
+
rails new glimmer_app_server
|
63
128
|
```
|
64
129
|
|
65
130
|
Add the following to `Gemfile`:
|
66
131
|
|
67
132
|
```
|
68
133
|
gem 'opal-rails', '~> 1.1.2'
|
69
|
-
gem 'opal-async', '~> 1.
|
70
|
-
gem 'opal-
|
71
|
-
gem 'glimmer-dsl-opal', '~> 0.0
|
134
|
+
gem 'opal-async', '~> 1.2.0'
|
135
|
+
gem 'opal-jquery', '~> 0.4.4'
|
136
|
+
gem 'glimmer-dsl-opal', '~> 0.5.0', require: false
|
137
|
+
gem 'glimmer-dsl-xml', '~> 1.1.0', require: false
|
138
|
+
gem 'glimmer-dsl-css', '~> 1.1.0', require: false
|
139
|
+
|
72
140
|
```
|
73
141
|
|
74
142
|
Follow (opal-rails)[https://github.com/opal/opal-rails] instructions, basically the configuration of: config/initializers/assets.rb
|
@@ -78,16 +146,60 @@ Edit `config/initializers/assets.rb` and add the following at the bottom:
|
|
78
146
|
Opal.use_gem 'glimmer-dsl-opal'
|
79
147
|
```
|
80
148
|
|
149
|
+
Run:
|
150
|
+
|
151
|
+
```
|
152
|
+
rails g scaffold welcome
|
153
|
+
```
|
154
|
+
|
155
|
+
Modify `config/routes.rb`:
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
root to: 'welcomes#index'
|
159
|
+
```
|
160
|
+
|
81
161
|
Add the following line to the top of an empty `app/assets/javascripts/application.rb` (replacing `application.js`)
|
82
162
|
|
83
163
|
```ruby
|
84
|
-
require 'glimmer-dsl-opal' # brings opal and
|
164
|
+
require 'glimmer-dsl-opal' # brings opal and other dependencies automatically
|
165
|
+
```
|
166
|
+
|
167
|
+
Open a `Document.ready?` block and add inside it Glimmer GUI DSL code or a require statement for one of the samples below.
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
Document.ready? do
|
171
|
+
# require-statement/code goes here.
|
172
|
+
end
|
85
173
|
```
|
86
174
|
|
87
|
-
|
175
|
+
Example to confirm setup is working:
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
Document.ready? do
|
179
|
+
include Glimmer
|
180
|
+
|
181
|
+
shell {
|
182
|
+
fill_layout
|
183
|
+
text 'Example to confirm setup is working'
|
184
|
+
label {
|
185
|
+
text "Welcome to Glimmer DSL for Opal!"
|
186
|
+
foreground :red
|
187
|
+
font height: 24
|
188
|
+
}
|
189
|
+
}.open
|
190
|
+
end
|
191
|
+
```
|
88
192
|
|
89
193
|
## Samples
|
90
194
|
|
195
|
+
Follow the instructions below to try out [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) samples webified via [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal)
|
196
|
+
|
197
|
+
Also, this external sample app contains all the samples mentioned below configured inside a Rails 5 [Opal](https://opalrb.com/) app with all the pre-requisites ready to go for convenience:
|
198
|
+
|
199
|
+
[https://github.com/AndyObtiva/sample-glimmer-dsl-opal-rails5-app](https://github.com/AndyObtiva/sample-glimmer-dsl-opal-rails5-app)
|
200
|
+
|
201
|
+
Some of the screenshots might be out of date with updates done to samples in both [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) and [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal).
|
202
|
+
|
91
203
|
### Hello Samples
|
92
204
|
|
93
205
|
#### Hello, World!
|
@@ -95,7 +207,7 @@ Add more code to `app/assets/javascripts/application.rb` from one of the samples
|
|
95
207
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
96
208
|
|
97
209
|
```ruby
|
98
|
-
require 'samples/hello/hello_world'
|
210
|
+
require 'glimmer-dsl-opal/samples/hello/hello_world'
|
99
211
|
```
|
100
212
|
|
101
213
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -133,7 +245,7 @@ You should see "Hello, World!"
|
|
133
245
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
134
246
|
|
135
247
|
```ruby
|
136
|
-
require 'samples/hello/hello_combo'
|
248
|
+
require 'glimmer-dsl-opal/samples/hello/hello_combo'
|
137
249
|
```
|
138
250
|
|
139
251
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -141,32 +253,40 @@ Or add the Glimmer code directly if you prefer to play around with it:
|
|
141
253
|
```ruby
|
142
254
|
class Person
|
143
255
|
attr_accessor :country, :country_options
|
144
|
-
|
256
|
+
|
145
257
|
def initialize
|
146
|
-
self.country_options=[
|
147
|
-
|
258
|
+
self.country_options = ['', 'Canada', 'US', 'Mexico']
|
259
|
+
reset_country
|
148
260
|
end
|
149
261
|
|
150
262
|
def reset_country
|
151
|
-
self.country =
|
263
|
+
self.country = 'Canada'
|
152
264
|
end
|
153
265
|
end
|
154
266
|
|
155
267
|
class HelloCombo
|
156
268
|
include Glimmer
|
269
|
+
|
157
270
|
def launch
|
158
271
|
person = Person.new
|
272
|
+
|
159
273
|
shell {
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
274
|
+
row_layout(:vertical) {
|
275
|
+
pack false
|
276
|
+
}
|
277
|
+
|
278
|
+
text 'Hello, Combo!'
|
279
|
+
|
280
|
+
combo(:read_only) {
|
281
|
+
selection bind(person, :country)
|
282
|
+
}
|
283
|
+
|
284
|
+
button {
|
285
|
+
text 'Reset Selection'
|
286
|
+
|
287
|
+
on_widget_selected do
|
288
|
+
person.reset_country
|
289
|
+
end
|
170
290
|
}
|
171
291
|
}.open
|
172
292
|
end
|
@@ -197,7 +317,7 @@ Add the following require statement to `app/assets/javascripts/application.rb`
|
|
197
317
|
|
198
318
|
|
199
319
|
```ruby
|
200
|
-
require 'samples/hello/hello_computed'
|
320
|
+
require 'glimmer-dsl-opal/samples/hello/hello_computed'
|
201
321
|
```
|
202
322
|
|
203
323
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -230,15 +350,15 @@ class HelloComputed
|
|
230
350
|
|
231
351
|
def initialize
|
232
352
|
@contact = Contact.new(
|
233
|
-
first_name:
|
234
|
-
last_name:
|
353
|
+
first_name: 'Barry',
|
354
|
+
last_name: 'McKibbin',
|
235
355
|
year_of_birth: 1985
|
236
356
|
)
|
237
357
|
end
|
238
358
|
|
239
359
|
def launch
|
240
360
|
shell {
|
241
|
-
text
|
361
|
+
text 'Hello, Computed!'
|
242
362
|
composite {
|
243
363
|
grid_layout {
|
244
364
|
num_columns 2
|
@@ -246,44 +366,44 @@ class HelloComputed
|
|
246
366
|
horizontal_spacing 20
|
247
367
|
vertical_spacing 10
|
248
368
|
}
|
249
|
-
label {text
|
369
|
+
label {text 'First &Name: '}
|
250
370
|
text {
|
251
371
|
text bind(@contact, :first_name)
|
252
372
|
layout_data {
|
253
|
-
|
254
|
-
|
373
|
+
horizontal_alignment :fill
|
374
|
+
grab_excess_horizontal_space true
|
255
375
|
}
|
256
376
|
}
|
257
|
-
label {text
|
377
|
+
label {text '&Last Name: '}
|
258
378
|
text {
|
259
379
|
text bind(@contact, :last_name)
|
260
380
|
layout_data {
|
261
|
-
|
262
|
-
|
381
|
+
horizontal_alignment :fill
|
382
|
+
grab_excess_horizontal_space true
|
263
383
|
}
|
264
384
|
}
|
265
|
-
label {text
|
385
|
+
label {text '&Year of Birth: '}
|
266
386
|
text {
|
267
387
|
text bind(@contact, :year_of_birth)
|
268
388
|
layout_data {
|
269
|
-
|
270
|
-
|
389
|
+
horizontal_alignment :fill
|
390
|
+
grab_excess_horizontal_space true
|
271
391
|
}
|
272
392
|
}
|
273
|
-
label {text
|
393
|
+
label {text 'Name: '}
|
274
394
|
label {
|
275
395
|
text bind(@contact, :name, computed_by: [:first_name, :last_name])
|
276
396
|
layout_data {
|
277
|
-
|
278
|
-
|
397
|
+
horizontal_alignment :fill
|
398
|
+
grab_excess_horizontal_space true
|
279
399
|
}
|
280
400
|
}
|
281
|
-
label {text
|
401
|
+
label {text 'Age: '}
|
282
402
|
label {
|
283
403
|
text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
|
284
404
|
layout_data {
|
285
|
-
|
286
|
-
|
405
|
+
horizontal_alignment :fill
|
406
|
+
grab_excess_horizontal_space true
|
287
407
|
}
|
288
408
|
}
|
289
409
|
}
|
@@ -316,13 +436,13 @@ Add the following require statement to `app/assets/javascripts/application.rb`
|
|
316
436
|
|
317
437
|
|
318
438
|
```ruby
|
319
|
-
require 'samples/hello/hello_list_single_selection'
|
439
|
+
require 'glimmer-dsl-opal/samples/hello/hello_list_single_selection'
|
320
440
|
```
|
321
441
|
|
322
442
|
Or add the Glimmer code directly if you prefer to play around with it:
|
323
443
|
|
324
444
|
```ruby
|
325
|
-
class Person
|
445
|
+
class Person
|
326
446
|
attr_accessor :country, :country_options
|
327
447
|
|
328
448
|
def initialize
|
@@ -359,7 +479,7 @@ HelloListSingleSelection.new.launch
|
|
359
479
|
```
|
360
480
|
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
361
481
|
|
362
|
-
![Glimmer DSL for SWT Hello List Single Selection](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-hello-list-single-selection.png)
|
482
|
+
![Glimmer DSL for SWT Hello List Single Selection](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-list-single-selection.png)
|
363
483
|
|
364
484
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
365
485
|
|
@@ -379,7 +499,7 @@ You should see "Hello, List Single Selection!"
|
|
379
499
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
380
500
|
|
381
501
|
```ruby
|
382
|
-
require 'samples/hello/hello_list_multi_selection'
|
502
|
+
require 'glimmer-dsl-opal/samples/hello/hello_list_multi_selection'
|
383
503
|
```
|
384
504
|
|
385
505
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -432,7 +552,7 @@ HelloListMultiSelection.new.launch
|
|
432
552
|
```
|
433
553
|
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
434
554
|
|
435
|
-
![Glimmer DSL for SWT Hello List Multi Selection](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-hello-list-multi-selection.png)
|
555
|
+
![Glimmer DSL for SWT Hello List Multi Selection](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-list-multi-selection.png)
|
436
556
|
|
437
557
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
438
558
|
|
@@ -452,7 +572,7 @@ You should see "Hello, List Multi Selection!"
|
|
452
572
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
453
573
|
|
454
574
|
```ruby
|
455
|
-
require 'samples/hello/hello_browser'
|
575
|
+
require 'glimmer-dsl-opal/samples/hello/hello_browser'
|
456
576
|
```
|
457
577
|
|
458
578
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -469,7 +589,7 @@ shell {
|
|
469
589
|
```
|
470
590
|
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
471
591
|
|
472
|
-
![Glimmer DSL for SWT Hello Browser](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-hello-browser.png)
|
592
|
+
![Glimmer DSL for SWT Hello Browser](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-browser.png)
|
473
593
|
|
474
594
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
475
595
|
|
@@ -489,7 +609,7 @@ You should see "Hello, Browser!"
|
|
489
609
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
490
610
|
|
491
611
|
```ruby
|
492
|
-
require 'samples/hello/hello_tab'
|
612
|
+
require 'glimmer-dsl-opal/samples/hello/hello_tab'
|
493
613
|
```
|
494
614
|
|
495
615
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -522,8 +642,8 @@ HelloTab.new.launch
|
|
522
642
|
```
|
523
643
|
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
524
644
|
|
525
|
-
![Glimmer DSL for SWT Hello Tab English](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-hello-tab-english.png)
|
526
|
-
![Glimmer DSL for SWT Hello Tab French](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-hello-tab-french.png)
|
645
|
+
![Glimmer DSL for SWT Hello Tab English](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-tab-english.png)
|
646
|
+
![Glimmer DSL for SWT Hello Tab French](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-tab-french.png)
|
527
647
|
|
528
648
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
529
649
|
|
@@ -539,6 +659,758 @@ You should see "Hello, Tab!"
|
|
539
659
|
![Glimmer DSL for Opal Hello Tab English](images/glimmer-dsl-opal-hello-tab-english.png)
|
540
660
|
![Glimmer DSL for Opal Hello Tab French](images/glimmer-dsl-opal-hello-tab-french.png)
|
541
661
|
|
662
|
+
#### Hello, Custom Widget!
|
663
|
+
|
664
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
665
|
+
|
666
|
+
```ruby
|
667
|
+
require 'glimmer-dsl-opal/samples/hello/hello_custom_widget'
|
668
|
+
```
|
669
|
+
|
670
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
671
|
+
|
672
|
+
```ruby
|
673
|
+
# This class declares a `greeting_label` custom widget (by convention)
|
674
|
+
class GreetingLabel
|
675
|
+
include Glimmer::UI::CustomWidget
|
676
|
+
|
677
|
+
# multiple options without default values
|
678
|
+
options :name, :colors
|
679
|
+
|
680
|
+
# single option with default value
|
681
|
+
option :greeting, default: 'Hello'
|
682
|
+
|
683
|
+
# internal attribute (not a custom widget option)
|
684
|
+
attr_accessor :color
|
685
|
+
|
686
|
+
before_body {
|
687
|
+
@font = {height: 24, style: :bold}
|
688
|
+
@color = :black
|
689
|
+
}
|
690
|
+
|
691
|
+
after_body {
|
692
|
+
return if colors.nil?
|
693
|
+
|
694
|
+
Thread.new {
|
695
|
+
colors.cycle { |color|
|
696
|
+
async_exec {
|
697
|
+
self.color = color
|
698
|
+
}
|
699
|
+
sleep(1)
|
700
|
+
}
|
701
|
+
}
|
702
|
+
}
|
703
|
+
|
704
|
+
body {
|
705
|
+
# pass received swt_style through to label to customize (e.g. :center to center text)
|
706
|
+
label(swt_style) {
|
707
|
+
text "#{greeting}, #{name}!"
|
708
|
+
font @font
|
709
|
+
foreground bind(self, :color)
|
710
|
+
}
|
711
|
+
}
|
712
|
+
|
713
|
+
end
|
714
|
+
|
715
|
+
# including Glimmer enables the Glimmer DSL syntax, including auto-discovery of the `greeting_label` custom widget
|
716
|
+
include Glimmer
|
717
|
+
|
718
|
+
shell {
|
719
|
+
fill_layout :vertical
|
720
|
+
|
721
|
+
minimum_size 215, 215
|
722
|
+
text 'Hello, Custom Widget!'
|
723
|
+
|
724
|
+
# custom widget options are passed in a hash
|
725
|
+
greeting_label(name: 'Sean')
|
726
|
+
|
727
|
+
# pass :center SWT style followed by custom widget options hash
|
728
|
+
greeting_label(:center, name: 'Laura', greeting: 'Aloha') #
|
729
|
+
|
730
|
+
greeting_label(:right, name: 'Rick') {
|
731
|
+
# you can nest attributes under custom widgets just like any standard widget
|
732
|
+
foreground :red
|
733
|
+
}
|
734
|
+
|
735
|
+
# the colors option cycles between colors for the label foreground every second
|
736
|
+
greeting_label(:center, name: 'Mary', greeting: 'Aloha', colors: [:red, :dark_green, :blue])
|
737
|
+
}.open
|
738
|
+
```
|
739
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
740
|
+
|
741
|
+
![Glimmer DSL for SWT Hello Custom Widget](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-custom-widget.gif)
|
742
|
+
|
743
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
744
|
+
|
745
|
+
Start the Rails server:
|
746
|
+
```
|
747
|
+
rails s
|
748
|
+
```
|
749
|
+
|
750
|
+
Visit `http://localhost:3000`
|
751
|
+
|
752
|
+
You should see "Hello, Custom Widget!"
|
753
|
+
|
754
|
+
![Glimmer DSL for Opal Hello Custom Widget](images/glimmer-dsl-opal-hello-custom-widget.gif)
|
755
|
+
|
756
|
+
#### Hello, Custom Shell!
|
757
|
+
|
758
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
759
|
+
|
760
|
+
```ruby
|
761
|
+
require 'glimmer-dsl-opal/samples/hello/hello_custom_shell'
|
762
|
+
```
|
763
|
+
|
764
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
765
|
+
|
766
|
+
```ruby
|
767
|
+
require 'date'
|
768
|
+
|
769
|
+
# This class declares an `email_shell` custom shell, aka custom window (by convention)
|
770
|
+
# Used to view an email message
|
771
|
+
class EmailShell
|
772
|
+
include Glimmer::UI::CustomShell
|
773
|
+
|
774
|
+
# multiple options without default values
|
775
|
+
options :date, :subject, :from, :message
|
776
|
+
|
777
|
+
# single option with default value
|
778
|
+
option :to, default: '"John Irwin" <john.irwin@example.com>'
|
779
|
+
|
780
|
+
before_body {
|
781
|
+
@swt_style |= swt(:shell_trim, :modeless)
|
782
|
+
}
|
783
|
+
|
784
|
+
body {
|
785
|
+
# pass received swt_style through to shell to customize it (e.g. :dialog_trim for a blocking shell)
|
786
|
+
shell(swt_style) {
|
787
|
+
grid_layout(2, false)
|
788
|
+
|
789
|
+
text subject
|
790
|
+
|
791
|
+
label {
|
792
|
+
text 'Date:'
|
793
|
+
}
|
794
|
+
label {
|
795
|
+
text date
|
796
|
+
}
|
797
|
+
|
798
|
+
label {
|
799
|
+
text 'From:'
|
800
|
+
}
|
801
|
+
label {
|
802
|
+
text from
|
803
|
+
}
|
804
|
+
|
805
|
+
label {
|
806
|
+
text 'To:'
|
807
|
+
}
|
808
|
+
label {
|
809
|
+
text to
|
810
|
+
}
|
811
|
+
|
812
|
+
label {
|
813
|
+
text 'Subject:'
|
814
|
+
}
|
815
|
+
label {
|
816
|
+
text subject
|
817
|
+
}
|
818
|
+
|
819
|
+
label {
|
820
|
+
layout_data(:fill, :fill, true, true) {
|
821
|
+
horizontal_span 2 #TODO implement
|
822
|
+
vertical_indent 10
|
823
|
+
}
|
824
|
+
|
825
|
+
background :white
|
826
|
+
text message
|
827
|
+
}
|
828
|
+
}
|
829
|
+
}
|
830
|
+
|
831
|
+
end
|
832
|
+
|
833
|
+
class HelloCustomShell
|
834
|
+
# including Glimmer enables the Glimmer DSL syntax, including auto-discovery of the `email_shell` custom widget
|
835
|
+
include Glimmer
|
836
|
+
|
837
|
+
Email = Struct.new(:date, :subject, :from, :message, keyword_init: true)
|
838
|
+
EmailSystem = Struct.new(:emails, keyword_init: true)
|
839
|
+
|
840
|
+
def initialize
|
841
|
+
@email_system = EmailSystem.new(
|
842
|
+
emails: [
|
843
|
+
Email.new(date: DateTime.new(2029, 10, 22, 11, 3, 0).strftime('%F %I:%M %p'), subject: '3rd Week Report', from: '"Dianne Tux" <dianne.tux@example.com>', message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"),
|
844
|
+
Email.new(date: DateTime.new(2029, 10, 21, 8, 1, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v100.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 100.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
|
845
|
+
Email.new(date: DateTime.new(2029, 10, 19, 16, 58, 0).strftime('%F %I:%M %p'), subject: 'Christmas Party', from: '"Lisa Ferreira" <lisa.ferreira@example.com>', message: "Merry Christmas,\n\nAll office Christmas Party arrangements have been set\n\nMake sure to bring a Secret Santa gift\n\nBest regards,\n\nLisa Ferreira"),
|
846
|
+
Email.new(date: DateTime.new(2029, 10, 16, 9, 43, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v99.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 99.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
|
847
|
+
Email.new(date: DateTime.new(2029, 10, 15, 11, 2, 0).strftime('%F %I:%M %p'), subject: '2nd Week Report', from: '"Dianne Tux" <dianne.tux@example.com>', message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"),
|
848
|
+
Email.new(date: DateTime.new(2029, 10, 2, 10, 34, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v98.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 98.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
|
849
|
+
]
|
850
|
+
)
|
851
|
+
end
|
852
|
+
|
853
|
+
def launch
|
854
|
+
shell {
|
855
|
+
grid_layout
|
856
|
+
|
857
|
+
text 'Hello, Custom Shell!'
|
858
|
+
|
859
|
+
label {
|
860
|
+
font height: 24, style: :bold
|
861
|
+
text 'Emails:'
|
862
|
+
}
|
863
|
+
|
864
|
+
label {
|
865
|
+
font height: 18
|
866
|
+
text 'Click an email to view its message'
|
867
|
+
}
|
868
|
+
|
869
|
+
table {
|
870
|
+
layout_data :fill, :fill, true, true
|
871
|
+
|
872
|
+
table_column {
|
873
|
+
text 'Date:'
|
874
|
+
width 180
|
875
|
+
}
|
876
|
+
table_column {
|
877
|
+
text 'Subject:'
|
878
|
+
width 180
|
879
|
+
}
|
880
|
+
table_column {
|
881
|
+
text 'From:'
|
882
|
+
width 360
|
883
|
+
}
|
884
|
+
|
885
|
+
items bind(@email_system, :emails), column_properties(:date, :subject, :from)
|
886
|
+
|
887
|
+
on_mouse_up { |event|
|
888
|
+
email = event.table_item.get_data
|
889
|
+
Thread.new do
|
890
|
+
async_exec {
|
891
|
+
email_shell(date: email.date, subject: email.subject, from: email.from, message: email.message).open
|
892
|
+
}
|
893
|
+
end
|
894
|
+
}
|
895
|
+
}
|
896
|
+
}.open
|
897
|
+
end
|
898
|
+
end
|
899
|
+
|
900
|
+
HelloCustomShell.new.launch
|
901
|
+
```
|
902
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
903
|
+
|
904
|
+
![Glimmer DSL for SWT Hello Custom Shell](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-custom-shell.png)
|
905
|
+
![Glimmer DSL for SWT Hello Custom Shell Email1](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-custom-shell-email1.png)
|
906
|
+
![Glimmer DSL for SWT Hello Custom Shell Email2](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-custom-shell-email2.png)
|
907
|
+
![Glimmer DSL for SWT Hello Custom Shell Email3](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-custom-shell-email3.png)
|
908
|
+
|
909
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
910
|
+
|
911
|
+
Start the Rails server:
|
912
|
+
```
|
913
|
+
rails s
|
914
|
+
```
|
915
|
+
|
916
|
+
Visit `http://localhost:3000`
|
917
|
+
|
918
|
+
You should see "Hello, Custom Widget!"
|
919
|
+
|
920
|
+
![Glimmer DSL for Opal Hello Custom Shell](images/glimmer-dsl-opal-hello-custom-shell.png)
|
921
|
+
![Glimmer DSL for Opal Hello Custom Shell Email1](images/glimmer-dsl-opal-hello-custom-shell-email1.png)
|
922
|
+
![Glimmer DSL for Opal Hello Custom Shell Email2](images/glimmer-dsl-opal-hello-custom-shell-email2.png)
|
923
|
+
![Glimmer DSL for Opal Hello Custom Shell Email3](images/glimmer-dsl-opal-hello-custom-shell-email3.png)
|
924
|
+
|
925
|
+
#### Hello, Radio!
|
926
|
+
|
927
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
928
|
+
|
929
|
+
```ruby
|
930
|
+
require 'glimmer-dsl-opal/samples/hello/hello_radio'
|
931
|
+
```
|
932
|
+
|
933
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
934
|
+
|
935
|
+
```ruby
|
936
|
+
class HelloRadio
|
937
|
+
class Person
|
938
|
+
attr_accessor :male, :female, :child, :teen, :adult, :senior
|
939
|
+
|
940
|
+
def initialize
|
941
|
+
reset
|
942
|
+
end
|
943
|
+
|
944
|
+
def reset
|
945
|
+
self.male = nil
|
946
|
+
self.female = nil
|
947
|
+
self.child = nil
|
948
|
+
self.teen = nil
|
949
|
+
self.adult = true
|
950
|
+
self.senior = nil
|
951
|
+
end
|
952
|
+
end
|
953
|
+
|
954
|
+
include Glimmer
|
955
|
+
|
956
|
+
def launch
|
957
|
+
person = Person.new
|
958
|
+
|
959
|
+
shell {
|
960
|
+
text 'Hello, Radio!'
|
961
|
+
row_layout :vertical
|
962
|
+
|
963
|
+
label {
|
964
|
+
text 'Gender:'
|
965
|
+
font style: :bold
|
966
|
+
}
|
967
|
+
|
968
|
+
composite {
|
969
|
+
row_layout
|
970
|
+
|
971
|
+
radio {
|
972
|
+
text 'Male'
|
973
|
+
selection bind(person, :male)
|
974
|
+
}
|
975
|
+
|
976
|
+
radio {
|
977
|
+
text 'Female'
|
978
|
+
selection bind(person, :female)
|
979
|
+
}
|
980
|
+
}
|
981
|
+
|
982
|
+
label {
|
983
|
+
text 'Age Group:'
|
984
|
+
font style: :bold
|
985
|
+
}
|
986
|
+
|
987
|
+
composite {
|
988
|
+
row_layout
|
989
|
+
|
990
|
+
radio {
|
991
|
+
text 'Child'
|
992
|
+
selection bind(person, :child)
|
993
|
+
}
|
994
|
+
|
995
|
+
radio {
|
996
|
+
text 'Teen'
|
997
|
+
selection bind(person, :teen)
|
998
|
+
}
|
999
|
+
|
1000
|
+
radio {
|
1001
|
+
text 'Adult'
|
1002
|
+
selection bind(person, :adult)
|
1003
|
+
}
|
1004
|
+
|
1005
|
+
radio {
|
1006
|
+
text 'Senior'
|
1007
|
+
selection bind(person, :senior)
|
1008
|
+
}
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
button {
|
1012
|
+
text 'Reset'
|
1013
|
+
|
1014
|
+
on_widget_selected do
|
1015
|
+
person.reset
|
1016
|
+
end
|
1017
|
+
}
|
1018
|
+
}.open
|
1019
|
+
end
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
HelloRadio.new.launch
|
1023
|
+
```
|
1024
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
1025
|
+
|
1026
|
+
![Glimmer DSL for SWT Hello Radio](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-radio.png)
|
1027
|
+
|
1028
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1029
|
+
|
1030
|
+
Start the Rails server:
|
1031
|
+
```
|
1032
|
+
rails s
|
1033
|
+
```
|
1034
|
+
|
1035
|
+
Visit `http://localhost:3000`
|
1036
|
+
|
1037
|
+
You should see "Hello, Radio!"
|
1038
|
+
|
1039
|
+
![Glimmer DSL for Opal Hello Radio](images/glimmer-dsl-opal-hello-radio.png)
|
1040
|
+
|
1041
|
+
#### Hello, Radio Group!
|
1042
|
+
|
1043
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
1044
|
+
|
1045
|
+
```ruby
|
1046
|
+
require 'glimmer-dsl-opal/samples/hello/hello_radio_group'
|
1047
|
+
```
|
1048
|
+
|
1049
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
1050
|
+
|
1051
|
+
```ruby
|
1052
|
+
class HelloRadioGroup
|
1053
|
+
class Person
|
1054
|
+
attr_accessor :gender, :age_group
|
1055
|
+
|
1056
|
+
def initialize
|
1057
|
+
reset
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
def gender_options
|
1061
|
+
['Male', 'Female']
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
def age_group_options
|
1065
|
+
['Child', 'Teen', 'Adult', 'Senior']
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
def reset
|
1069
|
+
self.gender = nil
|
1070
|
+
self.age_group = 'Adult'
|
1071
|
+
end
|
1072
|
+
end
|
1073
|
+
|
1074
|
+
include Glimmer
|
1075
|
+
|
1076
|
+
def launch
|
1077
|
+
person = Person.new
|
1078
|
+
|
1079
|
+
shell {
|
1080
|
+
text 'Hello, Radio Group!'
|
1081
|
+
row_layout :vertical
|
1082
|
+
|
1083
|
+
label {
|
1084
|
+
text 'Gender:'
|
1085
|
+
font style: :bold
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
radio_group {
|
1089
|
+
row_layout :horizontal
|
1090
|
+
selection bind(person, :gender)
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
label {
|
1094
|
+
text 'Age Group:'
|
1095
|
+
font style: :bold
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
radio_group {
|
1099
|
+
row_layout :horizontal
|
1100
|
+
selection bind(person, :age_group)
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
button {
|
1104
|
+
text 'Reset'
|
1105
|
+
|
1106
|
+
on_widget_selected do
|
1107
|
+
person.reset
|
1108
|
+
end
|
1109
|
+
}
|
1110
|
+
}.open
|
1111
|
+
end
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
HelloRadioGroup.new.launch
|
1115
|
+
```
|
1116
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
1117
|
+
|
1118
|
+
![Glimmer DSL for SWT Hello Radio Group](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-radio-group.png)
|
1119
|
+
|
1120
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1121
|
+
|
1122
|
+
Start the Rails server:
|
1123
|
+
```
|
1124
|
+
rails s
|
1125
|
+
```
|
1126
|
+
|
1127
|
+
Visit `http://localhost:3000`
|
1128
|
+
|
1129
|
+
You should see "Hello, Radio Group!"
|
1130
|
+
|
1131
|
+
![Glimmer DSL for Opal Hello Radio Group](images/glimmer-dsl-opal-hello-radio-group.png)
|
1132
|
+
|
1133
|
+
#### Hello, Group!
|
1134
|
+
|
1135
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
1136
|
+
|
1137
|
+
```ruby
|
1138
|
+
require 'glimmer-dsl-opal/samples/hello/hello_group'
|
1139
|
+
```
|
1140
|
+
|
1141
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
1142
|
+
|
1143
|
+
```ruby
|
1144
|
+
class HelloGroup
|
1145
|
+
class Person
|
1146
|
+
attr_accessor :male, :female, :child, :teen, :adult, :senior
|
1147
|
+
|
1148
|
+
def initialize
|
1149
|
+
reset
|
1150
|
+
end
|
1151
|
+
|
1152
|
+
def reset
|
1153
|
+
self.male = nil
|
1154
|
+
self.female = nil
|
1155
|
+
self.child = nil
|
1156
|
+
self.teen = nil
|
1157
|
+
self.adult = true
|
1158
|
+
self.senior = nil
|
1159
|
+
end
|
1160
|
+
end
|
1161
|
+
|
1162
|
+
include Glimmer
|
1163
|
+
|
1164
|
+
def launch
|
1165
|
+
person = Person.new
|
1166
|
+
|
1167
|
+
shell {
|
1168
|
+
text 'Hello, Group!'
|
1169
|
+
row_layout :vertical
|
1170
|
+
|
1171
|
+
group {
|
1172
|
+
row_layout
|
1173
|
+
|
1174
|
+
text 'Gender'
|
1175
|
+
font style: :bold
|
1176
|
+
|
1177
|
+
radio {
|
1178
|
+
text 'Male'
|
1179
|
+
selection bind(person, :male)
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
radio {
|
1183
|
+
text 'Female'
|
1184
|
+
selection bind(person, :female)
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
group {
|
1189
|
+
row_layout
|
1190
|
+
|
1191
|
+
text 'Age Group'
|
1192
|
+
font style: :bold
|
1193
|
+
|
1194
|
+
radio {
|
1195
|
+
text 'Child'
|
1196
|
+
selection bind(person, :child)
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
radio {
|
1200
|
+
text 'Teen'
|
1201
|
+
selection bind(person, :teen)
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
radio {
|
1205
|
+
text 'Adult'
|
1206
|
+
selection bind(person, :adult)
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
radio {
|
1210
|
+
text 'Senior'
|
1211
|
+
selection bind(person, :senior)
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
button {
|
1216
|
+
text 'Reset'
|
1217
|
+
|
1218
|
+
on_widget_selected do
|
1219
|
+
person.reset
|
1220
|
+
end
|
1221
|
+
}
|
1222
|
+
}.open
|
1223
|
+
end
|
1224
|
+
end
|
1225
|
+
|
1226
|
+
HelloGroup.new.launch
|
1227
|
+
```
|
1228
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
1229
|
+
|
1230
|
+
![Glimmer DSL for SWT Hello Group](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-group.png)
|
1231
|
+
|
1232
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1233
|
+
|
1234
|
+
Start the Rails server:
|
1235
|
+
```
|
1236
|
+
rails s
|
1237
|
+
```
|
1238
|
+
|
1239
|
+
Visit `http://localhost:3000`
|
1240
|
+
|
1241
|
+
You should see "Hello, Group!"
|
1242
|
+
|
1243
|
+
![Glimmer DSL for Opal Hello Group](images/glimmer-dsl-opal-hello-group.png)
|
1244
|
+
|
1245
|
+
#### Hello, Checkbox!
|
1246
|
+
|
1247
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
1248
|
+
|
1249
|
+
```ruby
|
1250
|
+
require 'glimmer-dsl-opal/samples/hello/hello_checkbox'
|
1251
|
+
```
|
1252
|
+
|
1253
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
1254
|
+
|
1255
|
+
```ruby
|
1256
|
+
class HelloCheckbox
|
1257
|
+
class Person
|
1258
|
+
attr_accessor :skiing, :snowboarding, :snowmobiling, :snowshoeing
|
1259
|
+
|
1260
|
+
def initialize
|
1261
|
+
reset_activities
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
def reset_activities
|
1265
|
+
self.skiing = false
|
1266
|
+
self.snowboarding = true
|
1267
|
+
self.snowmobiling = false
|
1268
|
+
self.snowshoeing = false
|
1269
|
+
end
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
include Glimmer
|
1273
|
+
|
1274
|
+
def launch
|
1275
|
+
person = Person.new
|
1276
|
+
|
1277
|
+
shell {
|
1278
|
+
text 'Hello, Checkbox!'
|
1279
|
+
row_layout :vertical
|
1280
|
+
|
1281
|
+
label {
|
1282
|
+
text 'Check all snow activities you are interested in:'
|
1283
|
+
font style: :bold
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
composite {
|
1287
|
+
checkbox {
|
1288
|
+
text 'Skiing'
|
1289
|
+
selection bind(person, :skiing)
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
checkbox {
|
1293
|
+
text 'Snowboarding'
|
1294
|
+
selection bind(person, :snowboarding)
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
checkbox {
|
1298
|
+
text 'Snowmobiling'
|
1299
|
+
selection bind(person, :snowmobiling)
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
checkbox {
|
1303
|
+
text 'Snowshoeing'
|
1304
|
+
selection bind(person, :snowshoeing)
|
1305
|
+
}
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
button {
|
1309
|
+
text 'Reset Activities'
|
1310
|
+
|
1311
|
+
on_widget_selected do
|
1312
|
+
person.reset_activities
|
1313
|
+
end
|
1314
|
+
}
|
1315
|
+
}.open
|
1316
|
+
end
|
1317
|
+
end
|
1318
|
+
|
1319
|
+
HelloCheckbox.new.launch
|
1320
|
+
```
|
1321
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
1322
|
+
|
1323
|
+
![Glimmer DSL for SWT Hello Checkbox](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-checkbox.png)
|
1324
|
+
|
1325
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1326
|
+
|
1327
|
+
Start the Rails server:
|
1328
|
+
```
|
1329
|
+
rails s
|
1330
|
+
```
|
1331
|
+
|
1332
|
+
Visit `http://localhost:3000`
|
1333
|
+
|
1334
|
+
You should see "Hello, Checkbox!"
|
1335
|
+
|
1336
|
+
![Glimmer DSL for Opal Hello Checkbox](images/glimmer-dsl-opal-hello-checkbox.png)
|
1337
|
+
|
1338
|
+
#### Hello, Checkbox Group!
|
1339
|
+
|
1340
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
1341
|
+
|
1342
|
+
```ruby
|
1343
|
+
require 'glimmer-dsl-opal/samples/hello/hello_checkbox_group'
|
1344
|
+
```
|
1345
|
+
|
1346
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
1347
|
+
|
1348
|
+
```ruby
|
1349
|
+
class HelloCheckboxGroup
|
1350
|
+
class Person
|
1351
|
+
attr_accessor :activities
|
1352
|
+
|
1353
|
+
def initialize
|
1354
|
+
reset_activities
|
1355
|
+
end
|
1356
|
+
|
1357
|
+
def activities_options
|
1358
|
+
['Skiing', 'Snowboarding', 'Snowmobiling', 'Snowshoeing']
|
1359
|
+
end
|
1360
|
+
|
1361
|
+
def reset_activities
|
1362
|
+
self.activities = ['Snowboarding']
|
1363
|
+
end
|
1364
|
+
end
|
1365
|
+
|
1366
|
+
include Glimmer
|
1367
|
+
|
1368
|
+
def launch
|
1369
|
+
person = Person.new
|
1370
|
+
|
1371
|
+
shell {
|
1372
|
+
text 'Hello, Checkbox Group!'
|
1373
|
+
row_layout :vertical
|
1374
|
+
|
1375
|
+
label {
|
1376
|
+
text 'Check all snow activities you are interested in:'
|
1377
|
+
font style: :bold
|
1378
|
+
}
|
1379
|
+
|
1380
|
+
checkbox_group {
|
1381
|
+
selection bind(person, :activities)
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
button {
|
1385
|
+
text 'Reset Activities'
|
1386
|
+
|
1387
|
+
on_widget_selected do
|
1388
|
+
person.reset_activities
|
1389
|
+
end
|
1390
|
+
}
|
1391
|
+
}.open
|
1392
|
+
end
|
1393
|
+
end
|
1394
|
+
|
1395
|
+
HelloCheckboxGroup.new.launch
|
1396
|
+
```
|
1397
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
1398
|
+
|
1399
|
+
![Glimmer DSL for SWT Hello Checkbox Group](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-checkbox-group.png)
|
1400
|
+
|
1401
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1402
|
+
|
1403
|
+
Start the Rails server:
|
1404
|
+
```
|
1405
|
+
rails s
|
1406
|
+
```
|
1407
|
+
|
1408
|
+
Visit `http://localhost:3000`
|
1409
|
+
|
1410
|
+
You should see "Hello, Checkbox Group!"
|
1411
|
+
|
1412
|
+
![Glimmer DSL for Opal Hello Checkbox Group](images/glimmer-dsl-opal-hello-checkbox-group.png)
|
1413
|
+
|
542
1414
|
### Elaborate Samples
|
543
1415
|
|
544
1416
|
#### Login
|
@@ -546,7 +1418,7 @@ You should see "Hello, Tab!"
|
|
546
1418
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
547
1419
|
|
548
1420
|
```ruby
|
549
|
-
require 'samples/elaborate/login'
|
1421
|
+
require 'glimmer-dsl-opal/samples/elaborate/login'
|
550
1422
|
```
|
551
1423
|
|
552
1424
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -642,9 +1514,9 @@ Login.new.launch
|
|
642
1514
|
```
|
643
1515
|
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
644
1516
|
|
645
|
-
![Glimmer DSL for SWT Login](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-login.png)
|
646
|
-
![Glimmer DSL for SWT Login Filled In](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-login-filled-in.png)
|
647
|
-
![Glimmer DSL for SWT Login Logged In](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-login-logged-in.png)
|
1517
|
+
![Glimmer DSL for SWT Login](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-login.png)
|
1518
|
+
![Glimmer DSL for SWT Login Filled In](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-login-filled-in.png)
|
1519
|
+
![Glimmer DSL for SWT Login Logged In](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-login-logged-in.png)
|
648
1520
|
|
649
1521
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
650
1522
|
|
@@ -666,7 +1538,7 @@ You should see "Login" dialog
|
|
666
1538
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
667
1539
|
|
668
1540
|
```ruby
|
669
|
-
require 'samples/elaborate/tic_tac_toe'
|
1541
|
+
require 'glimmer-dsl-opal/samples/elaborate/tic_tac_toe'
|
670
1542
|
```
|
671
1543
|
|
672
1544
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -877,9 +1749,9 @@ TicTacToe.new.open
|
|
877
1749
|
```
|
878
1750
|
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
879
1751
|
|
880
|
-
![Glimmer DSL for SWT Tic Tac Toe](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-tic-tac-toe.png)
|
881
|
-
![Glimmer DSL for SWT Tic Tac Toe In Progress](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-tic-tac-toe-in-progress.png)
|
882
|
-
![Glimmer DSL for SWT Tic Tac Toe Game Over](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-tic-tac-toe-game-over.png)
|
1752
|
+
![Glimmer DSL for SWT Tic Tac Toe](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-tic-tac-toe.png)
|
1753
|
+
![Glimmer DSL for SWT Tic Tac Toe In Progress](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-tic-tac-toe-in-progress.png)
|
1754
|
+
![Glimmer DSL for SWT Tic Tac Toe Game Over](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-tic-tac-toe-game-over.png)
|
883
1755
|
|
884
1756
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
885
1757
|
|
@@ -901,7 +1773,7 @@ You should see "Tic Tac Toe"
|
|
901
1773
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
902
1774
|
|
903
1775
|
```ruby
|
904
|
-
require 'samples/elaborate/contact_manager'
|
1776
|
+
require 'glimmer-dsl-opal/samples/elaborate/contact_manager'
|
905
1777
|
```
|
906
1778
|
|
907
1779
|
Or add the Glimmer code directly if you prefer to play around with it:
|
@@ -1022,104 +1894,6 @@ class ContactManager
|
|
1022
1894
|
Jason
|
1023
1895
|
Emma
|
1024
1896
|
Olivia
|
1025
|
-
Ava
|
1026
|
-
Isabella
|
1027
|
-
Sophia
|
1028
|
-
Charlotte
|
1029
|
-
Mia
|
1030
|
-
Amelia
|
1031
|
-
Harper
|
1032
|
-
Evelyn
|
1033
|
-
Abigail
|
1034
|
-
Emily
|
1035
|
-
Elizabeth
|
1036
|
-
Mila
|
1037
|
-
Ella
|
1038
|
-
Avery
|
1039
|
-
Sofia
|
1040
|
-
Camila
|
1041
|
-
Aria
|
1042
|
-
Scarlett
|
1043
|
-
Victoria
|
1044
|
-
Madison
|
1045
|
-
Luna
|
1046
|
-
Grace
|
1047
|
-
Chloe
|
1048
|
-
Penelope
|
1049
|
-
Layla
|
1050
|
-
Riley
|
1051
|
-
Zoey
|
1052
|
-
Nora
|
1053
|
-
Lily
|
1054
|
-
Eleanor
|
1055
|
-
Hannah
|
1056
|
-
Lillian
|
1057
|
-
Addison
|
1058
|
-
Aubrey
|
1059
|
-
Ellie
|
1060
|
-
Stella
|
1061
|
-
Natalie
|
1062
|
-
Zoe
|
1063
|
-
Leah
|
1064
|
-
Hazel
|
1065
|
-
Violet
|
1066
|
-
Aurora
|
1067
|
-
Savannah
|
1068
|
-
Audrey
|
1069
|
-
Brooklyn
|
1070
|
-
Bella
|
1071
|
-
Claire
|
1072
|
-
Skylar
|
1073
|
-
Lucy
|
1074
|
-
Paisley
|
1075
|
-
Everly
|
1076
|
-
Anna
|
1077
|
-
Caroline
|
1078
|
-
Nova
|
1079
|
-
Genesis
|
1080
|
-
Emilia
|
1081
|
-
Kennedy
|
1082
|
-
Samantha
|
1083
|
-
Maya
|
1084
|
-
Willow
|
1085
|
-
Kinsley
|
1086
|
-
Naomi
|
1087
|
-
Aaliyah
|
1088
|
-
Elena
|
1089
|
-
Sarah
|
1090
|
-
Ariana
|
1091
|
-
Allison
|
1092
|
-
Gabriella
|
1093
|
-
Alice
|
1094
|
-
Madelyn
|
1095
|
-
Cora
|
1096
|
-
Ruby
|
1097
|
-
Eva
|
1098
|
-
Serenity
|
1099
|
-
Autumn
|
1100
|
-
Adeline
|
1101
|
-
Hailey
|
1102
|
-
Gianna
|
1103
|
-
Valentina
|
1104
|
-
Isla
|
1105
|
-
Eliana
|
1106
|
-
Quinn
|
1107
|
-
Nevaeh
|
1108
|
-
Ivy
|
1109
|
-
Sadie
|
1110
|
-
Piper
|
1111
|
-
Lydia
|
1112
|
-
Alexa
|
1113
|
-
Josephine
|
1114
|
-
Emery
|
1115
|
-
Julia
|
1116
|
-
Delilah
|
1117
|
-
Arianna
|
1118
|
-
Vivian
|
1119
|
-
Kaylee
|
1120
|
-
Sophie
|
1121
|
-
Brielle
|
1122
|
-
Madeline
|
1123
1897
|
]
|
1124
1898
|
NAMES_LAST = %w[
|
1125
1899
|
Smith
|
@@ -1134,7 +1908,7 @@ class ContactManager
|
|
1134
1908
|
Taylor
|
1135
1909
|
]
|
1136
1910
|
def initialize(contacts = nil)
|
1137
|
-
@contacts = contacts ||
|
1911
|
+
@contacts = contacts || 100.times.map do |n|
|
1138
1912
|
random_first_name_index = (rand*NAMES_FIRST.size).to_i
|
1139
1913
|
random_last_name_index = (rand*NAMES_LAST.size).to_i
|
1140
1914
|
first_name = NAMES_FIRST[random_first_name_index]
|
@@ -1295,23 +2069,23 @@ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObt
|
|
1295
2069
|
|
1296
2070
|
Glimmer DSL for SWT Contact Manager
|
1297
2071
|
|
1298
|
-
![Glimmer DSL for SWT Contact Manager](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-contact-manager.png)
|
2072
|
+
![Glimmer DSL for SWT Contact Manager](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-contact-manager.png)
|
1299
2073
|
|
1300
2074
|
Glimmer DSL for SWT Contact Manager Find
|
1301
2075
|
|
1302
|
-
![Glimmer DSL for SWT Contact Manager Find](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-contact-manager-find.png)
|
2076
|
+
![Glimmer DSL for SWT Contact Manager Find](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-contact-manager-find.png)
|
1303
2077
|
|
1304
2078
|
Glimmer DSL for SWT Contact Manager Edit Started
|
1305
2079
|
|
1306
|
-
![Glimmer DSL for SWT Contact Manager Edit Started](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-contact-manager-edit-started.png)
|
2080
|
+
![Glimmer DSL for SWT Contact Manager Edit Started](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-contact-manager-edit-started.png)
|
1307
2081
|
|
1308
2082
|
Glimmer DSL for SWT Contact Manager Edit In Progress
|
1309
2083
|
|
1310
|
-
![Glimmer DSL for SWT Contact Manager Edit In Progress](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-contact-manager-edit-in-progress.png)
|
2084
|
+
![Glimmer DSL for SWT Contact Manager Edit In Progress](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-contact-manager-edit-in-progress.png)
|
1311
2085
|
|
1312
2086
|
Glimmer DSL for SWT Contact Manager Edit Done
|
1313
2087
|
|
1314
|
-
![Glimmer DSL for SWT Contact Manager Edit Done](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-contact-manager-edit-done.png)
|
2088
|
+
![Glimmer DSL for SWT Contact Manager Edit Done](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-contact-manager-edit-done.png)
|
1315
2089
|
|
1316
2090
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1317
2091
|
|
@@ -1344,6 +2118,48 @@ Glimmer DSL for Opal Contact Manager Edit Done
|
|
1344
2118
|
|
1345
2119
|
![Glimmer DSL for Opal Contact Manager Edit Done](images/glimmer-dsl-opal-contact-manager-edit-done.png)
|
1346
2120
|
|
2121
|
+
### External Samples
|
2122
|
+
|
2123
|
+
#### Glimmer Calculator
|
2124
|
+
|
2125
|
+
Add the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem to `Gemfile` (without requiring):
|
2126
|
+
|
2127
|
+
```
|
2128
|
+
gem 'glimmer-cs-calculator', require: false
|
2129
|
+
```
|
2130
|
+
|
2131
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
2132
|
+
|
2133
|
+
```ruby
|
2134
|
+
require 'glimmer-cs-calculator/launch'
|
2135
|
+
```
|
2136
|
+
|
2137
|
+
Glimmer app on the desktop (using the [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
2138
|
+
|
2139
|
+
![Glimmer Calculator Linux](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-linux.png)
|
2140
|
+
|
2141
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
2142
|
+
|
2143
|
+
Start the Rails server:
|
2144
|
+
```
|
2145
|
+
rails s
|
2146
|
+
```
|
2147
|
+
|
2148
|
+
Visit `http://localhost:3000`
|
2149
|
+
(or visit: http://glimmer-cs-calculator-server.herokuapp.com)
|
2150
|
+
|
2151
|
+
You should see "Glimmer Calculator"
|
2152
|
+
|
2153
|
+
![Glimmer Calculator Opal](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal.png)
|
2154
|
+
|
2155
|
+
Here is an Apple Calculator CSS themed version (with [CSS only](https://github.com/AndyObtiva/glimmer-cs-calculator/blob/master/server/glimmer-cs-calculator-server/app/assets/stylesheets/welcomes_apple.scss), no app code changes):
|
2156
|
+
|
2157
|
+
Visit http://glimmer-cs-calculator-server.herokuapp.com/welcomes/apple
|
2158
|
+
|
2159
|
+
You should see "Apple Calculator Theme"
|
2160
|
+
|
2161
|
+
![Glimmer Calculator Opal Apple Calculator Theme](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal-apple.png)
|
2162
|
+
|
1347
2163
|
## Help
|
1348
2164
|
|
1349
2165
|
### Issues
|
@@ -1378,5 +2194,11 @@ These features have been suggested. You might see them in a future version of Gl
|
|
1378
2194
|
|
1379
2195
|
## License
|
1380
2196
|
|
1381
|
-
|
1382
|
-
|
2197
|
+
[MIT](https://opensource.org/licenses/MIT)
|
2198
|
+
|
2199
|
+
Copyright (c) 2020 - Andy Maleh.
|
2200
|
+
See [LICENSE.txt](LICENSE.txt) for further details.
|
2201
|
+
|
2202
|
+
--
|
2203
|
+
|
2204
|
+
[<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).
|