glimmer-dsl-swt 4.22.2.2 → 4.22.2.3
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 +5 -5
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +145 -0
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/swt/layout_data_proxy.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20cdf050b145adb888f8e82caa9c8d90e5b076cab423bc795ed963a75c279fd4
|
4
|
+
data.tar.gz: 57e52e57c1fcc8dcc373dec79505fb1ee9547d4a50d4aa4e126395e689f91033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b6102a2d26c71dd635a5f8eadd9704ff263ee7124ac0428fe8dd53f661b893e7c08832e3fbcf17bbbc57b2e60754314d7943a2cce2a3be6bc2104205e1caef0
|
7
|
+
data.tar.gz: e9090d6f91a0b337e173f478c3371c47e9040d46af340e851f5d8e318ca66297fd0dc043814738b202e1ce0648987a46f4e5d27edf6fba3e81ff504779cd584d
|
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.22.2.
|
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.22.2.3
|
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)
|
@@ -17,7 +17,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
17
17
|
|
18
18
|
![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
|
19
19
|
|
20
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.22.2.
|
20
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.22.2.3 includes [SWT 4.22](https://download.eclipse.org/eclipse/downloads/drops4/R-4.22-202111241800/), which was released on November 24, 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.
|
21
21
|
|
22
22
|
**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.
|
23
23
|
|
@@ -328,7 +328,7 @@ jgem install glimmer-dsl-swt
|
|
328
328
|
|
329
329
|
Or this command if you want a specific version:
|
330
330
|
```
|
331
|
-
jgem install glimmer-dsl-swt -v 4.22.2.
|
331
|
+
jgem install glimmer-dsl-swt -v 4.22.2.3
|
332
332
|
```
|
333
333
|
|
334
334
|
`jgem` is JRuby's version of `gem` command.
|
@@ -356,7 +356,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
356
356
|
|
357
357
|
Add the following to `Gemfile`:
|
358
358
|
```
|
359
|
-
gem 'glimmer-dsl-swt', '~> 4.22.2.
|
359
|
+
gem 'glimmer-dsl-swt', '~> 4.22.2.3'
|
360
360
|
```
|
361
361
|
|
362
362
|
And, then run:
|
@@ -379,7 +379,7 @@ glimmer
|
|
379
379
|
```
|
380
380
|
|
381
381
|
```
|
382
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.22.2.
|
382
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.22.2.3
|
383
383
|
|
384
384
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
385
385
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.22.2.
|
1
|
+
4.22.2.3
|
@@ -1495,6 +1495,13 @@ Glimmer composites always come with `grid_layout` by default, but you can still
|
|
1495
1495
|
|
1496
1496
|
Glimmer shell always comes with `fill_layout` having `:horizontal` type.
|
1497
1497
|
|
1498
|
+
If you ever want to force a re-layout on a `composite` or `shell`, you can call the following:
|
1499
|
+
|
1500
|
+
```ruby
|
1501
|
+
composite_or_shell.layout(true, true)
|
1502
|
+
composite_or_shell.pack(true)
|
1503
|
+
```
|
1504
|
+
|
1498
1505
|
This is a great guide for learning more about SWT layouts:
|
1499
1506
|
|
1500
1507
|
https://www.eclipse.org/articles/Article-Understanding-Layouts/Understanding-Layouts.htm
|
@@ -1579,6 +1586,144 @@ composite {
|
|
1579
1586
|
|
1580
1587
|
If you data-bind any layout data properties, when they change, the shell containing their widget re-packs its children (calls `#pack` method automatically) to ensure proper relayout of all widgets.
|
1581
1588
|
|
1589
|
+
Also, if you ever want a widget to be excluded from layout entirely (in addition to having `visible false` on the widget), you can set `layout_data { exclude true }` or data-bind `exclude` property of `layout_data` to have a widget included/excluded automatically based on a condition.
|
1590
|
+
|
1591
|
+
Here is a re-implementation of the [Login sample](/docs/reference/GLIMMER_SAMPLES.md#login) that hides/shows login/logout buttons upon login/logout (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
1592
|
+
|
1593
|
+
```ruby
|
1594
|
+
require 'glimmer-dsl-swt'
|
1595
|
+
|
1596
|
+
class LoginPresenter
|
1597
|
+
|
1598
|
+
attr_accessor :user_name
|
1599
|
+
attr_accessor :password
|
1600
|
+
attr_accessor :status
|
1601
|
+
|
1602
|
+
def initialize
|
1603
|
+
@user_name = ""
|
1604
|
+
@password = ""
|
1605
|
+
@status = "Logged Out"
|
1606
|
+
end
|
1607
|
+
|
1608
|
+
def status=(status)
|
1609
|
+
@status = status
|
1610
|
+
end
|
1611
|
+
|
1612
|
+
def valid?
|
1613
|
+
!@user_name.to_s.strip.empty? && !@password.to_s.strip.empty?
|
1614
|
+
end
|
1615
|
+
|
1616
|
+
def logged_in?
|
1617
|
+
self.status == "Logged In"
|
1618
|
+
end
|
1619
|
+
|
1620
|
+
def logged_out?
|
1621
|
+
!self.logged_in?
|
1622
|
+
end
|
1623
|
+
|
1624
|
+
def login!
|
1625
|
+
return unless valid?
|
1626
|
+
self.status = "Logged In"
|
1627
|
+
end
|
1628
|
+
|
1629
|
+
def logout!
|
1630
|
+
self.user_name = ""
|
1631
|
+
self.password = ""
|
1632
|
+
self.status = "Logged Out"
|
1633
|
+
end
|
1634
|
+
|
1635
|
+
end
|
1636
|
+
|
1637
|
+
class Login
|
1638
|
+
include Glimmer::UI::CustomShell
|
1639
|
+
|
1640
|
+
before_body do
|
1641
|
+
@presenter = LoginPresenter.new
|
1642
|
+
end
|
1643
|
+
|
1644
|
+
body {
|
1645
|
+
shell {
|
1646
|
+
text "Login"
|
1647
|
+
|
1648
|
+
composite {
|
1649
|
+
grid_layout(2, false) #two columns with differing widths
|
1650
|
+
|
1651
|
+
label { text "Username:" } # goes in column 1
|
1652
|
+
@user_name_text = text { # goes in column 2
|
1653
|
+
layout_data :fill, :center, true, false
|
1654
|
+
text <=> [@presenter, :user_name]
|
1655
|
+
enabled <= [@presenter, :logged_out?, computed_by: :status]
|
1656
|
+
|
1657
|
+
on_key_pressed { |event|
|
1658
|
+
@password_text.set_focus if event.keyCode == swt(:cr)
|
1659
|
+
}
|
1660
|
+
}
|
1661
|
+
|
1662
|
+
label { text "Password:" }
|
1663
|
+
@password_text = text(:password, :border) {
|
1664
|
+
layout_data :fill, :center, true, false
|
1665
|
+
text <=> [@presenter, :password]
|
1666
|
+
enabled <= [@presenter, :logged_out?, computed_by: :status]
|
1667
|
+
|
1668
|
+
on_key_pressed { |event|
|
1669
|
+
@presenter.login! if event.keyCode == swt(:cr)
|
1670
|
+
}
|
1671
|
+
}
|
1672
|
+
|
1673
|
+
label { text "Status:" }
|
1674
|
+
label {
|
1675
|
+
layout_data :fill, :center, true, false
|
1676
|
+
text <= [@presenter, :status]
|
1677
|
+
}
|
1678
|
+
|
1679
|
+
button {
|
1680
|
+
layout_data {
|
1681
|
+
exclude <= [@presenter, :logged_in?, computed_by: :status]
|
1682
|
+
}
|
1683
|
+
|
1684
|
+
text "Login"
|
1685
|
+
visible <= [@presenter, :logged_out?, computed_by: :status]
|
1686
|
+
|
1687
|
+
on_widget_selected { @presenter.login! }
|
1688
|
+
on_key_pressed { |event|
|
1689
|
+
if event.keyCode == swt(:cr)
|
1690
|
+
@presenter.login!
|
1691
|
+
end
|
1692
|
+
}
|
1693
|
+
}
|
1694
|
+
|
1695
|
+
button {
|
1696
|
+
layout_data {
|
1697
|
+
exclude <= [@presenter, :logged_out?, computed_by: :status]
|
1698
|
+
}
|
1699
|
+
|
1700
|
+
text "Logout"
|
1701
|
+
visible <= [@presenter, :logged_in?, computed_by: :status]
|
1702
|
+
|
1703
|
+
on_widget_selected { @presenter.logout! }
|
1704
|
+
on_key_pressed { |event|
|
1705
|
+
if event.keyCode == swt(:cr)
|
1706
|
+
@presenter.logout!
|
1707
|
+
@user_name_text.set_focus
|
1708
|
+
end
|
1709
|
+
}
|
1710
|
+
}
|
1711
|
+
}
|
1712
|
+
}
|
1713
|
+
}
|
1714
|
+
end
|
1715
|
+
|
1716
|
+
Login.launch
|
1717
|
+
```
|
1718
|
+
|
1719
|
+
Login (with `exclude` data-binding) - Logged Out
|
1720
|
+
|
1721
|
+
![Login Exclude Logged Out](/images/glimmer-login-exclude-logged-out.png)
|
1722
|
+
|
1723
|
+
Login (with `exclude` data-binding) - Logged In
|
1724
|
+
|
1725
|
+
![Login Exclude Logged In](/images/glimmer-login-exclude-logged-in.png)
|
1726
|
+
|
1582
1727
|
**NOTE**: Layout data must never be reused between widgets. Always specify or clone again for every widget.
|
1583
1728
|
|
1584
1729
|
This is a great guide for learning more about SWT layouts:
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -106,6 +106,10 @@ module Glimmer
|
|
106
106
|
def attribute_getter(attribute_name)
|
107
107
|
"#{attribute_name.to_s.camelcase(:lower)}"
|
108
108
|
end
|
109
|
+
|
110
|
+
def content(&block)
|
111
|
+
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::SWT::LayoutDataExpression.new, 'layout_data', &block)
|
112
|
+
end
|
109
113
|
end
|
110
114
|
end
|
111
115
|
end
|