glimmer-dsl-opal 0.7.5 → 0.8.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 +12 -0
- data/README.md +182 -12
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal.rb +8 -0
- data/lib/glimmer-dsl-opal/ext/class.rb +10 -0
- data/lib/{file.rb → glimmer-dsl-opal/ext/file.rb} +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +23 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +27 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +62 -32
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +47 -22
- data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +37 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +84 -0
- data/lib/glimmer/data_binding/observable_element.rb +1 -1
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/dsl.rb +2 -0
- data/lib/glimmer/dsl/opal/menu_bar_expression.rb +54 -0
- data/lib/glimmer/dsl/opal/menu_expression.rb +61 -0
- data/lib/glimmer/dsl/opal/widget_expression.rb +3 -2
- data/lib/glimmer/dsl/opal/widget_listener_expression.rb +2 -2
- data/lib/glimmer/swt/custom/checkbox_group.rb +2 -2
- data/lib/glimmer/swt/custom/radio_group.rb +2 -2
- data/lib/glimmer/swt/event_listener_proxy.rb +14 -4
- data/lib/glimmer/swt/grid_layout_proxy.rb +1 -0
- data/lib/glimmer/swt/label_proxy.rb +6 -3
- data/lib/glimmer/swt/list_proxy.rb +33 -0
- data/lib/glimmer/swt/menu_item_proxy.rb +87 -0
- data/lib/glimmer/swt/menu_proxy.rb +162 -0
- data/lib/glimmer/swt/message_box_proxy.rb +51 -57
- data/lib/glimmer/swt/property_owner.rb +2 -0
- data/lib/glimmer/swt/radio_proxy.rb +1 -1
- data/lib/glimmer/swt/shell_proxy.rb +32 -187
- data/lib/glimmer/swt/tab_folder_proxy.rb +43 -0
- data/lib/glimmer/swt/table_column_proxy.rb +3 -2
- data/lib/glimmer/swt/table_editor.rb +1 -1
- data/lib/glimmer/swt/table_item_proxy.rb +7 -5
- data/lib/glimmer/swt/table_proxy.rb +10 -0
- data/lib/glimmer/swt/widget_proxy.rb +313 -30
- data/lib/glimmer/ui/custom_shell.rb +1 -1
- data/lib/glimmer/ui/custom_widget.rb +3 -3
- metadata +20 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97eeea7b6d32426394bf3cb88a2a3cf8d7e8559913bda30fd70e002ea99ec803
|
4
|
+
data.tar.gz: 3a23091312b5279776f5c287554de323007c72a5e4f754fe6d0716090777e8c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b6b902e2e66ef6c65ef4c007acaf812e3cfb10f20b5ef4e1d72e995dc252a809c892eb22d24b83e95d5587ab9b6b135a6e92e748869905abcf02915a224ab29
|
7
|
+
data.tar.gz: 1cbee2b67c0d8b3fcb18a95dbe0db665b8c179fb1561c3c0c1f404b4f66bc5e7a46e1c7553e62099f88b8ef3f68dca7512f20cb2be744c4f137beda6294bed77
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.8.0
|
4
|
+
|
5
|
+
- Hello, Pop Up Context Menu! Sample
|
6
|
+
- Hello Message Box!
|
7
|
+
- Update hello list samples
|
8
|
+
- Support context menus `menu`/`menu_item` directly under a widget (using jQuery UI)
|
9
|
+
- Support generating new lines when entering `label` `text` with \n (auto-converting to <br />)
|
10
|
+
- Support generating new lines when entering `message_box` `message` with \n (auto-converting to <br />)
|
11
|
+
- Support having any widget contribute static CSS to ShellProxy
|
12
|
+
- Add Kernel#include_package shim to allow running JRuby include_package from Glimmer DSL for SWT without failing
|
13
|
+
- Add WidgetProxy#swt_widget to allow running include_package from Glimmer DSL for SWT without failing
|
14
|
+
|
3
15
|
## 0.7.5
|
4
16
|
|
5
17
|
- Update login sample from Glimmer DSL for SWT's latest changes
|
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.
|
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.8.0 (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
|
|
@@ -58,7 +58,9 @@ Tic Tac Toe on the desktop with the same exact code (using the [glimmer-dsl-swt]
|
|
58
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
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)
|
60
60
|
|
61
|
-
NOTE:
|
61
|
+
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
|
+
|
63
|
+
**Alpha Version** 0.8.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)):
|
62
64
|
|
63
65
|
[Hello samples](#hello-samples):
|
64
66
|
|
@@ -79,6 +81,8 @@ NOTE: **Alpha Version** 0.7.5 only supports bare-minimum capabilities for the fo
|
|
79
81
|
- [Hello, Date Time!](#hello-date-time)
|
80
82
|
- [Hello, Table!](#hello-table)
|
81
83
|
- [Hello, Button!](#hello-button)
|
84
|
+
- [Hello, Message Box!](#hello-message-box)
|
85
|
+
- [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
|
82
86
|
|
83
87
|
[Elaborate samples](#elaborate-samples):
|
84
88
|
|
@@ -101,17 +105,31 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
101
105
|
The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have partial support in Opal:
|
102
106
|
|
103
107
|
Widgets:
|
104
|
-
- `shell`
|
105
|
-
- `label`
|
106
|
-
- `combo`
|
107
108
|
- `button`
|
108
|
-
- `
|
109
|
+
- `browser`
|
110
|
+
- `calendar`
|
111
|
+
- `checkbox`
|
112
|
+
- `checkbox_group`
|
113
|
+
- `combo`
|
109
114
|
- `composite`
|
110
|
-
- `
|
115
|
+
- `date`
|
116
|
+
- `date_drop_down`
|
117
|
+
- `group`
|
118
|
+
- `label`
|
119
|
+
- `list` (w/ optional `:multi` SWT style)
|
120
|
+
- `menu`
|
121
|
+
- `menu_item`
|
122
|
+
- `message_box`
|
123
|
+
- `radio`
|
124
|
+
- `radio_group`
|
125
|
+
- `scrolled_composite`
|
126
|
+
- `shell`
|
111
127
|
- `tab_folder`
|
112
128
|
- `tab_item`
|
113
129
|
- `table`
|
114
130
|
- `table_column`
|
131
|
+
- `text`
|
132
|
+
- `time`
|
115
133
|
- `message_box`
|
116
134
|
- Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget
|
117
135
|
- 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)
|
@@ -122,15 +140,21 @@ Layouts:
|
|
122
140
|
- `fill_layout`
|
123
141
|
- `layout_data`
|
124
142
|
|
125
|
-
Graphics:
|
143
|
+
Graphics/Style:
|
126
144
|
- `color`
|
127
145
|
- `font`
|
146
|
+
- `Point` class used in setting location on widgets
|
147
|
+
- `swt` and `SWT` class to set SWT styles on widgets
|
128
148
|
|
129
149
|
Data-Binding/Observers:
|
130
150
|
- `bind`
|
131
151
|
- `observe`
|
132
152
|
- `on_widget_selected`
|
133
153
|
- `on_modify_text`
|
154
|
+
- `on_key_pressed` (and SWT alias `on_swt_keydown`)
|
155
|
+
- `on_key_released` (and SWT alias `on_swt_keyup`)
|
156
|
+
- `on_mouse_down` (and SWT alias `on_swt_mousedown`)
|
157
|
+
- `on_mouse_up` (and SWT alias `on_swt_mouseup`)
|
134
158
|
|
135
159
|
Event loop:
|
136
160
|
- `display`
|
@@ -138,9 +162,10 @@ Event loop:
|
|
138
162
|
|
139
163
|
## Principles
|
140
164
|
|
141
|
-
- **Live purely in Rubyland via the Glimmer GUI DSL**, completely oblivious to web browser technologies.
|
165
|
+
- **Live purely in Rubyland via the Glimmer GUI DSL**, completely oblivious to inferior web browser technologies.
|
142
166
|
- **Forget Routers!** Glimmer DSL for Opal supports auto-routing of custom shells (windows), which are opened as separate tabs in a web browser with automatically generated routes and bookmarkable URLs.
|
143
|
-
- **HTML is strictly made for creating documents not interactive applications**. As such, software engineers can avoid it and focus on creating web applications more productively with Glimmer DSL for Opal in pure Ruby (just like they do in desktop development) while content creators and web designers can be the ones responsible for creating HTML documents for web content purposes only as HTML was originally intended.
|
167
|
+
- **HTML is strictly made for creating documents not interactive applications**. As such, software engineers can avoid it and focus on creating web applications more productively with Glimmer DSL for Opal in pure Ruby instead (just like they do in desktop development) while content creators and web designers can be the ones responsible for creating HTML documents for web content purposes only as HTML was originally intended. That way, Glimmer web GUI is used and embedded in web pages when providing users with applications while the rest of the web pages are maintained by non-engineers as pure HTML. This achieves a correct separation of responsibilities and better productivity and maintainability.
|
168
|
+
- **Approximate styles by developers via the Glimmer GUI DSL. Perfect styles by designers via pure CSS**. Developers can simply build GUI with approximate styling similar to desktop GUI without worrying about pixel-perfect aethetics. Web designers can take styling further with pure CSS since every HTML element auto-generated by Glimmer DSL for Opal has a predictable ID and CSS class. This achieves a proper separation of responsibilities between developers and designers.
|
144
169
|
- **Web servers are used just like servers in traditional client/server architecture**, meaning they simply provide RMI services to enable centralizing some of the application logic and data in the cloud to make available everywhere and enable data-sharing with others.
|
145
170
|
|
146
171
|
## Background
|
@@ -187,7 +212,7 @@ Add the following to `Gemfile`:
|
|
187
212
|
gem 'opal-rails', '~> 1.1.2'
|
188
213
|
gem 'opal-async', '~> 1.2.0'
|
189
214
|
gem 'opal-jquery', '~> 0.4.4'
|
190
|
-
gem 'glimmer-dsl-opal', '~> 0.
|
215
|
+
gem 'glimmer-dsl-opal', '~> 0.8.0'
|
191
216
|
gem 'glimmer-dsl-xml', '~> 1.1.0', require: false
|
192
217
|
gem 'glimmer-dsl-css', '~> 1.1.0', require: false
|
193
218
|
|
@@ -256,7 +281,9 @@ end
|
|
256
281
|
|
257
282
|
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)
|
258
283
|
|
259
|
-
The [Hello samples](#hello-samples) demonstrate tiny building blocks for building full fledged applications.
|
284
|
+
The [Hello samples](#hello-samples) demonstrate tiny building blocks (widgets) for building full fledged applications.
|
285
|
+
|
286
|
+
The [Elaborate samples](#elaborate-samples) demonstrate more advanced sample applications that assemble multiple building blocks.
|
260
287
|
|
261
288
|
This external sample app contains all the samples mentioned below configured inside a Rails [Opal](https://opalrb.com/) app with all the pre-requisites ready to go for convenience:
|
262
289
|
|
@@ -1961,6 +1988,149 @@ You should see "Hello, Button!"
|
|
1961
1988
|
![Glimmer DSL for Opal Hello Button](images/glimmer-dsl-opal-hello-button.png)
|
1962
1989
|
![Glimmer DSL for Opal Hello Button](images/glimmer-dsl-opal-hello-button-incremented.png)
|
1963
1990
|
|
1991
|
+
#### Hello, Message Box!
|
1992
|
+
|
1993
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
1994
|
+
|
1995
|
+
```ruby
|
1996
|
+
require 'glimmer-dsl-opal/samples/hello/hello_message_box'
|
1997
|
+
```
|
1998
|
+
|
1999
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
2000
|
+
|
2001
|
+
```ruby
|
2002
|
+
include Glimmer
|
2003
|
+
|
2004
|
+
shell {
|
2005
|
+
text 'Hello, Message Box!'
|
2006
|
+
|
2007
|
+
button {
|
2008
|
+
text 'Please Click To Win a Surprise'
|
2009
|
+
|
2010
|
+
on_widget_selected {
|
2011
|
+
message_box {
|
2012
|
+
text 'Surprise'
|
2013
|
+
message "Congratulations!\n\nYou won $1,000,000!"
|
2014
|
+
}.open
|
2015
|
+
}
|
2016
|
+
}
|
2017
|
+
}.open
|
2018
|
+
```
|
2019
|
+
|
2020
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
2021
|
+
|
2022
|
+
![Glimmer DSL for SWT Message Box](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-message-box.png)
|
2023
|
+
![Glimmer DSL for SWT Message Box Dialog](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-message-box-dialog.png)
|
2024
|
+
|
2025
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
2026
|
+
|
2027
|
+
Start the Rails server:
|
2028
|
+
```
|
2029
|
+
rails s
|
2030
|
+
```
|
2031
|
+
|
2032
|
+
Visit `http://localhost:3000`
|
2033
|
+
|
2034
|
+
You should see "Hello, Message Box!"
|
2035
|
+
|
2036
|
+
![Glimmer DSL for Opal Hello Message Box](images/glimmer-dsl-opal-hello-message-box.png)
|
2037
|
+
![Glimmer DSL for Opal Hello Message Box Dialog](images/glimmer-dsl-opal-hello-message-box-dialog.png)
|
2038
|
+
|
2039
|
+
#### Hello, Pop Up Context Menu!
|
2040
|
+
|
2041
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
2042
|
+
|
2043
|
+
```ruby
|
2044
|
+
require 'glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu'
|
2045
|
+
```
|
2046
|
+
|
2047
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
2048
|
+
|
2049
|
+
```ruby
|
2050
|
+
include Glimmer
|
2051
|
+
|
2052
|
+
shell {
|
2053
|
+
grid_layout {
|
2054
|
+
margin_width 0
|
2055
|
+
margin_height 0
|
2056
|
+
}
|
2057
|
+
|
2058
|
+
text 'Hello, Pop Up Context Menu!'
|
2059
|
+
|
2060
|
+
label {
|
2061
|
+
text "Right-Click on the Text to\nPop Up a Context Menu"
|
2062
|
+
font height: 50
|
2063
|
+
|
2064
|
+
menu {
|
2065
|
+
menu {
|
2066
|
+
text '&History'
|
2067
|
+
menu {
|
2068
|
+
text '&Recent'
|
2069
|
+
menu_item {
|
2070
|
+
text 'File 1'
|
2071
|
+
on_widget_selected {
|
2072
|
+
message_box {
|
2073
|
+
text 'File 1'
|
2074
|
+
message 'File 1 Contents'
|
2075
|
+
}.open
|
2076
|
+
}
|
2077
|
+
}
|
2078
|
+
menu_item {
|
2079
|
+
text 'File 2'
|
2080
|
+
on_widget_selected {
|
2081
|
+
message_box {
|
2082
|
+
text 'File 2'
|
2083
|
+
message 'File 2 Contents'
|
2084
|
+
}.open
|
2085
|
+
}
|
2086
|
+
}
|
2087
|
+
}
|
2088
|
+
menu {
|
2089
|
+
text '&Archived'
|
2090
|
+
menu_item {
|
2091
|
+
text 'File 3'
|
2092
|
+
on_widget_selected {
|
2093
|
+
message_box {
|
2094
|
+
text 'File 3'
|
2095
|
+
message 'File 3 Contents'
|
2096
|
+
}.open
|
2097
|
+
}
|
2098
|
+
}
|
2099
|
+
menu_item {
|
2100
|
+
text 'File 4'
|
2101
|
+
on_widget_selected {
|
2102
|
+
message_box {
|
2103
|
+
text 'File 4'
|
2104
|
+
message 'File 4 Contents'
|
2105
|
+
}.open
|
2106
|
+
}
|
2107
|
+
}
|
2108
|
+
}
|
2109
|
+
}
|
2110
|
+
}
|
2111
|
+
}
|
2112
|
+
}.open
|
2113
|
+
```
|
2114
|
+
|
2115
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
2116
|
+
|
2117
|
+
![Glimmer DSL for SWT Hello Pop Up Context Menu Popped Up](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-pop-up-context-menu.png)
|
2118
|
+
![Glimmer DSL for SWT Hello Pop Up Context Menu](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-pop-up-context-menu-popped-up.png)
|
2119
|
+
|
2120
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
2121
|
+
|
2122
|
+
Start the Rails server:
|
2123
|
+
```
|
2124
|
+
rails s
|
2125
|
+
```
|
2126
|
+
|
2127
|
+
Visit `http://localhost:3000`
|
2128
|
+
|
2129
|
+
You should see "Hello, Pop Up Context Menu!"
|
2130
|
+
|
2131
|
+
![Glimmer DSL for Opal Hello Pop Up Context Menu](images/glimmer-dsl-opal-hello-pop-up-context-menu.png)
|
2132
|
+
![Glimmer DSL for Opal Hello Pop Up Context Menu Popped Up](images/glimmer-dsl-opal-hello-pop-up-context-menu-popped-up.png)
|
2133
|
+
|
1964
2134
|
|
1965
2135
|
### Elaborate Samples
|
1966
2136
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/lib/glimmer-dsl-opal.rb
CHANGED
@@ -33,6 +33,11 @@ if RUBY_ENGINE == 'opal'
|
|
33
33
|
# TODO look into making append_path work (causing some trouble right now)
|
34
34
|
# Opal.append_path File.expand_path('../glimmer-dsl-opal/missing', __FILE__)
|
35
35
|
# Opal.append_path GLIMMER_DSL_OPAL_MISSING
|
36
|
+
module Kernel
|
37
|
+
def include_package(package)
|
38
|
+
# No Op (just a shim)
|
39
|
+
end
|
40
|
+
end
|
36
41
|
|
37
42
|
require 'opal-parser'
|
38
43
|
require 'native' # move this to opal-async
|
@@ -49,8 +54,11 @@ if RUBY_ENGINE == 'opal'
|
|
49
54
|
# require 'glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.structure.min.css'
|
50
55
|
# require 'glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.theme.min.css'
|
51
56
|
require 'opal-jquery'
|
57
|
+
require 'opal/jquery/local_storage'
|
52
58
|
|
53
59
|
require 'facets/hash/symbolize_keys'
|
60
|
+
require 'glimmer-dsl-opal/ext/class'
|
61
|
+
require 'glimmer-dsl-opal/ext/file'
|
54
62
|
require 'glimmer-dsl-opal/ext/struct'
|
55
63
|
require 'glimmer'
|
56
64
|
require 'glimmer-dsl-opal/ext/exception'
|
File without changes
|
@@ -1,7 +1,30 @@
|
|
1
|
+
# Copyright (c) 2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
include Glimmer
|
2
23
|
|
3
24
|
shell {
|
25
|
+
text 'Hello, Browser!'
|
4
26
|
minimum_size 1024, 860
|
27
|
+
|
5
28
|
browser {
|
6
29
|
url 'https://brightonresort.com/about'
|
7
30
|
}
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
require_relative 'hello_computed/contact'
|
2
23
|
|
3
24
|
class HelloComputed
|
@@ -14,6 +35,7 @@ class HelloComputed
|
|
14
35
|
def launch
|
15
36
|
shell {
|
16
37
|
text 'Hello, Computed!'
|
38
|
+
|
17
39
|
composite {
|
18
40
|
grid_layout {
|
19
41
|
num_columns 2
|
@@ -21,6 +43,7 @@ class HelloComputed
|
|
21
43
|
horizontal_spacing 20
|
22
44
|
vertical_spacing 10
|
23
45
|
}
|
46
|
+
|
24
47
|
label {text 'First &Name: '}
|
25
48
|
text {
|
26
49
|
text bind(@contact, :first_name)
|
@@ -29,6 +52,7 @@ class HelloComputed
|
|
29
52
|
grab_excess_horizontal_space true
|
30
53
|
}
|
31
54
|
}
|
55
|
+
|
32
56
|
label {text '&Last Name: '}
|
33
57
|
text {
|
34
58
|
text bind(@contact, :last_name)
|
@@ -37,6 +61,7 @@ class HelloComputed
|
|
37
61
|
grab_excess_horizontal_space true
|
38
62
|
}
|
39
63
|
}
|
64
|
+
|
40
65
|
label {text '&Year of Birth: '}
|
41
66
|
text {
|
42
67
|
text bind(@contact, :year_of_birth)
|
@@ -45,6 +70,7 @@ class HelloComputed
|
|
45
70
|
grab_excess_horizontal_space true
|
46
71
|
}
|
47
72
|
}
|
73
|
+
|
48
74
|
label {text 'Name: '}
|
49
75
|
label {
|
50
76
|
text bind(@contact, :name, computed_by: [:first_name, :last_name])
|
@@ -53,6 +79,7 @@ class HelloComputed
|
|
53
79
|
grab_excess_horizontal_space true
|
54
80
|
}
|
55
81
|
}
|
82
|
+
|
56
83
|
label {text 'Age: '}
|
57
84
|
label {
|
58
85
|
text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
|
@@ -1,41 +1,71 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
1
|
+
# Copyright (c) 2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
21
|
|
24
22
|
class HelloListMultiSelection
|
23
|
+
class Person
|
24
|
+
attr_accessor :provinces, :provinces_options
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
self.provinces_options = [
|
28
|
+
'',
|
29
|
+
'Alberta',
|
30
|
+
'British Columbia',
|
31
|
+
'Manitoba',
|
32
|
+
'New Brunswick',
|
33
|
+
'Newfoundland and Labrador',
|
34
|
+
'Northwest Territories',
|
35
|
+
'Nova Scotia',
|
36
|
+
'Nunavut',
|
37
|
+
'Ontario',
|
38
|
+
'Prince Edward Island',
|
39
|
+
'Quebec',
|
40
|
+
'Saskatchewan',
|
41
|
+
'Yukon'
|
42
|
+
]
|
43
|
+
reset_provinces
|
44
|
+
end
|
45
|
+
|
46
|
+
def reset_provinces
|
47
|
+
self.provinces = ['Quebec', 'Manitoba', 'Alberta']
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
25
51
|
include Glimmer
|
52
|
+
|
26
53
|
def launch
|
27
54
|
person = Person.new
|
55
|
+
|
28
56
|
shell {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
57
|
+
grid_layout
|
58
|
+
|
59
|
+
text 'Hello, List Multi Selection!'
|
60
|
+
|
61
|
+
list(:multi) {
|
62
|
+
selection bind(person, :provinces)
|
63
|
+
}
|
64
|
+
|
65
|
+
button {
|
66
|
+
text 'Reset Selections To Default Values'
|
67
|
+
|
68
|
+
on_widget_selected { person.reset_provinces }
|
39
69
|
}
|
40
70
|
}.open
|
41
71
|
end
|