glimmer-dsl-jfx 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2a62c4fc8933d22326dd98b858ce4cb05e1bd66b7461abd88b8d4b9d12a7c324
4
+ data.tar.gz: 9839c098e1ac2fdb0e48aca05d244a748ee0d81cec75bc9c0e901fe00fd04270
5
+ SHA512:
6
+ metadata.gz: a15589beeefe4142ebae12d866a7c493e5c493194995897abb9bb224bc92eb85e476f71ecf0d9ae3e6d04cdd2bca7bbdcebf9734c216f0f4954b428b5ff4c831
7
+ data.tar.gz: 114d646eb06878204a92d2b9d51f762cd40b43f7bcfd177ac180f52dba46eaa1bb1061640786a63947ebfe00a85d3c60a4f80af171daf71a5f0825bf3089245b
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Change Log
2
+
3
+ ## 0.0.1
4
+
5
+ - Initial version of Glimmer DSL for JFX
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 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.
data/README.md ADDED
@@ -0,0 +1,433 @@
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 JFX 0.0.1
2
+ ## JRuby JavaFX Desktop Development GUI Library
3
+ [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-jfx.svg)](http://badge.fury.io/rb/glimmer-dsl-jfx)
4
+ [![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)
5
+
6
+ [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [JFX](https://openjfx.io/) enables building desktop applications with [JavaFX](https://openjfx.io/) via [JRuby](https://www.jruby.org/).
7
+
8
+ [JavaFX](https://openjfx.io/) has been Java's next generation technology for a while for desktop application GUI development. Unfortunately, when it divorced itself from its [JavaFX Script](https://en.wikipedia.org/wiki/JavaFX_Script) roots, it became no better than [Java Swing](https://docs.oracle.com/javase/tutorial/uiswing/) in syntax.
9
+
10
+ Furthermore, the whole stage and scene production metaphor made everything more complicated to get into it for software engineers who encountered it for the first time. After all, desktop developers simply think of windows, not stages or scenes. The metaphor unfortunately pushes software engineers into thinking of low-level details (e.g. nodes) that are not important in developing business desktop applications.
11
+
12
+ [FXML](https://openjfx.io/javadoc/17/javafx.fxml/javafx/fxml/doc-files/introduction_to_fxml.html) attempted to rectify the situation by making [JavaFX](https://openjfx.io/) more declarative than its [Swing-like Java syntax](https://docs.oracle.com/javase/tutorial/uiswing/). Unfortunately, XML, like its cousin HTML, brings all the same problems web developers face in day-to-day in suffering through multi-language dissonance to desktop software engineering. That defeats the whole point about desktop software engineering being a lot more productive than web development for simple local apps. [FXML](https://openjfx.io/javadoc/17/javafx.fxml/javafx/fxml/doc-files/introduction_to_fxml.html) was really just a step back into the wrong direction.
13
+
14
+ [Glimmer DSL for JFX](https://rubygems.org/gems/glimmer-dsl-jfx) aims to overcome the hurdles of [JavaFX](https://openjfx.io/) by providing a declarative hierarchical alternative to [FXML](https://openjfx.io/javadoc/17/javafx.fxml/javafx/fxml/doc-files/introduction_to_fxml.html) in pure Ruby as one language (not multi-language mixing dissonance), which supercharges productivity and maintainability in developing [JavaFX](https://openjfx.io/) applications similarly to [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) through:
15
+ - [Declarative DSL syntax](#glimmer-gui-dsl) that visually maps to the GUI control hierarchy while still allowing View logic in the same language
16
+ - Convention over configuration via [smart defaults and automation of low-level details](#smart-defaults-and-conventions)
17
+ - Requiring the least amount of syntax possible to build GUI
18
+ - Custom Keyword support
19
+ - Bidirectional Data-Binding without the complexity of static typing to declaratively wire and automatically synchronize GUI with Business Models
20
+ - Scaffolding for new custom components, apps, and gems
21
+ - Native-Executable packaging on Mac, Windows, and Linux.
22
+
23
+ Hello, World!
24
+
25
+ ![screenshots/glimmer-dsl-jfx-mac-hello-world.png](screenshots/glimmer-dsl-jfx-mac-hello-world.png)
26
+
27
+ ```ruby
28
+ window {
29
+ title 'Hello, World!'
30
+
31
+ label('Hello, World!')
32
+ }
33
+ ```
34
+
35
+ NOTE: Glimmer DSL for JFX is currently in early alpha mode (incomplete proof-of-concept). 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.
36
+
37
+ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interested in:
38
+ - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
39
+ - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
40
+ - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
41
+ - [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
42
+ - [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for Tk (Prerequisite-Free Ruby Desktop Development GUI Library)
43
+ - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
44
+ - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
45
+
46
+ ## Prerequisites
47
+
48
+ - JDK 17 (find at https://www.oracle.com/java/technologies/downloads/#java17)
49
+ - [RVM](http://rvm.io) on Mac & Linux (not available on Windows)
50
+ - JRuby 9.3.1.0 (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.2.19.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download))
51
+ - JavaFX 17 SDK (find at https://gluonhq.com/products/javafx/ choosing the right "SDK" for your platform. Follow environment variable instructions at https://openjfx.io/openjfx-docs/#install-javafx . Specifically, after download, export/set `PATH_TO_FX` environment variable to path of `lib` directory in extracted "SDK" directory)
52
+
53
+ Note: On the Mac, if you have [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) installed, and it added `export JRUBY_OPTS="$JRUBY_OPTS -J-XstartOnFirstThread"` to your `.zprofile`, `.zshrc`, `.bash_profile`, or `.bashrc`, make sure to disable it before using Glimmer DSL for JFX. Unfortunately, it is not compatible with it and will hang its apps until disabled.
54
+
55
+ ## Setup
56
+
57
+ Make sure to download the right JavaFX SDK for your platform and CPU architecture from https://gluonhq.com/products/javafx/ and then set the PATH_TO_FX environment variable to the location of the lib directory in the extracted SDK directory.
58
+
59
+ ### Option 1: Install
60
+
61
+ Run this command to install directly:
62
+ ```
63
+ gem install glimmer-dsl-jfx -v0.0.1
64
+ ```
65
+
66
+ ### Option 2: Bundler
67
+
68
+ Add the following to `Gemfile`:
69
+ ```
70
+ gem 'glimmer-dsl-jfx', '0.0.1'
71
+ ```
72
+
73
+ And, then run:
74
+ ```
75
+ bundle
76
+ ```
77
+
78
+ ## Usage
79
+
80
+ Require the library and mixin the `Glimmer` module to utilize the [Glimmer GUI DSL](#glimmer-gui-dsl) for JFX:
81
+
82
+ ```ruby
83
+ require 'glimmer-dsl-jfx'
84
+
85
+ include Glimmer
86
+
87
+ window {
88
+ title 'Hello, World!'
89
+
90
+ label('Hello, World!')
91
+ }
92
+ ```
93
+
94
+ For actual application development outside of simple demos, mixin the `Glimmer` module into a custom application class instead:
95
+
96
+ ```ruby
97
+ require 'glimmer-dsl-jfx'
98
+
99
+ class SomeApplication
100
+ include Glimmer
101
+
102
+ def launch
103
+ window {
104
+ title 'Hello, World!'
105
+
106
+ label('Hello, World!')
107
+ }
108
+ end
109
+ end
110
+
111
+ SomeApplication.new.launch
112
+ ```
113
+
114
+ ## Glimmer GUI DSL
115
+
116
+ The Glimmer GUI DSL enables development of desktop graphical user interfaces in a manner similar to HTML, but in one language, Ruby, thus avoiding the multi-language separation dissonance encountered on the web, especially given that Ruby looping/conditional constructs do not need scriptlets to be added around View code. This makes desktop development extremely productive.
117
+
118
+ 1 - Keywords
119
+
120
+ Always start with `window`, which simplifies/replaces both the `Stage` and `Scene` concepts, having both their properties. Additionally, `window` removes the need to extend `Application` as it does so automatically internally.
121
+
122
+ Inside `window`, you may declare any [JavaFX](https://openjfx.io/) control with its keyword, which is the underscored version of the class name. For example, `label` is the keyword for `javafx.scene.control.Label`
123
+
124
+ Examples:
125
+
126
+ ```ruby
127
+ v_box
128
+ label
129
+ button
130
+ ```
131
+
132
+ 2 - Arguments
133
+
134
+ You may pass any arguments that a [JavaFX](https://openjfx.io/) control constructor accepts to its Glimmer keyword.
135
+
136
+ Example (`Label` and `Button` have a constructor signature that accepts a string representing the text property):
137
+
138
+ ```ruby
139
+ label('Full Name')
140
+ button('Submit Form')
141
+ ```
142
+
143
+ The recommended style is to always wrap arguments with parentheses for control keywords.
144
+
145
+ 3 - Content Block
146
+
147
+ You may pass a content block to any [JavaFX](https://openjfx.io/) control keyword, which contains properties and/or nested controls.
148
+
149
+ Example:
150
+
151
+ ```ruby
152
+ window {
153
+ title 'Hello, Window!'
154
+ width 320
155
+ height 240
156
+
157
+ v_box {
158
+ label('Hello, Label!')
159
+ button('Hello, Button!')
160
+ }
161
+ }
162
+ ```
163
+
164
+ The recommended style for the content block is always curly braces `{}` to denote as View nesting code different from looping/conditional logic, which utilizes `do;end` instead.
165
+
166
+ Property arguments never have parentheses.
167
+
168
+ 4 - Listeners
169
+
170
+ You may declare listeners with their `on_`-prefixed event method name as found in the [JavaFX Javadoc](https://www.javadoc.io/doc/org.openjfx/javafx-base/17.0.1/index.html). For example: `on_action`, `on_key_pressed`, `on_key_released`, `on_key_typed`, `on_mouse_clicked`, and `on_mouse_moved`.
171
+
172
+ For example, `Button` has an `onAction` method. In Glimmer, you simply underscore that:
173
+
174
+ ```ruby
175
+ window {
176
+ title 'Hello, Button!'
177
+
178
+ button('Click') { |b|
179
+ on_action do
180
+ b.text = 'Clicked'
181
+ end
182
+ }
183
+ }
184
+ ```
185
+
186
+ The recommended style for listeners is always a `do; end` block.
187
+
188
+ 5 - Component Proxy & Methods
189
+
190
+ When utilizing the Glimmer GUI DSL, you get back proxy objects that wrap [JavaFX Javadoc](https://www.javadoc.io/doc/org.openjfx/javafx-base/17.0.1/index.html) controls. To access the original control wrapped by the proxy object, you may call the `#jfx` method.
191
+
192
+ Furthermore, you may invoke any method available on the control indirectly on the proxy object, like the `#text` method on `label`.
193
+
194
+ ```ruby
195
+ label1 = label('Full Name')
196
+ label1.text # same as label1.jfx.text
197
+ ```
198
+
199
+ 6 - Observe Model Attributes
200
+
201
+ In Smalltalk-MVC ([Model View Controller](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) Architectural Pattern), the View is an active View that observes the Model for changes and updates itself.
202
+
203
+ ![MVC](http://3.bp.blogspot.com/-4eW59Ao0ess/ToiBzAiYdZI/AAAAAAAAAOg/SiYa6XHwBFE/s320/Screen+shot+2011-10-02+at+10.22.11+AM.png)
204
+
205
+ This can be achieved with the Glimmer GUI DSL using the `observe` keyword, which takes a model (any object, including `self`) and attribute Symbol or String expression (e.g. `:count` or `'address.street'`).
206
+
207
+ The model is automatically enhanced as an `Glimmer::DataBinding::ObservableModel` / `Glimmer::DataBinding::ObservableHash` / `Glimmer::DataBinding::ObservableArray` depending on its type to support notifying observers of attribute changes (when performed using the attribute writer, which automatically calls added method `notify_observers(attribute)`)
208
+
209
+ Note that it is usually recommended to observe external model objects (not `self`), but `self` is OK in very simple cases or presentation-related attributes only.
210
+
211
+ Example:
212
+
213
+ ```ruby
214
+ require 'glimmer-dsl-jfx'
215
+
216
+ class Counter
217
+ attr_accessor :count
218
+
219
+ def initialize
220
+ self.count = 0
221
+ end
222
+ end
223
+
224
+ class HelloButton
225
+ include Glimmer
226
+
227
+ def initialize
228
+ @counter = Counter.new
229
+
230
+ observe(@counter, :count) do |new_count|
231
+ @button.text = "Click To Increment: #{new_count}"
232
+ end
233
+ end
234
+
235
+ def launch
236
+ window {
237
+ title 'Hello, Button!'
238
+
239
+ @button = button('Click To Increment: 0') {
240
+ on_action do
241
+ @counter.count += 1
242
+ end
243
+ }
244
+ }
245
+ end
246
+ end
247
+
248
+ HelloButton.new.launch
249
+ ```
250
+
251
+ ![screenshots/glimmer-dsl-jfx-mac-hello-button.png](screenshots/glimmer-dsl-jfx-mac-hello-button.png)
252
+
253
+ ## Smart Defaults and Conventions
254
+
255
+ - `window` automatically builds an `Application` object, sets `Stage` properties and sets a `Scene` in primary stage.
256
+
257
+ ## Girb (Glimmer IRB)
258
+
259
+ You can run the `girb` command (`bin/girb` if you cloned the project locally):
260
+
261
+ ```
262
+ girb
263
+ ```
264
+
265
+ This gives you `irb` with the `glimmer-dsl-jfx` gem loaded and the `Glimmer` module mixed into the main object for easy experimentation with GUI.
266
+
267
+ ## Samples
268
+
269
+ ### Hello Samples
270
+
271
+ #### Hello, World!
272
+
273
+ Run with gem installed:
274
+
275
+ ```
276
+ jruby -r glimmer-dsl-jfx -e "require 'samples/hello/hello_world'"
277
+ ```
278
+
279
+ Or run from locally cloned project directory:
280
+
281
+ ```
282
+ jruby -r ./lib/glimmer-dsl-jfx samples/hello/hello_world.rb
283
+ ```
284
+
285
+ ![screenshots/glimmer-dsl-jfx-mac-hello-world.png](screenshots/glimmer-dsl-jfx-mac-hello-world.png)
286
+
287
+ [samples/hello/hello_world.rb](samples/hello/hello_world.rb):
288
+
289
+ ```ruby
290
+ require 'glimmer-dsl-jfx'
291
+
292
+ include Glimmer
293
+
294
+ window {
295
+ title 'Hello, World!'
296
+
297
+ label('Hello, World!')
298
+ }
299
+ ```
300
+
301
+ #### Hello, Button!
302
+
303
+ Run with gem installed:
304
+
305
+ ```
306
+ jruby -r glimmer-dsl-jfx -e "require 'samples/hello/hello_button'"
307
+ ```
308
+
309
+ Or run from locally cloned project directory:
310
+
311
+ ```
312
+ jruby -r ./lib/glimmer-dsl-jfx samples/hello/hello_button.rb
313
+ ```
314
+
315
+ ![screenshots/glimmer-dsl-jfx-mac-hello-button.png](screenshots/glimmer-dsl-jfx-mac-hello-button.png)
316
+
317
+ Version 1 (without model) - [samples/hello/hello_button.rb](samples/hello/hello_button.rb):
318
+
319
+ ```ruby
320
+ require 'glimmer-dsl-jfx'
321
+
322
+ include Glimmer
323
+
324
+ window {
325
+ title 'Hello, Button!'
326
+
327
+ @button = button('Click To Increment: 0') {
328
+ on_action do
329
+ button_text_match = @button.text.match(/([^0-9]+)(\d+)$/)
330
+ count = button_text_match[2].to_i + 1
331
+ @button.text = "#{button_text_match[1]}#{count}"
332
+ end
333
+ }
334
+ }
335
+ ```
336
+
337
+ Version 2 (with model) - [samples/hello/hello_button2.rb](samples/hello/hello_button2.rb):
338
+
339
+ ```ruby
340
+ require 'glimmer-dsl-jfx'
341
+
342
+ class Counter
343
+ attr_accessor :count
344
+
345
+ def initialize
346
+ self.count = 0
347
+ end
348
+ end
349
+
350
+ class HelloButton
351
+ include Glimmer
352
+
353
+ def initialize
354
+ @counter = Counter.new
355
+ end
356
+
357
+ def launch
358
+ window {
359
+ title 'Hello, Button!'
360
+
361
+ @button = button('Click To Increment: 0') {
362
+ on_action do
363
+ @counter.count += 1
364
+ @button.text = "Click To Increment: #{new_count}"
365
+ end
366
+ }
367
+ }
368
+ end
369
+ end
370
+
371
+ HelloButton.new.launch
372
+ ```
373
+
374
+ ## Resources
375
+
376
+ - OpenJFX Website: https://openjfx.io/
377
+ - Oracle JavaFX Javadoc: https://www.javadoc.io/doc/org.openjfx/javafx-base/17.0.1/index.html
378
+
379
+ ## Process
380
+
381
+ [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
382
+
383
+ ## Help
384
+
385
+ ### Issues
386
+
387
+ If you encounter [issues](https://github.com/AndyObtiva/glimmer-dsl-jfx/issues) that are not reported, discover missing features that are not mentioned in [TODO.md](TODO.md), or think up better ways to use [JavaFX](https://openjfx.io/) than what is possible with [Glimmer DSL for JFX](https://rubygems.org/gems/glimmer-dsl-jfx), you may submit an [issue](https://github.com/AndyObtiva/glimmer-dsl-jfx/issues/new) or [pull request](https://github.com/AndyObtiva/glimmer-dsl-jfx/compare) on [GitHub](https://github.com). In the meantime while waiting for a fix, you may try older gem versions of [Glimmer DSL for JFX](https://rubygems.org/gems/glimmer-dsl-jfx) in case you find one that does not have the issue and actually works.
388
+
389
+ ### Chat
390
+
391
+ If you need live help, try to [![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)
392
+
393
+ ## Planned Features and Feature Suggestions
394
+
395
+ These features have been planned or suggested. You might see them in a future version of [Glimmer DSL for JFX](https://rubygems.org/gems/glimmer-dsl-jfx). You are welcome to contribute more feature suggestions.
396
+
397
+ [TODO.md](TODO.md)
398
+
399
+ ## Change Log
400
+
401
+ [CHANGELOG.md](CHANGELOG.md)
402
+
403
+ ## Contributing
404
+
405
+ - Check out the latest master to make sure the feature hasn't been
406
+ implemented or the bug hasn't been fixed yet.
407
+ - Check out the issue tracker to make sure someone already hasn't
408
+ requested it and/or contributed it.
409
+ - Fork the project.
410
+ - Start a feature/bugfix branch.
411
+ - Commit and push until you are happy with your contribution.
412
+ - Make sure to add tests for it. This is important so I don't break it
413
+ in a future version unintentionally.
414
+ - Please try not to mess with the Rakefile, version, or history. If
415
+ you want to have your own version, or is otherwise necessary, that
416
+ is fine, but please isolate to its own commit so I can cherry-pick
417
+ around it.
418
+
419
+ ## Contributors
420
+
421
+ * [Andy Maleh](https://github.com/AndyObtiva) (Founder)
422
+
423
+ [Click here to view contributor commits.](https://github.com/AndyObtiva/glimmer-dsl-jfx/graphs/contributors)
424
+
425
+ ## Copyright
426
+
427
+ [MIT](LICENSE.txt)
428
+
429
+ Copyright (c) 2021 Andy Maleh.
430
+
431
+ --
432
+
433
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (DSL Framework).
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/girb ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ # Copyright (c) 2007-2021 Andy Maleh
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ # This script was written for Windows and Linux only
25
+
26
+ ENV['JRUBY_OPTS'] = ARGV.select {|arg| arg.start_with?('-')}.join(' ')
27
+
28
+ require_relative 'girb_runner'
29
+
30
+ require 'irb'
31
+
32
+ IRB.start('.')
@@ -0,0 +1,29 @@
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 'puts_debuggerer'
23
+ require_relative '../lib/glimmer-dsl-jfx'
24
+
25
+ trap "SIGINT" do
26
+ # No Op for irb
27
+ end
28
+
29
+ include Glimmer
Binary file
@@ -0,0 +1,48 @@
1
+ # Copyright (c) 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/expression'
23
+ require 'glimmer/dsl/parent_expression'
24
+
25
+ module Glimmer
26
+ module DSL
27
+ module JFX
28
+ class ControlExpression < Expression
29
+ include ParentExpression
30
+
31
+ def can_interpret?(parent, keyword, *args, &block)
32
+ Glimmer::JFX::ControlProxy.exist?(keyword)
33
+ end
34
+
35
+ def interpret(parent, keyword, *args, &block)
36
+ Glimmer::JFX::ControlProxy.create(parent, keyword, *args, &block)
37
+ end
38
+
39
+ def add_content(parent, keyword, *args, &block)
40
+ super
41
+ parent.post_add_content
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ require 'glimmer/jfx/control_proxy'
@@ -0,0 +1,47 @@
1
+ # Copyright (c) 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/engine'
23
+ Dir[File.expand_path('*_expression.rb', __dir__)].each {|f| require f}
24
+
25
+ # Glimmer DSL expression configuration module
26
+ #
27
+ # When DSL engine interprets an expression, it attempts to handle
28
+ # with expressions listed here in the order specified.
29
+
30
+ # Every expression has a corresponding Expression subclass
31
+ # in glimmer/dsl
32
+
33
+ module Glimmer
34
+ module DSL
35
+ module JFX
36
+ Engine.add_dynamic_expressions(
37
+ JFX,
38
+ %w[
39
+ listener
40
+ property
41
+ operation
42
+ control
43
+ ]
44
+ )
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,50 @@
1
+ # Copyright (c) 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/expression'
23
+
24
+ module Glimmer
25
+ module DSL
26
+ module JFX
27
+ class ListenerExpression < Expression
28
+ def can_interpret?(parent, keyword, *args, &block)
29
+ Glimmer::Config.logger.debug {"keyword starts with on_: #{keyword.start_with?('on_')}"}
30
+ return false unless keyword.start_with?('on_')
31
+ proper_parent = parent.respond_to?(:jfx)
32
+ Glimmer::Config.logger.debug {"parent #{parent} is a control: #{proper_parent}"}
33
+ return false unless proper_parent
34
+ Glimmer::Config.logger.debug {"block exists?: #{!block.nil?}"}
35
+ raise Glimmer::Error, "Listener is missing block for keyword: #{keyword}" unless block_given?
36
+ Glimmer::Config.logger.debug {"args are empty?: #{args.empty?}"}
37
+ raise Glimmer::Error, "Invalid listener arguments for keyword: #{keyword}(#{args})" unless args.empty?
38
+ result = parent.respond_to?("set_#{keyword}")
39
+ Glimmer::Config.logger.debug {"can add listener? #{result}"}
40
+ raise Glimmer::Error, "Invalid listener keyword: #{keyword}" unless result
41
+ true
42
+ end
43
+
44
+ def interpret(parent, keyword, *args, &block)
45
+ parent.send("set_#{keyword}", &block)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end