glimmer 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +116 -95
- data/VERSION +1 -1
- data/lib/glimmer.rb +0 -20
- data/lib/glimmer/config.rb +0 -13
- data/lib/glimmer/dsl/engine.rb +25 -18
- data/lib/glimmer/dsl/expression.rb +0 -7
- data/lib/glimmer/dsl/static_expression.rb +2 -2
- metadata +47 -177
- data/RUBY_VERSION +0 -1
- data/bin/girb +0 -10
- data/bin/girb_runner.rb +0 -13
- data/bin/glimmer +0 -5
- data/icons/scaffold_app.icns +0 -0
- data/lib/glimmer/css/rule.rb +0 -25
- data/lib/glimmer/css/style_sheet.rb +0 -19
- data/lib/glimmer/data_binding/list_selection_binding.rb +0 -52
- data/lib/glimmer/data_binding/model_binding.rb +0 -248
- data/lib/glimmer/data_binding/observable.rb +0 -21
- data/lib/glimmer/data_binding/observable_array.rb +0 -107
- data/lib/glimmer/data_binding/observable_model.rb +0 -108
- data/lib/glimmer/data_binding/observable_widget.rb +0 -17
- data/lib/glimmer/data_binding/observer.rb +0 -124
- data/lib/glimmer/data_binding/shine.rb +0 -23
- data/lib/glimmer/data_binding/table_items_binding.rb +0 -56
- data/lib/glimmer/data_binding/tree_items_binding.rb +0 -71
- data/lib/glimmer/data_binding/widget_binding.rb +0 -33
- data/lib/glimmer/dsl/css/css_expression.rb +0 -21
- data/lib/glimmer/dsl/css/dsl.rb +0 -10
- data/lib/glimmer/dsl/css/dynamic_property_expression.rb +0 -12
- data/lib/glimmer/dsl/css/property_expression.rb +0 -22
- data/lib/glimmer/dsl/css/pv_expression.rb +0 -17
- data/lib/glimmer/dsl/css/rule_expression.rb +0 -25
- data/lib/glimmer/dsl/css/s_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/async_exec_expression.rb +0 -14
- data/lib/glimmer/dsl/swt/bind_expression.rb +0 -37
- data/lib/glimmer/dsl/swt/color_expression.rb +0 -19
- data/lib/glimmer/dsl/swt/column_properties_expression.rb +0 -24
- data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +0 -42
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +0 -36
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +0 -34
- data/lib/glimmer/dsl/swt/dialog_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/display_expression.rb +0 -19
- data/lib/glimmer/dsl/swt/dsl.rb +0 -28
- data/lib/glimmer/dsl/swt/exec_expression.rb +0 -28
- data/lib/glimmer/dsl/swt/layout_data_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/layout_expression.rb +0 -27
- data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +0 -44
- data/lib/glimmer/dsl/swt/menu_bar_expression.rb +0 -33
- data/lib/glimmer/dsl/swt/menu_expression.rb +0 -32
- data/lib/glimmer/dsl/swt/message_box_expression.rb +0 -29
- data/lib/glimmer/dsl/swt/observe_expression.rb +0 -32
- data/lib/glimmer/dsl/swt/property_expression.rb +0 -22
- data/lib/glimmer/dsl/swt/rgb_expression.rb +0 -12
- data/lib/glimmer/dsl/swt/rgba_expression.rb +0 -12
- data/lib/glimmer/dsl/swt/shell_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/swt_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/sync_exec_expression.rb +0 -15
- data/lib/glimmer/dsl/swt/tab_item_expression.rb +0 -33
- data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +0 -31
- data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +0 -31
- data/lib/glimmer/dsl/swt/tree_properties_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/widget_expression.rb +0 -35
- data/lib/glimmer/dsl/swt/widget_listener_expression.rb +0 -32
- data/lib/glimmer/dsl/xml/dsl.rb +0 -11
- data/lib/glimmer/dsl/xml/html_expression.rb +0 -25
- data/lib/glimmer/dsl/xml/meta_expression.rb +0 -23
- data/lib/glimmer/dsl/xml/name_space_expression.rb +0 -37
- data/lib/glimmer/dsl/xml/node_parent_expression.rb +0 -33
- data/lib/glimmer/dsl/xml/tag_expression.rb +0 -29
- data/lib/glimmer/dsl/xml/text_expression.rb +0 -22
- data/lib/glimmer/dsl/xml/xml_expression.rb +0 -21
- data/lib/glimmer/launcher.rb +0 -199
- data/lib/glimmer/package.rb +0 -55
- data/lib/glimmer/rake_task.rb +0 -58
- data/lib/glimmer/scaffold.rb +0 -582
- data/lib/glimmer/swt/color_proxy.rb +0 -53
- data/lib/glimmer/swt/display_proxy.rb +0 -88
- data/lib/glimmer/swt/font_proxy.rb +0 -72
- data/lib/glimmer/swt/layout_data_proxy.rb +0 -84
- data/lib/glimmer/swt/layout_proxy.rb +0 -82
- data/lib/glimmer/swt/menu_proxy.rb +0 -101
- data/lib/glimmer/swt/message_box_proxy.rb +0 -48
- data/lib/glimmer/swt/packages.rb +0 -13
- data/lib/glimmer/swt/shell_proxy.rb +0 -152
- data/lib/glimmer/swt/swt_proxy.rb +0 -106
- data/lib/glimmer/swt/tab_item_proxy.rb +0 -65
- data/lib/glimmer/swt/table_proxy.rb +0 -150
- data/lib/glimmer/swt/tree_proxy.rb +0 -120
- data/lib/glimmer/swt/widget_listener_proxy.rb +0 -34
- data/lib/glimmer/swt/widget_proxy.rb +0 -489
- data/lib/glimmer/ui/custom_shell.rb +0 -45
- data/lib/glimmer/ui/custom_widget.rb +0 -244
- data/lib/glimmer/util/proc_tracker.rb +0 -16
- data/lib/glimmer/xml/depth_first_search_iterator.rb +0 -22
- data/lib/glimmer/xml/name_space_visitor.rb +0 -21
- data/lib/glimmer/xml/node.rb +0 -75
- data/lib/glimmer/xml/node_visitor.rb +0 -13
- data/lib/glimmer/xml/xml_visitor.rb +0 -65
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c109cca015308e3a388d79b30ece439200ebf53d300cb2305be5c7a3845790eb
|
4
|
+
data.tar.gz: ad27543079db9eabface83fdf67342dabe37b1b01ba64e03c545bb1bea08158b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccdd49212a55e8ee6a91ae603314e926dfc8944c2b972e2fbf3e387b01020c6b9cdd5eeb28155f5b305f5f517e488414c01fc1f5cdec46372a34c41e467dff15
|
7
|
+
data.tar.gz: c19d423a2cf484f6749072e38e1f0608395420e2a44960672a5c9620867431ebae6d12e2015f8bf398bc6d565e0a8e661f86225880d42a7fd699146c9c65c342
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
# Glimmer
|
1
|
+
# Glimmer - Ruby Desktop Development GUI Library
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
|
3
3
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer)
|
4
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/38fbc278022862794414/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer/maintainability)
|
5
4
|
|
6
5
|
Glimmer is a native-GUI cross-platform desktop development library written in Ruby. Glimmer's main innovation is a JRuby DSL that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support to greatly facilitate synchronizing the GUI with domain models. As a result, that achieves true decoupling of object oriented components, enabling developers to solve business problems without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models test-first afterwards.
|
7
6
|
|
@@ -72,9 +71,11 @@ Glimmer app:
|
|
72
71
|
|
73
72
|
NOTE: Glimmer is in beta mode. Please help make better by [contributing](#contributing), adopting for small or low risk projects, and providing feedback.
|
74
73
|
|
74
|
+
Ruby is a dynamically-typed object-oriented language, which provides great productivity gains due to its powerful expressive syntax and dynamic nature. While it is proven by the Ruby on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that Java libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as SWT, JFace, and RCP can help fill the gap of desktop application development with Ruby.
|
75
|
+
|
75
76
|
## Table of contents
|
76
77
|
|
77
|
-
- [Glimmer
|
78
|
+
- [Glimmer - Ruby Desktop Development GUI Library](#glimmer-ruby-desktop-development-gui-library)
|
78
79
|
- [Examples](#examples)
|
79
80
|
- [Hello, World!](#hello-world)
|
80
81
|
- [Tic Tac Toe](#tic-tac-toe)
|
@@ -125,9 +126,9 @@ NOTE: Glimmer is in beta mode. Please help make better by [contributing](#contri
|
|
125
126
|
- [Gotcha](#gotcha)
|
126
127
|
- [Custom Shells](#custom-shells)
|
127
128
|
- [Miscellaneous](#miscellaneous)
|
129
|
+
- [Multi-DSL Support](#multi-dsl-support)
|
128
130
|
- [Application Menu Items (About/Preferences)](#application-menu-items-aboutpreferences)
|
129
131
|
- [App Name and Version](#app-name-and-version)
|
130
|
-
- [Multi-DSL Support](#multi-dsl-support)
|
131
132
|
- [Video Widget](#video-widget)
|
132
133
|
- [Browser Widget](#browser-widget)
|
133
134
|
- [Glimmer Style Guide](#glimmer-style-guide)
|
@@ -204,7 +205,7 @@ Please follow these instructions to make the `glimmer` command available on your
|
|
204
205
|
|
205
206
|
Run this command to install directly:
|
206
207
|
```
|
207
|
-
jgem install glimmer -v 0.
|
208
|
+
jgem install glimmer-dsl-swt -v 0.1.0
|
208
209
|
```
|
209
210
|
|
210
211
|
`jgem` is JRuby's version of `gem` command.
|
@@ -215,7 +216,7 @@ Otherwise, you may also run `jruby -S gem install ...`
|
|
215
216
|
|
216
217
|
Add the following to `Gemfile`:
|
217
218
|
```
|
218
|
-
gem 'glimmer', '~> 0.
|
219
|
+
gem 'glimmer-dsl-swt', '~> 0.1.0'
|
219
220
|
```
|
220
221
|
|
221
222
|
And, then run:
|
@@ -223,6 +224,8 @@ And, then run:
|
|
223
224
|
jruby -S bundle install
|
224
225
|
```
|
225
226
|
|
227
|
+
You may learn more about other Glimmer related gems at [Multi-DSL Support](#multi-dsl-support)
|
228
|
+
|
226
229
|
## Glimmer Command
|
227
230
|
|
228
231
|
### Basic Usage
|
@@ -424,7 +427,7 @@ With Glimmer installed, you may want to run `girb` instead of standard `irb` to
|
|
424
427
|
girb
|
425
428
|
```
|
426
429
|
|
427
|
-
If you cloned
|
430
|
+
If you cloned [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) project locally, you may run `bin/girb` instead.
|
428
431
|
|
429
432
|
```
|
430
433
|
bin/girb
|
@@ -432,6 +435,8 @@ bin/girb
|
|
432
435
|
|
433
436
|
Watch out for hands-on examples in this README indicated by "you may copy/paste in [`girb`](#girb-glimmer-irb-command)"
|
434
437
|
|
438
|
+
Keep in mind that all samples live under [https://github.com/AndyObtiva/glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt)
|
439
|
+
|
435
440
|
## Glimmer DSL Syntax
|
436
441
|
|
437
442
|
Glimmer DSL syntax consists of static keywords and dynamic keywords to build and bind user-interface objects.
|
@@ -1794,92 +1799,19 @@ shell { |app_shell|
|
|
1794
1799
|
|
1795
1800
|
### Miscellaneous
|
1796
1801
|
|
1797
|
-
####
|
1798
|
-
|
1799
|
-
Mac applications always have About and Preferences menu items. Glimmer provides widget observer hooks for them on the `display`:
|
1800
|
-
- `on_about`: executes code when user selects App Name -> About
|
1801
|
-
- `on_preferences`: executes code when user selects App Name -> Preferences or hits 'CMD+,' on the Mac
|
1802
|
-
|
1803
|
-
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
1804
|
-
|
1805
|
-
```ruby
|
1806
|
-
class Example
|
1807
|
-
def initialize
|
1808
|
-
display {
|
1809
|
-
on_about {
|
1810
|
-
message_box = MessageBox.new(@shell_proxy.swt_widget)
|
1811
|
-
message_box.setText("About")
|
1812
|
-
message_box.setMessage("About Application")
|
1813
|
-
message_box.open
|
1814
|
-
}
|
1815
|
-
on_preferences {
|
1816
|
-
preferences_dialog = dialog {
|
1817
|
-
text 'Preferences'
|
1818
|
-
row_layout {
|
1819
|
-
type :vertical
|
1820
|
-
margin_left 15
|
1821
|
-
margin_top 15
|
1822
|
-
margin_right 15
|
1823
|
-
margin_bottom 15
|
1824
|
-
}
|
1825
|
-
label {
|
1826
|
-
text 'Check one of these options:'
|
1827
|
-
}
|
1828
|
-
button(:radio) {
|
1829
|
-
text 'Option 1'
|
1830
|
-
}
|
1831
|
-
button(:radio) {
|
1832
|
-
text 'Option 2'
|
1833
|
-
}
|
1834
|
-
}
|
1835
|
-
preferences_dialog.open
|
1836
|
-
}
|
1837
|
-
}
|
1838
|
-
@shell_proxy = shell {
|
1839
|
-
text 'Application Menu Items'
|
1840
|
-
fill_layout {
|
1841
|
-
margin_width 15
|
1842
|
-
margin_height 15
|
1843
|
-
}
|
1844
|
-
label {
|
1845
|
-
text 'Application Menu Items'
|
1846
|
-
font height: 30
|
1847
|
-
}
|
1848
|
-
}
|
1849
|
-
@shell_proxy.open
|
1850
|
-
end
|
1851
|
-
end
|
1852
|
-
|
1853
|
-
Example.new
|
1854
|
-
```
|
1855
|
-
|
1856
|
-
#### App Name and Version
|
1857
|
-
|
1858
|
-
Application name (shows up on the Mac in top menu bar) and version may be specified upon [packaging](#packaging--distribution) by specifying "-Bmac.CFBundleName" and "-Bmac.CFBundleVersion" options.
|
1859
|
-
|
1860
|
-
Still, if you would like proper application name to show up on the Mac top menu bar during development, you may do so by invoking the SWT Display.setAppName method before any Display object has been instantiated (i.e. before any Glimmer widget like shell has been declared).
|
1861
|
-
|
1862
|
-
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
1863
|
-
|
1864
|
-
```ruby
|
1865
|
-
Display.setAppName('Glimmer Demo')
|
1866
|
-
|
1867
|
-
shell(:no_resize) {
|
1868
|
-
text "Glimmer"
|
1869
|
-
label {
|
1870
|
-
text "Hello, World!"
|
1871
|
-
}
|
1872
|
-
}.open
|
1873
|
-
```
|
1802
|
+
#### Multi-DSL Support
|
1874
1803
|
|
1875
|
-
|
1804
|
+
Glimmer is a DSL engine that supports multiple DSLs (Domain Specific Languages):
|
1805
|
+
- [SWT](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (Desktop GUI)
|
1806
|
+
- [Opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
|
1807
|
+
- [XML](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML) - Useful with [SWT Browser Widget](#browser-widget)
|
1808
|
+
- [CSS](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets) - Useful with [SWT Browser Widget](#browser-widget)
|
1876
1809
|
|
1877
|
-
|
1810
|
+
Glimmer automatically recognizes top-level keywords in each DSL and activates DSL accordingly. Glimmer allows mixing DSLs, which comes in handy when doing things like using the SWT Browser widget with XML and CSS. Once done processing a nested DSL top-level keyword, Glimmer switches back to the prior DSL automatically.
|
1878
1811
|
|
1879
|
-
|
1880
|
-
and switches DSLs accordingly. Once done processing a top-level keyword, it switches back to the prior DSL automatically.
|
1812
|
+
##### SWT
|
1881
1813
|
|
1882
|
-
|
1814
|
+
The SWT DSL was already covered in detail. However, for the sake of mixing DSLs, you need to know that the SWT DSL has the following top-level keywords:
|
1883
1815
|
- `shell`
|
1884
1816
|
- `display`
|
1885
1817
|
- `color`
|
@@ -1887,7 +1819,13 @@ For example, the SWT DSL has the following top-level keywords:
|
|
1887
1819
|
- `async_exec`
|
1888
1820
|
- `sync_exec`
|
1889
1821
|
|
1890
|
-
#####
|
1822
|
+
##### Opal
|
1823
|
+
|
1824
|
+
Full instructions are found in the [Opal](https://github.com/AndyObtiva/glimmer-dsl-opal) DSL page.
|
1825
|
+
|
1826
|
+
The [Opal](https://github.com/AndyObtiva/glimmer-dsl-opal) DSL is simply a web GUI adapter for desktop apps written in Glimmer. As such, it supports all the DSL keywords of the SWT DSL and shares the same top-level keywords.
|
1827
|
+
|
1828
|
+
##### XML
|
1891
1829
|
|
1892
1830
|
Simply start with `html` keyword and add HTML inside its block using Glimmer DSL syntax.
|
1893
1831
|
Once done, you may call `to_s`, `to_xml`, or `to_html` to get the formatted HTML output.
|
@@ -1965,8 +1903,7 @@ Output:
|
|
1965
1903
|
<DOCUMENT><document:body document:id="main"></document:body></DOCUMENT>
|
1966
1904
|
```
|
1967
1905
|
|
1968
|
-
|
1969
|
-
##### CSS DSL
|
1906
|
+
##### CSS
|
1970
1907
|
|
1971
1908
|
Simply start with `css` keyword and add stylesheet rule sets inside its block using Glimmer DSL syntax.
|
1972
1909
|
Once done, you may call `to_s` or `to_css` to get the formatted CSS output.
|
@@ -2002,6 +1939,86 @@ Glimmer provides a number of methods on Glimmer::DSL::Engine to configure DSL su
|
|
2002
1939
|
- `Glimmer::DSL::Engine.enable_dsl(dsl_name)`: Re-enables disabled DSL
|
2003
1940
|
- `Glimmer::DSL::Engine.enabled_dsls=(dsl_names)`: Disables all DSLs except the ones specified.
|
2004
1941
|
|
1942
|
+
#### Application Menu Items (About/Preferences)
|
1943
|
+
|
1944
|
+
Mac applications always have About and Preferences menu items. Glimmer provides widget observer hooks for them on the `display`:
|
1945
|
+
- `on_about`: executes code when user selects App Name -> About
|
1946
|
+
- `on_preferences`: executes code when user selects App Name -> Preferences or hits 'CMD+,' on the Mac
|
1947
|
+
|
1948
|
+
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
1949
|
+
|
1950
|
+
```ruby
|
1951
|
+
class Example
|
1952
|
+
def initialize
|
1953
|
+
display {
|
1954
|
+
on_about {
|
1955
|
+
message_box = MessageBox.new(@shell_proxy.swt_widget)
|
1956
|
+
message_box.setText("About")
|
1957
|
+
message_box.setMessage("About Application")
|
1958
|
+
message_box.open
|
1959
|
+
}
|
1960
|
+
on_preferences {
|
1961
|
+
preferences_dialog = dialog {
|
1962
|
+
text 'Preferences'
|
1963
|
+
row_layout {
|
1964
|
+
type :vertical
|
1965
|
+
margin_left 15
|
1966
|
+
margin_top 15
|
1967
|
+
margin_right 15
|
1968
|
+
margin_bottom 15
|
1969
|
+
}
|
1970
|
+
label {
|
1971
|
+
text 'Check one of these options:'
|
1972
|
+
}
|
1973
|
+
button(:radio) {
|
1974
|
+
text 'Option 1'
|
1975
|
+
}
|
1976
|
+
button(:radio) {
|
1977
|
+
text 'Option 2'
|
1978
|
+
}
|
1979
|
+
}
|
1980
|
+
preferences_dialog.open
|
1981
|
+
}
|
1982
|
+
}
|
1983
|
+
@shell_proxy = shell {
|
1984
|
+
text 'Application Menu Items'
|
1985
|
+
fill_layout {
|
1986
|
+
margin_width 15
|
1987
|
+
margin_height 15
|
1988
|
+
}
|
1989
|
+
label {
|
1990
|
+
text 'Application Menu Items'
|
1991
|
+
font height: 30
|
1992
|
+
}
|
1993
|
+
}
|
1994
|
+
@shell_proxy.open
|
1995
|
+
end
|
1996
|
+
end
|
1997
|
+
|
1998
|
+
Example.new
|
1999
|
+
```
|
2000
|
+
|
2001
|
+
#### App Name and Version
|
2002
|
+
|
2003
|
+
Application name (shows up on the Mac in top menu bar) and version may be specified upon [packaging](#packaging--distribution) by specifying "-Bmac.CFBundleName" and "-Bmac.CFBundleVersion" options.
|
2004
|
+
|
2005
|
+
Still, if you would like proper application name to show up on the Mac top menu bar during development, you may do so by invoking the SWT Display.setAppName method before any Display object has been instantiated (i.e. before any Glimmer widget like shell has been declared).
|
2006
|
+
|
2007
|
+
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
2008
|
+
|
2009
|
+
```ruby
|
2010
|
+
Display.setAppName('Glimmer Demo')
|
2011
|
+
|
2012
|
+
shell(:no_resize) {
|
2013
|
+
text "Glimmer"
|
2014
|
+
label {
|
2015
|
+
text "Hello, World!"
|
2016
|
+
}
|
2017
|
+
}.open
|
2018
|
+
```
|
2019
|
+
|
2020
|
+
Also, you may invoke `Display.setAppVersion('1.0.0')` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
|
2021
|
+
|
2005
2022
|
#### Video Widget
|
2006
2023
|
|
2007
2024
|
![Video Widget](images/glimmer-video-widget.png)
|
@@ -2025,7 +2042,7 @@ shell {
|
|
2025
2042
|
}.open
|
2026
2043
|
```
|
2027
2044
|
|
2028
|
-
Example rendering HTML with JavaScript on document ready (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
2045
|
+
Example rendering HTML with JavaScript on document ready (you may copy/paste in [`girb`](#girb-glimmer-irb-command) provided you install and require [glimmer-dsl-xml gem](https://github.com/AndyObtiva/glimmer-dsl-xml)):
|
2029
2046
|
|
2030
2047
|
```ruby
|
2031
2048
|
shell {
|
@@ -2046,7 +2063,7 @@ shell {
|
|
2046
2063
|
}.open
|
2047
2064
|
```
|
2048
2065
|
|
2049
|
-
This relies on Glimmer's [Multi-DSL Support](
|
2066
|
+
This relies on Glimmer's [Multi-DSL Support](#multi-dsl-support) for building the HTML text using [Glimmer XML DSL](https://github.com/AndyObtiva/glimmer-dsl-xml).
|
2050
2067
|
|
2051
2068
|
## Glimmer Style Guide
|
2052
2069
|
|
@@ -2374,6 +2391,10 @@ By the way, keep in mind that during normal operation, it does also indicate a f
|
|
2374
2391
|
Exec failed with code 2 command [[/usr/bin/SetFile, -c, icnC, /var/folders/4_/g1sw__tx6mjdgyh3mky7vydc0000gp/T/fxbundler4076750801763032201/images/MathBowling/.VolumeIcon.icns] in unspecified directory
|
2375
2392
|
```
|
2376
2393
|
|
2394
|
+
## Limitations
|
2395
|
+
|
2396
|
+
- Glimmer apps have a long startup up time and can take anywhere between 12 and 30 seconds to start depending on the app and the machine. Once started, Glimmer apps run very fast and perform very responsively since Ruby is more than fast and capable for handling desktop GUIs. In any case, one idea to address this limitation is to include a background service (daemon) that can launch Glimmer apps instantly or near instantly by keeping a JRuby runtime started and ready at all times.
|
2397
|
+
|
2377
2398
|
## Resources
|
2378
2399
|
|
2379
2400
|
* [Code Master Blog](http://andymaleh.blogspot.com/search/label/Glimmer)
|
@@ -2401,7 +2422,7 @@ If you need live help, try the [#glimmer](http://widget.mibbit.com/?settings=751
|
|
2401
2422
|
|
2402
2423
|
These features have been suggested. You might see them in a future version of Glimmer. You are welcome to contribute more feature suggestions.
|
2403
2424
|
|
2404
|
-
[TODO.md](TODO.md)
|
2425
|
+
[TODO.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/TODO.md)
|
2405
2426
|
|
2406
2427
|
## Change Log
|
2407
2428
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
data/lib/glimmer.rb
CHANGED
@@ -2,14 +2,8 @@
|
|
2
2
|
# interfaces using the robust platform-independent Eclipse SWT library. Glimmer
|
3
3
|
# comes with built-in data-binding support to greatly facilitate synchronizing
|
4
4
|
# UI with domain models.
|
5
|
-
require 'facets'
|
6
|
-
require 'super_module'
|
7
5
|
require 'logger'
|
8
|
-
require 'java'
|
9
6
|
require 'set'
|
10
|
-
require 'nested_inherited_jruby_include_package'
|
11
|
-
require 'fileutils'
|
12
|
-
require 'os'
|
13
7
|
|
14
8
|
# Glimmer provides a JRuby Desktop UI DSL + Data-Binding functionality
|
15
9
|
#
|
@@ -21,16 +15,6 @@ module Glimmer
|
|
21
15
|
#TODO make it configurable to include or not include perhaps reverting to using included
|
22
16
|
REGEX_METHODS_EXCLUDED = /^(to_|\[)/
|
23
17
|
|
24
|
-
class << self
|
25
|
-
def included(klass)
|
26
|
-
if Config.import_swt_packages
|
27
|
-
klass.include(SWT::Packages)
|
28
|
-
klass.extend(SWT::Packages)
|
29
|
-
klass.extend(Glimmer)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
18
|
def method_missing(method_symbol, *args, &block)
|
35
19
|
# This if statement speeds up Glimmer in girb or whenever directly including on main object
|
36
20
|
if method_symbol.to_s.match(REGEX_METHODS_EXCLUDED)
|
@@ -50,9 +34,5 @@ end
|
|
50
34
|
$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
|
51
35
|
|
52
36
|
require 'glimmer/config'
|
53
|
-
require 'glimmer/swt/packages'
|
54
|
-
require 'glimmer/dsl/swt/dsl'
|
55
|
-
require 'glimmer/dsl/xml/dsl'
|
56
|
-
require 'glimmer/dsl/css/dsl'
|
57
37
|
require 'glimmer/error'
|
58
38
|
require 'glimmer/invalid_keyword_error'
|
data/lib/glimmer/config.rb
CHANGED
@@ -1,19 +1,6 @@
|
|
1
1
|
module Glimmer
|
2
2
|
module Config
|
3
3
|
class << self
|
4
|
-
# Tells Glimmer to import SWT packages into including class (default: true)
|
5
|
-
def import_swt_packages=(value)
|
6
|
-
@@import_swt_packages = !!value
|
7
|
-
end
|
8
|
-
|
9
|
-
# Returns whether Glimmer will import SWT packages into including class
|
10
|
-
def import_swt_packages
|
11
|
-
unless defined? @@import_swt_packages
|
12
|
-
@@import_swt_packages = true
|
13
|
-
end
|
14
|
-
@@import_swt_packages
|
15
|
-
end
|
16
|
-
|
17
4
|
# Returns Glimmer logger (standard Ruby logger)
|
18
5
|
def logger
|
19
6
|
# unless defined? @@logger
|
data/lib/glimmer/dsl/engine.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'facets/string/camelcase'
|
2
|
+
|
2
3
|
require 'glimmer/dsl/expression_handler'
|
3
4
|
|
4
5
|
module Glimmer
|
@@ -73,8 +74,9 @@ module Glimmer
|
|
73
74
|
#
|
74
75
|
# They are used in order following the Chain of Responsibility Design
|
75
76
|
# Pattern when interpretting a DSL expression
|
76
|
-
def add_dynamic_expressions(dsl_namespace, expression_names)
|
77
|
-
|
77
|
+
def add_dynamic_expressions(dsl_namespace, *expression_names)
|
78
|
+
expression_names = expression_names.flatten
|
79
|
+
dsl = dsl_namespace.name.split("::").last.downcase.to_sym
|
78
80
|
dynamic_expression_chains_of_responsibility[dsl] = expression_names.reverse.map do |expression_name|
|
79
81
|
expression_class(dsl_namespace, expression_name).new
|
80
82
|
end.reduce(nil) do |last_expresion_handler, expression|
|
@@ -82,7 +84,7 @@ module Glimmer
|
|
82
84
|
expression_handler = ExpressionHandler.new(expression)
|
83
85
|
expression_handler.next = last_expresion_handler if last_expresion_handler
|
84
86
|
expression_handler
|
85
|
-
end
|
87
|
+
end
|
86
88
|
end
|
87
89
|
|
88
90
|
def add_static_expression(static_expression)
|
@@ -91,31 +93,36 @@ module Glimmer
|
|
91
93
|
static_expression_dsl = static_expression.class.dsl
|
92
94
|
static_expressions[keyword] ||= {}
|
93
95
|
static_expressions[keyword][static_expression_dsl] = static_expression
|
94
|
-
Glimmer.define_method
|
96
|
+
Glimmer.send(:define_method, keyword) do |*args, &block|
|
95
97
|
begin
|
96
98
|
retrieved_static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
|
97
99
|
static_expression_dsl = (Glimmer::DSL::Engine.static_expressions[keyword].keys - Glimmer::DSL::Engine.disabled_dsls).first if retrieved_static_expression.nil?
|
100
|
+
interpretation = nil
|
98
101
|
if retrieved_static_expression.nil? && Glimmer::DSL::Engine.dsl && (static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression))
|
99
102
|
begin
|
100
|
-
|
103
|
+
interpretation = Glimmer::DSL::Engine.interpret(keyword, *args, &block)
|
101
104
|
rescue => e
|
102
105
|
Glimmer::DSL::Engine.reset
|
103
106
|
raise e if static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression)
|
104
107
|
end
|
105
108
|
end
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
Glimmer::
|
109
|
+
if interpretation
|
110
|
+
interpretation
|
111
|
+
else
|
112
|
+
raise Glimmer::Error, "Unsupported keyword: #{keyword}" unless static_expression_dsl || retrieved_static_expression
|
113
|
+
Glimmer::DSL::Engine.dsl_stack.push(static_expression_dsl || Glimmer::DSL::Engine.dsl)
|
114
|
+
static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
|
115
|
+
if !static_expression.can_interpret?(Glimmer::DSL::Engine.parent, keyword, *args, &block)
|
116
|
+
raise Error, "Invalid use of Glimmer keyword #{keyword} with args #{args} under parent #{Glimmer::DSL::Engine.parent}"
|
117
|
+
else
|
118
|
+
Glimmer::Config.logger&.debug "#{static_expression.class.name} will handle expression keyword #{keyword}"
|
119
|
+
static_expression.interpret(Glimmer::DSL::Engine.parent, keyword, *args, &block).tap do |ui_object|
|
120
|
+
Glimmer::DSL::Engine.add_content(ui_object, static_expression, &block) unless block.nil?
|
121
|
+
Glimmer::DSL::Engine.dsl_stack.pop
|
122
|
+
end
|
116
123
|
end
|
117
124
|
end
|
118
|
-
rescue => e
|
125
|
+
rescue StandardError => e
|
119
126
|
# Glimmer::DSL::Engine.dsl_stack.pop
|
120
127
|
Glimmer::DSL::Engine.reset
|
121
128
|
raise e
|
@@ -141,7 +148,7 @@ module Glimmer
|
|
141
148
|
add_content(ui_object, expression, &block)
|
142
149
|
dsl_stack.pop
|
143
150
|
end
|
144
|
-
rescue => e
|
151
|
+
rescue StandardError => e
|
145
152
|
# dsl_stack.pop
|
146
153
|
reset
|
147
154
|
raise e
|