glimmer-dsl-swt 4.20.0.0 → 4.20.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +7 -7
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +1 -0
- data/docs/reference/GLIMMER_SAMPLES.md +34 -0
- data/glimmer-dsl-swt.gemspec +0 -0
- data/samples/hello/hello_composite.rb +71 -0
- data/samples/hello/hello_layout.rb +239 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40337dd0e70a4d482ee3e06afd736a4f186635d3126ac55df8e410ecbf179eca
|
4
|
+
data.tar.gz: c5a88ac7c6c267331d79cd67fd631966477bb22ea758bc094bf242aa9f314b46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57560940de39c939a3928ab74241156597085579bda5895df214e07f6cf85e79e1d0a64a3642bf47834907230bce89000235d54286491defb36930b0dc87b0c3
|
7
|
+
data.tar.gz: 0fd95aa19607c97cf3f207f74e004cd06069bd15afc9b9d9e71388f8cf4f6f208e3ca4c830e4f4419c7a96d8d7e58886e2abf0baf803c0db45420c65526eeb4a
|
data/CHANGELOG.md
CHANGED
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 SWT 4.20.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 SWT 4.20.0.1
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -10,12 +10,12 @@
|
|
10
10
|
|
11
11
|
**(The Original Glimmer Library Handling the World’s Ruby GUI Needs Since 2007. Beware of Imitators!)**
|
12
12
|
|
13
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for SWT is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](docs/reference/GLIMMER_COMMAND.md#packaging) on [Linux](https://www.linux.org/). [Glimmer](https://github.com/AndyObtiva/glimmer) was the [first Ruby gem](https://rubygems.org/gems/glimmer) to bring [SWT](https://www.eclipse.org/swt/) (Standard Widget Toolkit) to [Ruby](https://www.ruby-lang.org/en/), thanks to creator [Andy Maleh](https://andymaleh.blogspot.com/),
|
13
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for SWT is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](docs/reference/GLIMMER_COMMAND.md#packaging) on [Linux](https://www.linux.org/). [Glimmer](https://github.com/AndyObtiva/glimmer) was the [first Ruby gem](https://rubygems.org/gems/glimmer) to bring [SWT](https://www.eclipse.org/swt/) (Standard Widget Toolkit) to [Ruby](https://www.ruby-lang.org/en/), thanks to creator [Andy Maleh](https://andymaleh.blogspot.com/), EclipseCon/EclipseWorld/RubyConf speaker and expert.
|
14
14
|
|
15
15
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
16
16
|
Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
|
17
17
|
|
18
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.0.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.0.1 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
|
19
19
|
|
20
20
|
**Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still an early alpha, so default back to `bind` whenever needed).
|
21
21
|
|
@@ -341,7 +341,7 @@ jgem install glimmer-dsl-swt
|
|
341
341
|
|
342
342
|
Or this command if you want a specific version:
|
343
343
|
```
|
344
|
-
jgem install glimmer-dsl-swt -v 4.20.0.
|
344
|
+
jgem install glimmer-dsl-swt -v 4.20.0.1
|
345
345
|
```
|
346
346
|
|
347
347
|
`jgem` is JRuby's version of `gem` command.
|
@@ -369,7 +369,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
369
369
|
|
370
370
|
Add the following to `Gemfile`:
|
371
371
|
```
|
372
|
-
gem 'glimmer-dsl-swt', '~> 4.20.0.
|
372
|
+
gem 'glimmer-dsl-swt', '~> 4.20.0.1'
|
373
373
|
```
|
374
374
|
|
375
375
|
And, then run:
|
@@ -390,7 +390,7 @@ glimmer
|
|
390
390
|
```
|
391
391
|
|
392
392
|
```
|
393
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.0.
|
393
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.0.1
|
394
394
|
|
395
395
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
396
396
|
|
@@ -568,7 +568,7 @@ Here is a list of notable 3rd party gems used by Glimmer:
|
|
568
568
|
- [puts_debuggerer](https://github.com/AndyObtiva/puts_debuggerer): helps in troubleshooting when adding `require 'pd'` and using the `pd` command instead of `puts` or `p` (also `#pd_inspect` or `#pdi` instead of `#inspect`)
|
569
569
|
- [rake](https://github.com/ruby/rake): used to implement and execute `glimmer` commands
|
570
570
|
- [rake-tui](https://github.com/AndyObtiva/rake-tui): Rake Text-based User Interface. Allows navigating rake tasks with arrow keys and filtering task list by typing to quickly find an run a rake task.
|
571
|
-
- [rouge](https://github.com/rouge-ruby/rouge): Ruby syntax highlighter used in the `code_text` [Glimmer DSL for SWT custom widget](#custom-widgets) leveraged by the [Glimmer Meta-Sample](#samples)
|
571
|
+
- [rouge](https://github.com/rouge-ruby/rouge): Ruby syntax highlighter used in the `code_text` [Glimmer DSL for SWT custom widget](#custom-widgets) leveraged by the [Glimmer Meta-Sample](/docs/reference/GLIMMER_SAMPLES.md#samples)
|
572
572
|
- [super_module](https://github.com/AndyObtiva/super_module): used to cleanly write the Glimmer::UI:CustomWidget and Glimmer::UI::CustomShell modules
|
573
573
|
- [text-table](https://github.com/aptinio/text-table): renders textual data in a textual table for the command-line interface of Glimmer
|
574
574
|
- [warbler](https://github.com/jruby/warbler): converts a Glimmer app into a Java JAR file during packaging
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.20.0.
|
1
|
+
4.20.0.1
|
@@ -49,6 +49,7 @@ This guide should help you get started with Glimmer DSL for SWT. For more advanc
|
|
49
49
|
- [Animation via Data-Binding](#animation-via-data-binding)
|
50
50
|
- [Data-Binding](#data-binding)
|
51
51
|
- [General Examples](#general-examples)
|
52
|
+
- [Shine](#shine)
|
52
53
|
- [Combo](#combo)
|
53
54
|
- [List](#list)
|
54
55
|
- [Table](#table)
|
@@ -5,6 +5,8 @@
|
|
5
5
|
- [Hello, C Tab!](#hello-c-tab)
|
6
6
|
- [Hello, Combo!](#hello-combo)
|
7
7
|
- [Hello, C Combo!](#hello-c-combo)
|
8
|
+
- [Hello, Composite!](#hello-composite)
|
9
|
+
- [Hello, Layout!](#hello-layout)
|
8
10
|
- [Hello, List Single Selection!](#hello-list-single-selection)
|
9
11
|
- [Hello, List Multi Selection!](#hello-list-multi-selection)
|
10
12
|
- [Hello, Computed!](#hello-computed)
|
@@ -139,6 +141,38 @@ Code:
|
|
139
141
|
![Hello Combo](/images/glimmer-hello-c-combo.png)
|
140
142
|
![Hello Combo Expanded](/images/glimmer-hello-c-combo-expanded.png)
|
141
143
|
|
144
|
+
#### Hello, Composite!
|
145
|
+
|
146
|
+
This sample demonstrates the `composite` widget, which is simply used as a container for visual layout and organization.
|
147
|
+
|
148
|
+
Code:
|
149
|
+
|
150
|
+
[samples/hello/hello_composite.rb](/samples/hello/hello_composite.rb)
|
151
|
+
|
152
|
+
![Hello Composite](/images/glimmer-hello-composite.png)
|
153
|
+
|
154
|
+
#### Hello, Layout!
|
155
|
+
|
156
|
+
This sample demonstrates the standard 3 layouts in SWT (though one can write their own for very advanced applications): `fill_layout`, `row_layout`, and `grid_layout`
|
157
|
+
|
158
|
+
Code:
|
159
|
+
|
160
|
+
[samples/hello/hello_layout.rb](/samples/hello/hello_layout.rb)
|
161
|
+
|
162
|
+
![Hello Layout Tab1](/images/glimmer-hello-layout-tab1.png)
|
163
|
+
|
164
|
+
![Hello Layout Tab2](/images/glimmer-hello-layout-tab2.png)
|
165
|
+
|
166
|
+
![Hello Layout Tab3](/images/glimmer-hello-layout-tab3.png)
|
167
|
+
|
168
|
+
![Hello Layout Tab4](/images/glimmer-hello-layout-tab4.png)
|
169
|
+
|
170
|
+
![Hello Layout Tab5](/images/glimmer-hello-layout-tab5.png)
|
171
|
+
|
172
|
+
![Hello Layout Tab6](/images/glimmer-hello-layout-tab6.png)
|
173
|
+
|
174
|
+
![Hello Layout Tab7](/images/glimmer-hello-layout-tab7.png)
|
175
|
+
|
142
176
|
#### Hello, List Single Selection!
|
143
177
|
|
144
178
|
This sample demonstrates list single-selection data-binding.
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Copyright (c) 2007-2021 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
|
+
|
22
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
24
|
+
class HelloComposite
|
25
|
+
include Glimmer::UI::CustomShell
|
26
|
+
|
27
|
+
body {
|
28
|
+
shell {
|
29
|
+
# shell (which is a composite) has fill_layout(:horizontal) by default with no margins
|
30
|
+
# we override below
|
31
|
+
fill_layout(:vertical)
|
32
|
+
text 'Hello, Composite!'
|
33
|
+
|
34
|
+
composite { # composite simply contains widgets for visual organization via a layout
|
35
|
+
# it has grid_layout(1, false) as its default layout
|
36
|
+
label {
|
37
|
+
text "Field is above its text widget"
|
38
|
+
}
|
39
|
+
text {
|
40
|
+
layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
composite { # composite simply contains widgets for visual organization via a layout
|
45
|
+
grid_layout 2, true
|
46
|
+
|
47
|
+
label {
|
48
|
+
text "Field has equal width to its text widget's"
|
49
|
+
}
|
50
|
+
text {
|
51
|
+
layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
composite { # composite simply contains widgets for visual organization via a layout
|
56
|
+
grid_layout 2, false
|
57
|
+
|
58
|
+
label {
|
59
|
+
text "Field has inequal width"
|
60
|
+
}
|
61
|
+
|
62
|
+
text {
|
63
|
+
layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
HelloComposite.launch
|
@@ -0,0 +1,239 @@
|
|
1
|
+
# Copyright (c) 2007-2021 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
|
+
|
22
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
24
|
+
class HelloLayout
|
25
|
+
include Glimmer::UI::CustomShell
|
26
|
+
|
27
|
+
body {
|
28
|
+
shell {
|
29
|
+
# shell (which is a composite) has fill_layout(:horizontal) by default with no margins
|
30
|
+
text 'Hello, Layout!'
|
31
|
+
tab_folder {
|
32
|
+
|
33
|
+
# every tab item has its own composite, which can set a layout
|
34
|
+
tab_item {
|
35
|
+
text 'Fill Layout (horizontal)'
|
36
|
+
|
37
|
+
fill_layout(:horizontal) {
|
38
|
+
margin_width 30
|
39
|
+
margin_height 40
|
40
|
+
spacing 5
|
41
|
+
}
|
42
|
+
|
43
|
+
10.times { |n|
|
44
|
+
label {
|
45
|
+
text "<label #{n+1}>"
|
46
|
+
}
|
47
|
+
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
tab_item {
|
53
|
+
text 'Fill Layout (vertical)'
|
54
|
+
|
55
|
+
fill_layout {
|
56
|
+
type :vertical # alternative way of specifying orientation
|
57
|
+
margin_width 40
|
58
|
+
margin_height 30
|
59
|
+
spacing 10
|
60
|
+
}
|
61
|
+
|
62
|
+
10.times { |n|
|
63
|
+
label(:center) {
|
64
|
+
text "<label #{n+1}>"
|
65
|
+
}
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
tab_item {
|
72
|
+
text 'Row Layout (horizontal)'
|
73
|
+
|
74
|
+
row_layout(:horizontal) {
|
75
|
+
# row layout has margin attributes for top, left, right, and bottom
|
76
|
+
# in addition to width and height (and sets margin_width and margin_height to 5 by default)
|
77
|
+
margin_top 40
|
78
|
+
margin_left 30
|
79
|
+
spacing 5
|
80
|
+
wrap false
|
81
|
+
center true
|
82
|
+
justify true
|
83
|
+
}
|
84
|
+
|
85
|
+
10.times { |n|
|
86
|
+
label {
|
87
|
+
text "<label #{n+1}>"
|
88
|
+
}
|
89
|
+
|
90
|
+
}
|
91
|
+
|
92
|
+
}
|
93
|
+
|
94
|
+
tab_item {
|
95
|
+
text 'Row Layout (wrap on shrink)'
|
96
|
+
|
97
|
+
row_layout { # :horizontal is the default type
|
98
|
+
margin_height 40
|
99
|
+
margin_width 30
|
100
|
+
spacing 35
|
101
|
+
# wrap true # is the default
|
102
|
+
}
|
103
|
+
|
104
|
+
10.times { |n|
|
105
|
+
label {
|
106
|
+
text "<label #{n+1}>"
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
tab_item {
|
114
|
+
text 'Row Layout (vertical)'
|
115
|
+
background :yellow
|
116
|
+
|
117
|
+
row_layout(:vertical) { |l|
|
118
|
+
margin_height 0
|
119
|
+
margin_width 0
|
120
|
+
spacing 10
|
121
|
+
fill true # fills horizontally to match the widest child (opposite to row layout orientation)
|
122
|
+
center false # enable and disable fill to see what this does
|
123
|
+
}
|
124
|
+
|
125
|
+
10.times { |n|
|
126
|
+
label {
|
127
|
+
# layout_data allows a widget to tweak its layout configuration (generating RowData object for RowLayout)
|
128
|
+
layout_data {
|
129
|
+
height 30
|
130
|
+
# width unspecified yet calculated
|
131
|
+
}
|
132
|
+
text "<this is a ver#{'r'*(rand*200).to_i}y wide label #{n+1}>"
|
133
|
+
background :green
|
134
|
+
}
|
135
|
+
|
136
|
+
}
|
137
|
+
|
138
|
+
}
|
139
|
+
|
140
|
+
tab_item {
|
141
|
+
text 'Grid Layout'
|
142
|
+
|
143
|
+
grid_layout {
|
144
|
+
num_columns 5
|
145
|
+
make_columns_equal_width true
|
146
|
+
horizontal_spacing 15
|
147
|
+
vertical_spacing 10
|
148
|
+
|
149
|
+
# grid layout has margin attributes for top, left, right, and bottom
|
150
|
+
# in addition to width and height (and sets margin_width and margin_height to 5 by default)
|
151
|
+
margin_height 0
|
152
|
+
margin_top 20
|
153
|
+
}
|
154
|
+
|
155
|
+
10.times { |n|
|
156
|
+
label {
|
157
|
+
text "<this label is wide enough to fill #{n+1}>"
|
158
|
+
background :white
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
label {
|
163
|
+
# layout_data allows a widget to tweak its layout configuration (generating GridData object for GridLayout)
|
164
|
+
layout_data {
|
165
|
+
width_hint 120
|
166
|
+
height_hint 40
|
167
|
+
}
|
168
|
+
text "<this label is clipped>"
|
169
|
+
background :cyan
|
170
|
+
}
|
171
|
+
|
172
|
+
label {
|
173
|
+
# layout_data allows a widget to tweak its layout configuration (generating GridData object for GridLayout)
|
174
|
+
layout_data {
|
175
|
+
horizontal_span 2
|
176
|
+
}
|
177
|
+
text "<this label spans two columns, so it can contain more text than normal>"
|
178
|
+
background :green
|
179
|
+
}
|
180
|
+
|
181
|
+
label {
|
182
|
+
# layout_data allows a widget to tweak its layout configuration (generating GridData object for GridLayout)
|
183
|
+
layout_data {
|
184
|
+
vertical_span 2
|
185
|
+
vertical_alignment :fill
|
186
|
+
}
|
187
|
+
text "<this label spans two rows, \nso it can contain new lines\n1\n2\n3\n4\n5\n6\n7>"
|
188
|
+
background :yellow
|
189
|
+
}
|
190
|
+
|
191
|
+
5.times { label } # just filler
|
192
|
+
|
193
|
+
label {
|
194
|
+
|
195
|
+
# layout_data allows a widget to tweak its layout configuration (generating GridData object for GridLayout)
|
196
|
+
layout_data {
|
197
|
+
horizontal_span 5
|
198
|
+
horizontal_alignment :fill # could be :beginning, :center or :end too
|
199
|
+
vertical_alignment :fill # could be :beginning, :center, or :end too
|
200
|
+
grab_excess_horizontal_space true
|
201
|
+
grab_excess_vertical_space true
|
202
|
+
}
|
203
|
+
# layout_data :fill, :fill, true, true # short alternative of specifying what is above
|
204
|
+
|
205
|
+
text "<this label fills all the space it can get\nhorizontally and vertically>"
|
206
|
+
background :magenta
|
207
|
+
}
|
208
|
+
|
209
|
+
}
|
210
|
+
|
211
|
+
|
212
|
+
tab_item {
|
213
|
+
text 'Grid Layout (non-equal columns)'
|
214
|
+
|
215
|
+
grid_layout(2, false) # alt syntax: (numColumns, make_columns_equal_width)
|
216
|
+
|
217
|
+
10.times { |n|
|
218
|
+
label {
|
219
|
+
text "Field #{n+1}"
|
220
|
+
}
|
221
|
+
text {
|
222
|
+
layout_data {
|
223
|
+
width_hint 600
|
224
|
+
}
|
225
|
+
|
226
|
+
text "Please enter text"
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
}
|
231
|
+
|
232
|
+
}
|
233
|
+
|
234
|
+
}
|
235
|
+
|
236
|
+
}
|
237
|
+
end
|
238
|
+
|
239
|
+
HelloLayout.launch
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.20.0.
|
4
|
+
version: 4.20.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -344,7 +344,7 @@ description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a
|
|
344
344
|
libraries, thus enabling the delivery of desktop apps written in Ruby as truly native
|
345
345
|
DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged
|
346
346
|
Shell Scripts on Linux. Glimmer was the first Ruby gem to bring SWT (Standard Widget
|
347
|
-
Toolkit) to Ruby, thanks to creator Andy Maleh,
|
347
|
+
Toolkit) to Ruby, thanks to creator Andy Maleh, EclipseCon/EclipseWorld/RubyConf
|
348
348
|
speaker and expert.
|
349
349
|
email: andy.am@gmail.com
|
350
350
|
executables:
|
@@ -551,6 +551,7 @@ files:
|
|
551
551
|
- samples/hello/hello_code_text.rb
|
552
552
|
- samples/hello/hello_color_dialog.rb
|
553
553
|
- samples/hello/hello_combo.rb
|
554
|
+
- samples/hello/hello_composite.rb
|
554
555
|
- samples/hello/hello_computed.rb
|
555
556
|
- samples/hello/hello_computed/contact.rb
|
556
557
|
- samples/hello/hello_cursor.rb
|
@@ -565,6 +566,7 @@ files:
|
|
565
566
|
- samples/hello/hello_file_dialog.rb
|
566
567
|
- samples/hello/hello_font_dialog.rb
|
567
568
|
- samples/hello/hello_group.rb
|
569
|
+
- samples/hello/hello_layout.rb
|
568
570
|
- samples/hello/hello_link.rb
|
569
571
|
- samples/hello/hello_list_multi_selection.rb
|
570
572
|
- samples/hello/hello_list_single_selection.rb
|