glimmer-dsl-opal 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f0f0793d8e8128a47664c70eefee97fb797f61cbb8026937c3f88e00004a3b2
4
- data.tar.gz: 7482911470d0ea4c87273622642b0d544f94bd0154913d2836e81e07e6d27da9
3
+ metadata.gz: 17d97486e2535b96ec91e1cf8779eb25d7bdf2c06555a1cc3ae13c54cf4bf185
4
+ data.tar.gz: 3c66f6ae88bc76892fd7c2f330715a7e4977b86be233d71c88fa0711d8f3cc77
5
5
  SHA512:
6
- metadata.gz: 0c6dd0b2de545158edfac2173cf7793415ad6046c650650b6b371a4e0704cd7de2cb78fc11ec05d653b266856c676350a224752417954a304ef9a2a95186439f
7
- data.tar.gz: a3bb54ba72e3d55f9352e4ea660d14497212c058cd7f463464dacef05093d74dfabbcee2997d150c00b64923a1a71f592ae706e4155a57280a9f12dfb9fb8d9c
6
+ metadata.gz: 551b4618800f75f3ace354647fc09e27a79846e02ec31756a4839759dd23db690de246c1064454056fa0039b809a7bb084b54df6785959e1b4173b251d3b9fda
7
+ data.tar.gz: 947bdeaf86464c004d0a1d0e20bff91781ee1282c207197f1fd77fb2a3435c6ecf589247324e887db1ce65ec156d8826009a94da9758ebd2f92d8c77d21fecee
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.9.1
4
+
5
+ - Log errors to error stream ($stderr) instead of standard out (STDOUT)
6
+ - Fixed issue with opening shell caused by internalizing the Document.ready? block
7
+
3
8
  ## 0.9.0
4
9
 
5
10
  - Support `menu_bar`
data/README.md CHANGED
@@ -1,4 +1,4 @@
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.0 (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.9.1 (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
 
@@ -12,55 +12,136 @@ Use in one of two ways:
12
12
 
13
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.
14
14
 
15
- #### Tic Tac Toe Sample
15
+ #### Hello, Table! Sample
16
16
 
17
- Add the following require statement to `app/assets/javascripts/application.rb` in a [Glimmer setup](#setup) Rails app:
18
-
19
- ```ruby
20
- require 'glimmer-dsl-opal/samples/elaborate/tic_tac_toe'
21
- ```
22
-
23
- Glimmer GUI code from [glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb](lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb):
17
+ Glimmer GUI code from [glimmer-dsl-opal/samples/hello/hello_table.rb](lib/glimmer-dsl-opal/samples/hello/hello_table.rb):
24
18
 
25
19
  ```ruby
26
20
  # ...
27
- @shell = shell {
28
- text "Tic-Tac-Toe"
29
- minimum_size 150, 178
30
- composite {
31
- grid_layout 3, true
32
- (1..3).each { |row|
33
- (1..3).each { |column|
34
- button {
35
- layout_data :fill, :fill, true, true
36
- text bind(@tic_tac_toe_board[row, column], :sign)
37
- enabled bind(@tic_tac_toe_board[row, column], :empty)
38
- font style: :bold, height: 20
39
- on_widget_selected {
40
- @tic_tac_toe_board.mark(row, column)
41
- }
42
- }
43
- }
44
- }
45
- }
21
+ shell {
22
+ grid_layout
23
+
24
+ text 'Hello, Table!'
25
+
26
+ label {
27
+ layout_data :center, :center, true, false
28
+
29
+ text 'Baseball Playoff Schedule'
30
+ font height: 30, style: :bold
31
+ }
32
+
33
+ combo(:read_only) {
34
+ layout_data :center, :center, true, false
35
+ selection bind(BaseballGame, :playoff_type)
36
+ font height: 16
37
+ }
38
+
39
+ table(:editable) { |table_proxy|
40
+ layout_data :fill, :fill, true, true
41
+
42
+ table_column {
43
+ text 'Game Date'
44
+ width 150
45
+ sort_property :date # ensure sorting by real date value (not `game_date` string specified in items below)
46
+ editor :date_drop_down, property: :date_time
47
+ }
48
+ table_column {
49
+ text 'Game Time'
50
+ width 150
51
+ sort_property :time # ensure sorting by real time value (not `game_time` string specified in items below)
52
+ editor :time, property: :date_time
53
+ }
54
+ table_column {
55
+ text 'Ballpark'
56
+ width 180
57
+ editor :none
58
+ }
59
+ table_column {
60
+ text 'Home Team'
61
+ width 150
62
+ editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
63
+ }
64
+ table_column {
65
+ text 'Away Team'
66
+ width 150
67
+ editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
68
+ }
69
+ table_column {
70
+ text 'Promotion'
71
+ width 150
72
+ # default text editor is used here
73
+ }
74
+
75
+ # Data-bind table items (rows) to a model collection property, specifying column properties ordering per nested model
76
+ items bind(BaseballGame, :schedule), column_properties(:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion)
77
+
78
+ # Data-bind table selection
79
+ selection bind(BaseballGame, :selected_game)
80
+
81
+ # Default initial sort property
82
+ sort_property :date
83
+
84
+ # Sort by these additional properties after handling sort by the column the user clicked
85
+ additional_sort_properties :date, :time, :home_team, :away_team, :ballpark, :promotion
86
+ }
87
+
88
+ button {
89
+ text 'Book Selected Game'
90
+ layout_data :center, :center, true, false
91
+ font height: 16
92
+ enabled bind(BaseballGame, :selected_game)
93
+
94
+ on_widget_selected {
95
+ book_selected_game
46
96
  }
97
+ }
98
+ }.open
47
99
  # ...
48
100
  ```
49
- Tic Tac Toe on the web (using the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem):
50
101
 
51
- ![Glimmer DSL for Opal Tic Tac Toe](images/glimmer-dsl-opal-tic-tac-toe.png)
52
- ![Glimmer DSL for Opal Tic Tac Toe In Progress](images/glimmer-dsl-opal-tic-tac-toe-in-progress.png)
53
- ![Glimmer DSL for Opal Tic Tac Toe Game Over](images/glimmer-dsl-opal-tic-tac-toe-game-over.png)
102
+ **Hello, Table! originally running on the desktop (using the [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):**
54
103
 
55
- Tic Tac Toe on the desktop with the same exact code (using the [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
104
+ ![Glimmer DSL for SWT Hello Table](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-table.png)
56
105
 
57
- ![Glimmer DSL for SWT Tic Tac Toe](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-tic-tac-toe.png)
58
- ![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)
59
- ![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)
106
+ **Hello, Table! (same code) running on the web via Opal on Rails (using the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem):**
107
+
108
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table.png)
109
+
110
+ Hello, Table! Editing Game Date
111
+
112
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table-editing-game-date.png)
113
+
114
+ Hello, Table! Editing Game Time
115
+
116
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table-editing-game-time.png)
117
+
118
+ Hello, Table! Editing Home Team
119
+
120
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table-editing-home-team.png)
121
+
122
+ Hello, Table! Sorted Game Date Ascending
123
+
124
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table-sorted-game-date-ascending.png)
125
+
126
+ Hello, Table! Sorted Game Date Descending
127
+
128
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table-sorted-game-date-descending.png)
129
+
130
+ Hello, Table! Playoff Type Combo
131
+
132
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table-playoff-type-combo.png)
133
+
134
+ Hello, Table! Playoff Type Changed
135
+
136
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table-playoff-type-changed.png)
137
+
138
+ Hello, Table! Game Booked
139
+
140
+ ![Glimmer DSL for Opal Hello Table](images/glimmer-dsl-opal-hello-table-game-booked.png)
60
141
 
61
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.
62
143
 
63
- **Alpha Version** 0.9.0 only supports bare-minimum capabilities for the following [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt)):
144
+ **Alpha Version** 0.9.1 only supports bare-minimum capabilities for the following [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt)):
64
145
 
65
146
  [Hello samples](#hello-samples):
66
147
 
@@ -106,61 +187,60 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
106
187
  The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have partial support in Opal:
107
188
 
108
189
  Widgets:
109
- - `button`
110
- - `browser`
111
- - `calendar`
112
- - `checkbox`
113
- - `checkbox_group`
114
- - `combo`
115
- - `composite`
116
- - `date`
117
- - `date_drop_down`
118
- - `group`
119
- - `label`
120
- - `list` (w/ optional `:multi` SWT style)
121
- - `menu`
122
- - `menu_bar`
123
- - `menu_item`
124
- - `message_box`
125
- - `radio`
126
- - `radio_group`
190
+ - `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)
191
+ - `browser`: featured in [Hello, Browser!](#hello-browser)
192
+ - `calendar`: featured in [Hello, Date Time!](#hello-date-time)
193
+ - `checkbox`: featured in [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox)
194
+ - `checkbox_group`: featured in [Hello, Checkbox Group!](#hello-checkbox-group)
195
+ - `combo`: featured in [Hello, Table!](#hello-table) / [Hello, Combo!](#hello-combo)
196
+ - `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)
197
+ - `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)
198
+ - `date_drop_down`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
199
+ - `group`: featured in [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager)
200
+ - `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)
201
+ - `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)
202
+ - `menu`: featured in [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Table!](#hello-table)
203
+ - `menu_bar`: featured in [Hello, Menu Bar!](#hello-menu-bar)
204
+ - `menu_item`: featured in [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar)
205
+ - `message_box`: featured in [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Message Box!](#hello-message-box) / [Hello, Menu Bar!](#hello-menu-bar)
206
+ - `radio`: featured in [Hello, Radio!](#hello-radio) / [Hello, Group!](#hello-group)
207
+ - `radio_group`: featured in [Hello, Radio Group!](#hello-radio-group)
127
208
  - `scrolled_composite`
128
- - `shell`
129
- - `tab_folder`
130
- - `tab_item`
131
- - `table`
132
- - `table_column`
133
- - `text`
134
- - `time`
135
- - `message_box`
136
- - Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget
137
- - 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)
209
+ - `shell`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Tab!](#hello-tab) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
210
+ - `tab_folder`: featured in [Hello, Tab!](#hello-tab)
211
+ - `tab_item`: featured in [Hello, Tab!](#hello-tab)
212
+ - `table`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Table!](#hello-table) / [Contact Manager](#contact-manager)
213
+ - `table_column`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
214
+ - `text`: featured in [Hello, Computed!](#hello-computed) / [Login](#login) / [Contact Manager](#contact-manager)
215
+ - `time`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
216
+ - Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](#hello-custom-widget)
217
+ - 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) - featured in [Hello, Custom Shell!](#hello-custom-shell)
138
218
 
139
219
  Layouts:
140
- - `grid_layout`
141
- - `row_layout`
142
- - `fill_layout`
143
- - `layout_data`
220
+ - `grid_layout`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Contact Manager](#contact-manager) / [Login](#login) / [Tic Tac Toe](#tic-tac-toe)
221
+ - `row_layout`: featured in [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Contact Manager](#contact-manager)
222
+ - `fill_layout`: featured in [Hello, Custom Widget!](#hello-custom-widget)
223
+ - `layout_data`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Tic Tac Toe](#tic-tac-toe) / [Contact Manager](#contact-manager)
144
224
 
145
225
  Graphics/Style:
146
- - `color`
147
- - `font`
226
+ - `color`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Menu Bar!](#hello-menu-bar)
227
+ - `font`: featured in [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Table!](#hello-table) / [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, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe)
148
228
  - `Point` class used in setting location on widgets
149
- - `swt` and `SWT` class to set SWT styles on widgets
229
+ - `swt` and `SWT` class to set SWT styles on widgets - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Login](#login) / [Contact Manager](#contact-manager)
150
230
 
151
231
  Data-Binding/Observers:
152
- - `bind`
153
- - `observe`
154
- - `on_widget_selected`
232
+ - `bind`: featured in [Hello, Computed!](#hello-computed) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Login](#login) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe)
233
+ - `observe`: featured in [Hello, Table!](#hello-table) / [Tic Tac Toe](#tic-tac-toe)
234
+ - `on_widget_selected`: featured in [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Message Box!](#hello-message-box) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager) / [Login](#login) / [Tic Tac Toe](#tic-tac-toe)
155
235
  - `on_modify_text`
156
- - `on_key_pressed` (and SWT alias `on_swt_keydown`)
236
+ - `on_key_pressed` (and SWT alias `on_swt_keydown`) - featured in [Login](#login) / [Contact Manager](#contact-manager)
157
237
  - `on_key_released` (and SWT alias `on_swt_keyup`)
158
238
  - `on_mouse_down` (and SWT alias `on_swt_mousedown`)
159
- - `on_mouse_up` (and SWT alias `on_swt_mouseup`)
239
+ - `on_mouse_up` (and SWT alias `on_swt_mouseup`) - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
160
240
 
161
241
  Event loop:
162
- - `display`
163
- - `async_exec`
242
+ - `display`: featured in [Tic Tac Toe](#tic-tac-toe)
243
+ - `async_exec`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell)
164
244
 
165
245
  ## Principles
166
246
 
@@ -214,7 +294,7 @@ Add the following to `Gemfile`:
214
294
  gem 'opal-rails', '~> 1.1.2'
215
295
  gem 'opal-async', '~> 1.2.0'
216
296
  gem 'opal-jquery', '~> 0.4.4'
217
- gem 'glimmer-dsl-opal', '~> 0.9.0'
297
+ gem 'glimmer-dsl-opal', '~> 0.9.1'
218
298
  gem 'glimmer-dsl-xml', '~> 1.1.0', require: false
219
299
  gem 'glimmer-dsl-css', '~> 1.1.0', require: false
220
300
 
@@ -239,12 +319,6 @@ Modify `config/routes.rb`:
239
319
  root to: 'welcomes#index'
240
320
  ```
241
321
 
242
- Add the following line to the top of an empty `app/assets/javascripts/application.rb` (replacing `application.js`)
243
-
244
- ```ruby
245
- require 'glimmer-dsl-opal' # brings opal and other dependencies automatically
246
- ```
247
-
248
322
  Edit `app/views/layouts/application.html.erb` and add the following below other `stylesheet_link_tag` declarations:
249
323
 
250
324
  ```erb
@@ -253,30 +327,30 @@ Edit `app/views/layouts/application.html.erb` and add the following below other
253
327
 
254
328
  Clear the file `app/views/welcomes/index.html.erb` from any content.
255
329
 
256
- Open `app/assets/javascripts/application.rb`, add a `Document.ready?` block, and add inside it Glimmer GUI DSL code or a require statement for one of the samples below.
330
+ Add the following line to the top of an empty `app/assets/javascripts/application.rb` (replacing `application.js`), and add Glimmer GUI DSL code or a require statement for one of the samples below.
257
331
 
258
332
  ```ruby
259
- Document.ready? do
260
- # require-statement/code goes here.
261
- end
333
+ require 'glimmer-dsl-opal' # brings opal and other dependencies automatically
334
+
335
+ # require-statement/code goes here.
262
336
  ```
263
337
 
264
338
  Example to confirm setup is working:
265
339
 
266
340
  ```ruby
267
- Document.ready? do
268
- include Glimmer
269
-
270
- shell {
271
- fill_layout
272
- text 'Example to confirm setup is working'
273
- label {
274
- text "Welcome to Glimmer DSL for Opal!"
275
- foreground :red
276
- font height: 24
277
- }
278
- }.open
279
- end
341
+ require 'glimmer-dsl-opal'
342
+
343
+ include Glimmer
344
+
345
+ shell {
346
+ fill_layout
347
+ text 'Example to confirm setup is working'
348
+ label {
349
+ text "Welcome to Glimmer DSL for Opal!"
350
+ foreground :red
351
+ font height: 24
352
+ }
353
+ }.open
280
354
  ```
281
355
 
282
356
  ## Samples
@@ -2144,6 +2218,14 @@ You should see "Hello, Pop Up Context Menu!"
2144
2218
 
2145
2219
  #### Hello, Menu Bar!
2146
2220
 
2221
+ This sample demonstrates a menu bar similar to the File menu bar you see at the top of desktop applications.
2222
+
2223
+ In web applications, it is typically used to provide website information architecture by denoting things like Products, News, Careers, and About.
2224
+
2225
+ In web applications, it is also typically styled by CSS with margin/padding around every menu, distancing it from the top.
2226
+
2227
+ When auto-webifying a pre-existing desktop application, the menu bar can be hidden with CSS if not needed, or simply shown on hover only. Web designers could decide these things to their heart's content with pure CSS independently of the developers' code.
2228
+
2147
2229
  Add the following require statement to `app/assets/javascripts/application.rb`
2148
2230
 
2149
2231
  ```ruby
@@ -3230,13 +3312,27 @@ You should see "Apple Calculator Theme"
3230
3312
 
3231
3313
  [![Glimmer Calculator Opal Apple Calculator Theme](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal-apple.png)](http://glimmer-cs-calculator-server.herokuapp.com/welcomes/apple)
3232
3314
 
3315
+ ## Glimmer Supporting Libraries
3316
+
3317
+ Here is a list of notable 3rd party gems used by Glimmer DSL for Opal:
3318
+ - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML & HTML in pure Ruby.
3319
+ - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets) in pure Ruby.
3320
+ - [opal-async](https://github.com/AndyObtiva/opal-async): Non-blocking tasks and enumerators for Opal.
3321
+ - [to_collection](https://github.com/AndyObtiva/opal-async): Treat an array of objects and a singular object uniformly as a collection of objects.
3322
+
3323
+ ## Glimmer Process
3324
+
3325
+ [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) is the lightweight software development process used for building Glimmer libraries and Glimmer apps, which goes beyond Agile, rendering all Agile processes obsolete. [Glimmer Process](PROCESS.md) is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied.
3326
+
3327
+ Learn more by reading the [GPG](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) (Glimmer Process Guidelines)
3328
+
3233
3329
  ## Help
3234
3330
 
3235
3331
  ### Issues
3236
3332
 
3237
- You may submit [issues](https://github.com/AndyObtiva/glimmer/issues) on [GitHub](https://github.com/AndyObtiva/glimmer/issues).
3333
+ You may submit [issues](https://github.com/AndyObtiva/glimmer-dsl-opal/issues) on [GitHub](https://github.com/AndyObtiva/glimmer-dsl-opal/issues).
3238
3334
 
3239
- [Click here to submit an issue.](https://github.com/AndyObtiva/glimmer/issues)
3335
+ [Click here to submit an issue.](https://github.com/AndyObtiva/glimmer-dsl-opal/issues)
3240
3336
 
3241
3337
  ### Chat
3242
3338
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
@@ -77,14 +77,17 @@ if RUBY_ENGINE == 'opal'
77
77
  # end
78
78
 
79
79
  require 'glimmer/dsl/opal/dsl'
80
-
80
+ require 'glimmer/config/opal_logger'
81
81
  require 'glimmer-dsl-xml'
82
82
  require 'glimmer-dsl-css'
83
83
  Element.alias_native :replace_with, :replaceWith
84
84
  Element.alias_native :select
85
85
 
86
- # Glimmer::Config.loop_max_count = 20
86
+ # Glimmer::Config.loop_max_count = 20 # TODO disable
87
87
 
88
+ original_logger_level = Glimmer::Config.logger.level
89
+ Glimmer::Config.logger = Glimmer::Config::OpalLogger.new(STDOUT)
90
+ Glimmer::Config.logger.level = original_logger_level
88
91
  Glimmer::Config.excluded_keyword_checkers << lambda do |method_symbol, *args|
89
92
  method = method_symbol.to_s
90
93
  result = false
@@ -1,3 +1,4 @@
1
+ require 'glimmer/swt/latest_shell_proxy'
1
2
  require 'glimmer/swt/latest_message_box_proxy'
2
3
 
3
4
  module Glimmer
@@ -11,15 +12,9 @@ module Glimmer
11
12
  dsl_stack.pop
12
13
  end
13
14
  end
14
- if keyword == 'shell'
15
+ if ['shell', 'message_box'].include?(keyword) && Glimmer::SWT::DisplayProxy.instance.send("#{keyword}s").empty?
15
16
  Document.ready?(&work)
16
- elsif keyword == 'message_box'
17
- if Glimmer::SWT::DisplayProxy.instance.shells.empty?
18
- Document.ready?(&work)
19
- Glimmer::SWT::LatestMessageBoxProxy.new
20
- else
21
- work.call
22
- end
17
+ Glimmer::SWT.const_get("Latest#{keyword.camelcase(:upper)}Proxy").new
23
18
  else
24
19
  work.call
25
20
  end
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2020 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
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
@@ -0,0 +1,16 @@
1
+ module Glimmer
2
+ module Config
3
+ class OpalLogger < Logger
4
+ alias add_without_opal_logger add
5
+ def add(severity, message = nil, progname = nil, &block)
6
+ original_logdev = @pipe
7
+ if severity == ERROR
8
+ @pipe = $stderr
9
+ else
10
+ @pipe = original_logdev
11
+ end
12
+ add_without_opal_logger(severity, message, progname, &block)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -31,6 +31,7 @@ module Glimmer
31
31
  def message_boxes
32
32
  @message_boxes ||= []
33
33
  end
34
+ alias message_boxs message_boxes # alias for automating processing as plural from keyword by adding s only
34
35
 
35
36
  def render
36
37
  # No rendering as body is rendered as part of ShellProxy.. this class only serves as an SWT Display utility
@@ -0,0 +1,20 @@
1
+ module Glimmer
2
+ module SWT
3
+ class LatestShellProxy #< ShellProxy
4
+ # TODO consider overriding all methods from ShellProxy and proxying to them
5
+
6
+ def initialize(parent, args, block)
7
+ # No Op
8
+ end
9
+
10
+ def open
11
+ Document.ready? do
12
+ DisplayProxy.instance.shells.last&.open
13
+ end
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
@@ -299,6 +299,7 @@ files:
299
299
  - lib/glimmer-dsl-opal/vendor/jquery-ui/package.json
300
300
  - lib/glimmer-dsl-opal/vendor/jquery.js
301
301
  - lib/glimmer-dsl-swt.rb
302
+ - lib/glimmer/config/opal_logger.rb
302
303
  - lib/glimmer/data_binding/element_binding.rb
303
304
  - lib/glimmer/data_binding/list_selection_binding.rb
304
305
  - lib/glimmer/data_binding/observable_element.rb
@@ -355,6 +356,7 @@ files:
355
356
  - lib/glimmer/swt/group_proxy.rb
356
357
  - lib/glimmer/swt/label_proxy.rb
357
358
  - lib/glimmer/swt/latest_message_box_proxy.rb
359
+ - lib/glimmer/swt/latest_shell_proxy.rb
358
360
  - lib/glimmer/swt/layout_data_proxy.rb
359
361
  - lib/glimmer/swt/layout_proxy.rb
360
362
  - lib/glimmer/swt/list_proxy.rb