glimmer-cw-cdatetime-nebula 1.4.0.0 → 1.5.0.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 +38 -0
- data/README.md +415 -40
- data/VERSION +1 -1
- data/lib/glimmer-cw-cdatetime-nebula.rb +27 -3
- data/lib/glimmer-cw-cdatetime-nebula/ext/glimmer/dsl/swt/cdt_expression.rb +23 -0
- data/lib/glimmer-cw-cdatetime-nebula/ext/glimmer/swt/c_date_time_proxy.rb +95 -0
- data/lib/glimmer-cw-cdatetime-nebula/ext/glimmer/swt/cdt_proxy.rb +55 -0
- data/lib/views/nebula/c_date_time.rb +35 -27
- data/samples/nebula/c_date_time_gallery.rb +157 -0
- data/vendor/nebula/{org.eclipse.nebula.cwt_1.1.0.jar → org.eclipse.nebula.cwt_1.1.0.202007241204.jar} +0 -0
- data/vendor/nebula/org.eclipse.nebula.widgets.cdatetime_1.5.0.202007241204.jar +0 -0
- metadata +14 -23
- data/vendor/nebula/org.eclipse.nebula.widgets.cdatetime_1.4.0.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: 5fc132947dec8807b1e6b696d8bba7083f4a46737b60ced7bbcc730970a4ecd5
|
4
|
+
data.tar.gz: 80fe4c8c8a09b4f3795d372c69782b2a18a415db379e7c0471f9e01b2a6f80ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51ce682671d7da3e12ecba70bcec028c3037ba8c27f7bb04cad1d24d29867238d7a6211113ed728386c8f05c18fc6aaef44166f9e07d15a2ba3fde08f4e95660
|
7
|
+
data.tar.gz: 3c9317123a4d7bc91efe11597f27fea2ac8868ea8fc202e866cf1e2d2f77157926a45dd31839a4d2e8a0432953c7ab08cb9579fb33989a27aa8a39b0958dce98
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 1.5.0.0.1
|
4
|
+
|
5
|
+
- Just corrected gem documentation to avoid mentioning older Nebula CDateTime 1.4.0
|
6
|
+
|
7
|
+
## 1.5.0.0.0
|
8
|
+
|
9
|
+
- Upgrade to Nebula CDateTime 1.5.0
|
10
|
+
- Upgrade to Glimmer DSL for SWT 4.17.0.0
|
11
|
+
|
12
|
+
## 1.4.0.2.1
|
13
|
+
|
14
|
+
- Make sure `#text_widget_content` returns nil with plain style
|
15
|
+
- Support c_date_time keyword aliases as a table editor
|
16
|
+
- Fix issue with overwriting specified styles with default styles
|
17
|
+
|
18
|
+
## 1.4.0.2.0
|
19
|
+
|
20
|
+
- Actual CDateTimeProxy class that is a subclass of WidgetProxy
|
21
|
+
- Smart defaults
|
22
|
+
` `cdt` keyword for easily building `CDT` styles
|
23
|
+
- `c_date`, `c_time` aliases for date only and time only
|
24
|
+
- `c_date_time_drop_down`, `c_date_drop_down`, `c_time_drop_down` for drop down configured widgets
|
25
|
+
- `c_date_time_spinner`, `c_date_spinner`, `c_time_spinner` for spinner configured widgets
|
26
|
+
- `c_date_time_compact`, `c_date_compact`, `c_time_compact` for compact style configured widgets
|
27
|
+
- `text_widget_proxy` method to retrieve a Glimmer widget proxy for the inner text widget of CDateTime, thus enabling direct adding of observers and data-binding
|
28
|
+
- `toggle_open` method to programmatically toggle between open and closed (works better and is more convenient than `.swt_widget.set_open` in some situations)
|
29
|
+
- Nebula CDateTime Glimmer Custom Widget Gallery [sample](samples/nebula/c_date_time_gallery.rb)
|
30
|
+
|
31
|
+
## 1.4.0.1
|
32
|
+
|
33
|
+
- Prevent table editor from saving upon traversing months in drop down Calendar
|
34
|
+
|
35
|
+
## 1.4.0.0
|
36
|
+
|
37
|
+
- Initial version containing a Glimmer configured and wrapped CDateTime Nebula custom widget
|
38
|
+
- Support use as editor of Glimmer table items.
|
data/README.md
CHANGED
@@ -1,37 +1,73 @@
|
|
1
|
-
# Nebula CDateTime Widget 1.
|
2
|
-
## [Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer#custom-widget-gem)
|
1
|
+
# Nebula CDateTime Widget 1.5.0.0.0
|
2
|
+
## [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-swt/master/images/glimmer-logo-hi-res.png" height=40 /> Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-widget-gem)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-cw-cdatetime-nebula.svg)](http://badge.fury.io/rb/glimmer-cw-cdatetime-nebula)
|
4
4
|
|
5
5
|
[<img alt="Nebula CDateTime Widget" src="https://www.eclipse.org/nebula/widgets/cdatetime/images/CDTSnippet02.png" />](https://www.eclipse.org/nebula/widgets/cdatetime/cdatetime.php)
|
6
6
|
|
7
|
-
The [Nebula CDateTime Widget](https://www.eclipse.org/nebula/widgets/cdatetime/cdatetime.php) is a Date and Time selection widget that can be used in a
|
8
|
-
|
9
|
-
Packaged as a [Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer#custom-widget-gem) to provide date/time selection via a combo/dropdown-style widget in [Glimmer](https://github.com/AndyObtiva/glimmer) using the `c_date_time` [Glimmer DSL](https://github.com/AndyObtiva/glimmer#glimmer-dsl-syntax) keyword.
|
10
|
-
|
11
|
-
[glimmer-cw-cdatetime-nebula](https://rubygems.org/gems/glimmer-cw-cdatetime-nebula) 1.
|
12
|
-
|
13
|
-
##
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
|
7
|
+
The [Nebula CDateTime Widget](https://www.eclipse.org/nebula/widgets/cdatetime/cdatetime.php) is a Date and Time selection widget that can be used in a simple, dropdown, spinner, or compact style.
|
8
|
+
|
9
|
+
Packaged as a [Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-widget-gem) to provide date/time selection via a combo/dropdown-style widget in [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) using the `c_date_time` [Glimmer DSL](https://github.com/AndyObtiva/glimmer-dsl-swt#glimmer-gui-dsl-syntax) keyword.
|
10
|
+
|
11
|
+
[glimmer-cw-cdatetime-nebula](https://rubygems.org/gems/glimmer-cw-cdatetime-nebula) 1.5.0.x.y gem versions map to Nebula CDateTime Widget version 1.5.0 (which comes with [Nebula 2.4.2](https://www.eclipse.org/nebula/releases/2.4.2/index.php))
|
12
|
+
|
13
|
+
## Table of contents
|
14
|
+
|
15
|
+
# Table of contents
|
16
|
+
|
17
|
+
- [Nebula CDateTime Widget 1.5.0.0.0](#nebula-cdatetime-widget-15000)
|
18
|
+
- [Pre-requisites](#pre-requisites)
|
19
|
+
- [Setup](#setup)
|
20
|
+
- [Glimmer Application](#glimmer-application)
|
21
|
+
- [Glimmer Custom Shell or Glimmer Custom Widget](#glimmer-custom-shell-or-glimmer-custom-widget)
|
22
|
+
- [Java Imports](#java-imports)
|
23
|
+
- [Instructions](#instructions)
|
24
|
+
- [Sample](#sample)
|
25
|
+
- [Simple Style](#simple-style)
|
26
|
+
- [`c_date_time`](#cdatetime)
|
27
|
+
- [`c_date`](#cdate)
|
28
|
+
- [`c_time`](#ctime)
|
29
|
+
- [Drop Down Style](#drop-down-style)
|
30
|
+
- [`c_date_time_drop_down`](#cdatetimedropdown)
|
31
|
+
- [`c_date_drop_down`](#cdatedropdown)
|
32
|
+
- [`c_time_drop_down`](#ctimedropdown)
|
33
|
+
- [Spinner Style](#spinner-style)
|
34
|
+
- [`c_date_time_spinner`](#cdatetimespinner)
|
35
|
+
- [`c_date_spinner`](#cdatespinner)
|
36
|
+
- [`c_time_spinner`](#ctimespinner)
|
37
|
+
- [Compact Style](#compact-style)
|
38
|
+
- [`c_date_time_compact`](#cdatetimecompact)
|
39
|
+
- [`c_date_compact`](#cdatecompact)
|
40
|
+
- [`c_time_compact`](#ctimecompact)
|
41
|
+
- [`CDT` Style Arguments](#cdt-style-arguments)
|
42
|
+
- [Data-Binding and Observers:](#data-binding-and-observers)
|
43
|
+
- [Table Editor](#table-editor)
|
44
|
+
- [API](#api)
|
45
|
+
- [Glimmer Custom API](#glimmer-custom-api)
|
46
|
+
- [`toggle_open`](#toggleopen)
|
47
|
+
- [`text_widget_proxy`](#textwidgetproxy)
|
48
|
+
- [TODO](#todo)
|
49
|
+
- [Change Log](#change-log)
|
50
|
+
- [Contributing to glimmer-cw-cdatetime-nebula](#contributing-to-glimmer-cw-cdatetime-nebula)
|
51
|
+
- [Copyright](#copyright)
|
20
52
|
|
21
53
|
## Pre-requisites
|
22
54
|
|
23
|
-
- [Glimmer](https://github.com/AndyObtiva/glimmer) application, [Glimmer](https://github.com/AndyObtiva/glimmer) custom shell, or another [Glimmer](https://github.com/AndyObtiva/glimmer) custom widget
|
24
|
-
- JRuby version required by Glimmer
|
25
|
-
- Java version required by Glimmer
|
55
|
+
- [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt) application, [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt) custom shell, or another [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt) custom widget
|
56
|
+
- JRuby version required by [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)
|
57
|
+
- Java version required by [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)
|
26
58
|
|
27
59
|
## Setup
|
28
60
|
|
61
|
+
Versions follow this convention:
|
62
|
+
- First 3 digits map to the official Nebula CDateTime library version (e.g. 1.5.0)
|
63
|
+
- Last 2 digits map to minor and patch versions for Glimmer Custom Widget wrapper
|
64
|
+
|
29
65
|
### Glimmer Application
|
30
66
|
|
31
|
-
Add the following to a [Glimmer](https://github.com/AndyObtiva/glimmer) application `Gemfile`:
|
67
|
+
Add the following to a [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt) application `Gemfile`:
|
32
68
|
|
33
69
|
```ruby
|
34
|
-
gem 'glimmer-cw-cdatetime-nebula', '1.
|
70
|
+
gem 'glimmer-cw-cdatetime-nebula', '1.5.0.0.0'
|
35
71
|
```
|
36
72
|
|
37
73
|
Run:
|
@@ -40,41 +76,325 @@ Run:
|
|
40
76
|
jruby -S bundle
|
41
77
|
```
|
42
78
|
|
43
|
-
(or just `bundle` if using RVM)
|
79
|
+
(or just `bundle` if using [RVM)
|
44
80
|
|
45
81
|
### Glimmer Custom Shell or Glimmer Custom Widget
|
46
82
|
|
47
|
-
When reusing in a [Glimmer](https://github.com/AndyObtiva/glimmer) custom shell or custom widget, you can follow the same steps for Glimmer application, and then add a require statement to your library file after `glimmer` and before additional library require statements:
|
83
|
+
When reusing in a [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt) custom shell or custom widget, you can follow the same steps for Glimmer application, and then add a require statement to your library file after `glimmer-dsl-swt` and before additional library require statements:
|
48
84
|
|
49
85
|
```ruby
|
50
|
-
require 'glimmer'
|
86
|
+
require 'glimmer-dsl-swt'
|
51
87
|
require 'glimmer-cw-cdatetime-nebula'
|
52
88
|
# ... more require statements follow
|
53
89
|
```
|
54
90
|
|
91
|
+
### Java Imports
|
92
|
+
|
93
|
+
Requiring the gem automatically configures java imports in [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt) for auto import via [JRuby](https://www.jruby.org/) `include_package` on first use:
|
94
|
+
- `org.eclipse.nebula.cwt`
|
95
|
+
- `org.eclipse.nebula.widgets.cdatetime`
|
96
|
+
|
55
97
|
## Instructions
|
56
98
|
|
57
|
-
`c_date_time`
|
99
|
+
This [glimmer-cw-cdatetime-nebula](https://rubygems.org/gems/glimmer-cw-cdatetime-nebula) gem adds the `c_date_time` keyword to the [Glimmer GUI DSL](https://github.com/AndyObtiva/glimmer-dsl-swt#glimmer-gui-dsl-syntax) as well as other alias keywords (e.g. drop down style, spinner style, and compact style) as explained below.
|
58
100
|
|
59
|
-
|
101
|
+
The `c_date_time` keyword optionally takes [`CDT`](#cdt) style bits as arguments. When not specified, [smart defaults](https://github.com/AndyObtiva/glimmer-cw-cdatetime-nebula#cdt-style-arguments) are used instead.
|
60
102
|
|
61
|
-
|
103
|
+
Example:
|
62
104
|
|
63
|
-
|
105
|
+
```ruby
|
106
|
+
c_date_time(:border, :compact, :drop_down, :date_long)
|
107
|
+
```
|
108
|
+
|
109
|
+
Further instructions may be found at the [Nebula CDateTime Widget homepage](https://www.eclipse.org/nebula/widgets/cdatetime/cdatetime.php).
|
110
|
+
|
111
|
+
### Sample
|
112
|
+
|
113
|
+
Please run the following command to launch the [Nebula CDateTime Glimmer Custom Widget Gallery](samples/nebula/c_date_time_gallery.rb) app:
|
114
|
+
|
115
|
+
```
|
116
|
+
glimmer sample:run[c_date_time_gallery]
|
117
|
+
```
|
118
|
+
|
119
|
+
Glimmer Code:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
require_relative '../../lib/glimmer-cw-cdatetime-nebula'
|
123
|
+
|
124
|
+
class CDateTimeGallery
|
125
|
+
include Glimmer
|
126
|
+
|
127
|
+
def open
|
128
|
+
shell {
|
129
|
+
grid_layout(4, false) {
|
130
|
+
vertical_spacing 20
|
131
|
+
}
|
132
|
+
text 'Nebula CDateTime Glimmer Custom Widget Gallery'
|
133
|
+
|
134
|
+
label {
|
135
|
+
layout_data(:center, :center, true, false) {
|
136
|
+
horizontal_span 4
|
137
|
+
}
|
138
|
+
text 'Nebula CDateTime Glimmer Custom Widget Gallery'
|
139
|
+
font height: 24, style: :bold
|
140
|
+
}
|
141
|
+
|
142
|
+
tab_folder {
|
143
|
+
tab_item {
|
144
|
+
grid_layout 2, false
|
145
|
+
text 'Simple'
|
146
|
+
|
147
|
+
label {
|
148
|
+
text 'c_date_time'
|
149
|
+
font name: 'Consolas', height: 14
|
150
|
+
}
|
151
|
+
c_date_time
|
152
|
+
|
153
|
+
label {
|
154
|
+
text 'c_date'
|
155
|
+
font name: 'Consolas', height: 14
|
156
|
+
}
|
157
|
+
c_date
|
158
|
+
|
159
|
+
label {
|
160
|
+
text 'c_time'
|
161
|
+
font name: 'Consolas', height: 14
|
162
|
+
}
|
163
|
+
c_time
|
164
|
+
}
|
165
|
+
|
166
|
+
tab_item {
|
167
|
+
grid_layout 2, false
|
168
|
+
text 'Drop Down'
|
169
|
+
|
170
|
+
label {
|
171
|
+
text 'c_date_time_drop_down'
|
172
|
+
font name: 'Consolas', height: 14
|
173
|
+
}
|
174
|
+
c_date_time_drop_down {
|
175
|
+
layout_data(:fill, :center, true, true)
|
176
|
+
}
|
177
|
+
|
178
|
+
label {
|
179
|
+
text 'c_date_drop_down'
|
180
|
+
font name: 'Consolas', height: 14
|
181
|
+
}
|
182
|
+
c_date_drop_down {
|
183
|
+
layout_data(:fill, :center, true, true)
|
184
|
+
}
|
185
|
+
|
186
|
+
label {
|
187
|
+
text 'c_time_drop_down'
|
188
|
+
font name: 'Consolas', height: 14
|
189
|
+
}
|
190
|
+
c_time_drop_down {
|
191
|
+
layout_data(:fill, :center, true, true)
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
tab_item {
|
196
|
+
grid_layout 2, false
|
197
|
+
text 'Spinner'
|
198
|
+
|
199
|
+
label {
|
200
|
+
text 'c_date_time_spinner'
|
201
|
+
font name: 'Consolas', height: 14
|
202
|
+
}
|
203
|
+
c_date_time_spinner {
|
204
|
+
layout_data(:fill, :center, true, true)
|
205
|
+
}
|
206
|
+
|
207
|
+
label {
|
208
|
+
text 'c_date_spinner'
|
209
|
+
font name: 'Consolas', height: 14
|
210
|
+
}
|
211
|
+
c_date_spinner {
|
212
|
+
layout_data(:fill, :center, true, true)
|
213
|
+
}
|
214
|
+
|
215
|
+
label {
|
216
|
+
text 'c_time_spinner'
|
217
|
+
font name: 'Consolas', height: 14
|
218
|
+
}
|
219
|
+
c_time_spinner {
|
220
|
+
layout_data(:fill, :center, true, true)
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
tab_item {
|
225
|
+
grid_layout 2, false
|
226
|
+
text 'Compact'
|
227
|
+
|
228
|
+
label {
|
229
|
+
text 'c_date_time_compact'
|
230
|
+
font name: 'Consolas', height: 14
|
231
|
+
}
|
232
|
+
c_date_time_compact {
|
233
|
+
layout_data(:fill, :center, true, true)
|
234
|
+
}
|
235
|
+
|
236
|
+
label {
|
237
|
+
text 'c_date_compact'
|
238
|
+
font name: 'Consolas', height: 14
|
239
|
+
}
|
240
|
+
c_date_compact {
|
241
|
+
layout_data(:fill, :center, true, true)
|
242
|
+
}
|
243
|
+
|
244
|
+
label {
|
245
|
+
text 'c_time_compact'
|
246
|
+
font name: 'Consolas', height: 14
|
247
|
+
}
|
248
|
+
c_time_compact {
|
249
|
+
layout_data(:fill, :center, true, true)
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
}.open
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
CDateTimeGallery.new.open
|
258
|
+
```
|
259
|
+
|
260
|
+
### Simple Style
|
261
|
+
|
262
|
+
Simple style is the default style when using `c_date_time`, `c_date`, and `c_time` keywords. It displays a graphical calendar/clock.
|
263
|
+
|
264
|
+
`CDT::SIMPLE` style is applied by default but may be overriden by manually passing arguments to the keywords.
|
265
|
+
|
266
|
+
![simple screenshot](images/glimmer-cw-cdatetime-nebula-simple.png)
|
267
|
+
|
268
|
+
#### `c_date_time`
|
269
|
+
|
270
|
+
Main keyword representing the Nebula CDateTime custom widget. Defaults to date/time [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'MM/dd/yyyy hh:mm a'` and simple style with a border
|
271
|
+
|
272
|
+
#### `c_date`
|
273
|
+
|
274
|
+
Alias keyword that specifies date [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'MM/dd/yyyy'` and simple style with a border
|
275
|
+
|
276
|
+
#### `c_time`
|
277
|
+
|
278
|
+
Alias keyword that specifies time [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'hh:mm a'` and simple style with a border
|
279
|
+
|
280
|
+
### Drop Down Style
|
281
|
+
|
282
|
+
Drop down style is used with the `c_date_time_drop_down`, `c_date_drop_down`, and `c_time_drop_down` keywords to provide a text box for textual entry of date/time coupled with a drop down button for bringing up the calendar/clock to perform graphical selection.
|
283
|
+
|
284
|
+
`CDT::DROP_DOWN` style is applied by default but may be overriden by manually passing arguments to the keywords.
|
285
|
+
|
286
|
+
![dropdown screenshot](images/glimmer-cw-cdatetime-nebula-drop-down.png)
|
287
|
+
|
288
|
+
#### `c_date_time_drop_down`
|
289
|
+
|
290
|
+
Alias keyword that specifies date/time [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'MM/dd/yyyy hh:mm a'` and drop down style with a border
|
291
|
+
|
292
|
+
![date time dropdown screenshot](images/glimmer-cw-cdatetime-nebula-drop-down-date-time.png)
|
293
|
+
|
294
|
+
#### `c_date_drop_down`
|
295
|
+
|
296
|
+
Alias keyword that specifies date [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'MM/dd/yyyy'` and drop down style with a border
|
297
|
+
|
298
|
+
![date dropdown screenshot](images/glimmer-cw-cdatetime-nebula-drop-down-date.png)
|
299
|
+
|
300
|
+
#### `c_time_drop_down`
|
301
|
+
|
302
|
+
Alias that specifies time [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'hh:mm a'` and drop down style with a border
|
303
|
+
|
304
|
+
![time dropdown screenshot](images/glimmer-cw-cdatetime-nebula-drop-down-time.png)
|
305
|
+
|
306
|
+
### Spinner Style
|
307
|
+
|
308
|
+
Spinner style is used with the `c_date_time_spinner`, `c_date_spinner`, and `c_time_spinner` keywords to provide a spinner for textual entry of date/time accompanied by up and down spinner buttons.
|
309
|
+
|
310
|
+
`CDT::SPINNER` style is applied by default but may be overriden by manually passing arguments to the keywords.
|
311
|
+
|
312
|
+
![spinner screenshot](images/glimmer-cw-cdatetime-nebula-spinner.png)
|
313
|
+
|
314
|
+
#### `c_date_time_spinner`
|
315
|
+
|
316
|
+
Alias that specifies date/time [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'MM/dd/yyyy hh:mm a'` and spinner style with a border
|
317
|
+
|
318
|
+
#### `c_date_spinner`
|
319
|
+
|
320
|
+
Alias that specifies date [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'MM/dd/yyyy'` and spinner style with a border
|
321
|
+
|
322
|
+
#### `c_time_spinner`
|
323
|
+
|
324
|
+
Alias that specifies time [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'hh:mm a'` and spinner style with a border
|
64
325
|
|
65
|
-
|
326
|
+
### Compact Style
|
66
327
|
|
67
|
-
|
328
|
+
Compact style is used with the `c_date_time_compact`, `c_date_compact`, and `c_time_compact` keywords to provide a compact text widget for date/time without any extra buttons.
|
68
329
|
|
69
|
-
|
330
|
+
`CDT::COMPACT` style is applied by default but may be overriden by manually passing arguments to the keywords.
|
70
331
|
|
71
|
-
|
332
|
+
![compact screenshot](images/glimmer-cw-cdatetime-nebula-compact.png)
|
333
|
+
|
334
|
+
#### `c_date_time_compact`
|
335
|
+
|
336
|
+
Alias that specifies date/time [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'MM/dd/yyyy hh:mm a'` and compact style (just a text field) with a border
|
337
|
+
|
338
|
+
#### `c_date_compact`
|
339
|
+
|
340
|
+
Alias that specifies date [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'MM/dd/yyyy'` and compact style (just a text field) with a border
|
341
|
+
|
342
|
+
#### `c_time_compact`
|
343
|
+
|
344
|
+
Alias that specifies time [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) `'hh:mm a'` and compact style (just a text field) with a border
|
345
|
+
|
346
|
+
### `CDT` Style Arguments
|
347
|
+
|
348
|
+
[`CDT`](https://www.eclipse.org/nebula/releases/latest/javadoc/org/eclipse/nebula/widgets/cdatetime/CDT.html) styles are fully documented in the [Nebula `CDT` Javadoc](https://www.eclipse.org/nebula/releases/latest/javadoc/org/eclipse/nebula/widgets/cdatetime/CDT.html).
|
349
|
+
|
350
|
+
The `cdt` keyword builds a [`CDT`](https://www.eclipse.org/nebula/releases/latest/javadoc/org/eclipse/nebula/widgets/cdatetime/CDT.html) style by passing in comma-separated symbols (e.g. `cdt(:border, :drop_down, :date_long)`)
|
351
|
+
|
352
|
+
For example, instead of passing style as bit-or'ed `CDT` Constant style bits:
|
353
|
+
|
354
|
+
```ruby
|
355
|
+
c_date_time(CDT::BORDER | CDT::TAB_FIELDS | CDT::DROP_DOWN | CDT::DATE_LONG)
|
356
|
+
```
|
357
|
+
|
358
|
+
You instead pass style as comma-separated symbols:
|
359
|
+
|
360
|
+
```ruby
|
361
|
+
c_date_time(cdt(:border, :tab_fields, :drop_down, :date_long))
|
362
|
+
```
|
363
|
+
|
364
|
+
However, `c_date_time` goes one step further and uses it internally automatically by all `c_date_time` keyword initializers, so you could ditch the `cdt` entirely when constructing a widget.
|
365
|
+
|
366
|
+
```ruby
|
367
|
+
c_date_time(:border, :tab_fields, :drop_down, :date_long)
|
368
|
+
```
|
369
|
+
|
370
|
+
Furthermore, `c_date_time` has pre-configured smart defaults for `CDT` styles:
|
371
|
+
|
372
|
+
```
|
373
|
+
'c_date_time' => [:border, :tab_fields, :simple],
|
374
|
+
'c_date' => [:border, :tab_fields, :date_short, :simple],
|
375
|
+
'c_time' => [:border, :tab_fields, :time_short, :simple],
|
376
|
+
'c_date_time_compact' => [:border, :tab_fields, :compact],
|
377
|
+
'c_date_compact' => [:border, :tab_fields, :date_short, :compact],
|
378
|
+
'c_time_compact' => [:border, :tab_fields, :time_short, :compact],
|
379
|
+
'c_date_time_spinner' => [:border, :tab_fields, :spinner],
|
380
|
+
'c_date_spinner' => [:border, :tab_fields, :date_short, :spinner],
|
381
|
+
'c_time_spinner' => [:border, :tab_fields, :time_short, :spinner],
|
382
|
+
'c_date_time_drop_down' => [:border, :tab_fields, :drop_down],
|
383
|
+
'c_date_drop_down' => [:border, :tab_fields, :drop_down, :date_short],
|
384
|
+
'c_time_drop_down' => [:border, :tab_fields, :drop_down, :time_short],
|
385
|
+
```
|
386
|
+
|
387
|
+
### Data-Binding and Observers:
|
388
|
+
|
389
|
+
The `selection` property provides access to the value selected by the user. It can be hooked with basic data-binding to a model property. Additionaly observers may be attached too, such as `on_widget_selected` and `on_key_pressed`.
|
390
|
+
|
391
|
+
Example:
|
72
392
|
|
73
393
|
```ruby
|
74
394
|
# ...
|
75
395
|
composite {
|
76
396
|
# ...
|
77
|
-
@start_at = c_date_time(
|
397
|
+
@start_at = c_date_time(:border, :drop_down, :date_long) {
|
78
398
|
# ...
|
79
399
|
selection bind(@task, :start_at)
|
80
400
|
on_key_pressed { |event|
|
@@ -85,9 +405,13 @@ Here is the Nebula CDateTime Widget [Javadoc API page](https://www.eclipse.org/n
|
|
85
405
|
# ...
|
86
406
|
```
|
87
407
|
|
88
|
-
![Nebula CDateTime Example](glimmer-cw-cdatetime-nebula-example.png)
|
408
|
+
![Nebula CDateTime Example](images/glimmer-cw-cdatetime-nebula-example.png)
|
409
|
+
|
410
|
+
### Table Editor
|
89
411
|
|
90
|
-
|
412
|
+
`c_date_time` (and any keyword aliases) can be used as a `table` / `table_column` editor by passing as symbol to `editor` property (optionally followed by args model editing property).
|
413
|
+
|
414
|
+
Example:
|
91
415
|
|
92
416
|
```ruby
|
93
417
|
# ...
|
@@ -96,12 +420,12 @@ Here is the Nebula CDateTime Widget [Javadoc API page](https://www.eclipse.org/n
|
|
96
420
|
table_column {
|
97
421
|
text 'Start Date'
|
98
422
|
width CONFIG[:table_column_width_hint]
|
99
|
-
editor :c_date_time,
|
423
|
+
editor :c_date_time, cdt(:border, :drop_down, :date_long), property: :start_at
|
100
424
|
}
|
101
425
|
table_column {
|
102
426
|
text 'End Date'
|
103
427
|
width CONFIG[:table_column_width_hint]
|
104
|
-
editor :
|
428
|
+
editor :c_date_drop_down, property: :end_at
|
105
429
|
}
|
106
430
|
# ... other table_column declarations
|
107
431
|
items bind(Task, :list), column_properties(:project_name, :task_type, :name, :start_date, :end_date, :duration, :priority)
|
@@ -110,11 +434,58 @@ Here is the Nebula CDateTime Widget [Javadoc API page](https://www.eclipse.org/n
|
|
110
434
|
# ...
|
111
435
|
```
|
112
436
|
|
113
|
-
![Nebula CDateTime Example](glimmer-cw-cdatetime-nebula-example-table-editor.png)
|
437
|
+
![Nebula CDateTime Example](images/glimmer-cw-cdatetime-nebula-example-table-editor.png)
|
438
|
+
|
439
|
+
## API
|
440
|
+
|
441
|
+
You may check out the Nebula CDateTime Widget [Javadoc API](https://www.eclipse.org/nebula/releases/latest/javadoc/org/eclipse/nebula/widgets/cdatetime/CDateTime.html).
|
442
|
+
|
443
|
+
One noteworthy property is [pattern](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html), which can be customized according to the date/time pattern [SimpleDateFormat Javadoc](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html).
|
444
|
+
|
445
|
+
Example:
|
446
|
+
|
447
|
+
```ruby
|
448
|
+
c_date_time(:border, :drop_down) {
|
449
|
+
pattern 'hh:mm a'
|
450
|
+
}
|
451
|
+
```
|
452
|
+
|
453
|
+
This should customize `c_date_time` to function just like `c_time_drop_down`
|
454
|
+
|
455
|
+
![time drop down screenshot](images/glimmer-cw-cdatetime-nebula-drop-down-time.png)
|
456
|
+
|
457
|
+
### Glimmer Custom API
|
458
|
+
|
459
|
+
Glimmer adds a few extra API methods to CDateTime from Nebula.
|
460
|
+
|
461
|
+
#### `toggle_open`
|
462
|
+
|
463
|
+
Programmatically toggle date/time dropdown as open (simpler than directly calling `.swt_widget.set_open` in certain circumstances)
|
464
|
+
|
465
|
+
#### `text_widget_proxy`
|
466
|
+
|
467
|
+
Provides access to the inner text widget to allow programmatic adding of obesrvers and/or data-binding.
|
468
|
+
|
469
|
+
Example:
|
470
|
+
|
471
|
+
```
|
472
|
+
c_time { |proxy|
|
473
|
+
proxy.text_widget_proxy.content {
|
474
|
+
on_swt_mouseup { |event|
|
475
|
+
proxy.toggle_open
|
476
|
+
}
|
477
|
+
}
|
478
|
+
}
|
479
|
+
```
|
480
|
+
|
481
|
+
|
482
|
+
## TODO
|
483
|
+
|
484
|
+
[TODO.md](TODO.md)
|
114
485
|
|
115
486
|
## Change Log
|
116
487
|
|
117
|
-
|
488
|
+
[CHANGELOG.md](CHANGELOG.md)
|
118
489
|
|
119
490
|
## Contributing to glimmer-cw-cdatetime-nebula
|
120
491
|
|
@@ -128,6 +499,10 @@ Here is the Nebula CDateTime Widget [Javadoc API page](https://www.eclipse.org/n
|
|
128
499
|
|
129
500
|
## Copyright
|
130
501
|
|
131
|
-
[MIT](
|
502
|
+
[MIT](LICENSE.txt)
|
503
|
+
|
504
|
+
Copyright (c) 2020 - Andy Maleh
|
505
|
+
|
506
|
+
--
|
132
507
|
|
133
|
-
|
508
|
+
[<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) (Ruby Desktop Development GUI Library).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.5.0.0.1
|
@@ -1,14 +1,38 @@
|
|
1
|
+
# Copyright (c) 2020 - Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.expand_path('../..', __FILE__))
|
3
23
|
|
4
24
|
require 'glimmer-dsl-swt'
|
5
25
|
|
6
|
-
|
7
|
-
|
26
|
+
require_relative '../vendor/nebula/org.eclipse.nebula.cwt_1.1.0.202007241204.jar'
|
27
|
+
require_relative '../vendor/nebula/org.eclipse.nebula.widgets.cdatetime_1.5.0.202007241204.jar'
|
8
28
|
|
9
29
|
Glimmer::Config.import_swt_packages += [
|
10
30
|
'org.eclipse.nebula.cwt',
|
11
31
|
'org.eclipse.nebula.widgets.cdatetime',
|
12
32
|
]
|
13
33
|
|
34
|
+
require 'glimmer-cw-cdatetime-nebula/ext/glimmer/dsl/swt/cdt_expression'
|
35
|
+
require 'glimmer-cw-cdatetime-nebula/ext/glimmer/swt/c_date_time_proxy'
|
14
36
|
require 'views/nebula/c_date_time'
|
37
|
+
|
38
|
+
Glimmer::Config::SAMPLE_DIRECTORIES << File.expand_path('../../samples/nebula', __FILE__)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'glimmer/dsl/static_expression'
|
2
|
+
require 'glimmer-cw-cdatetime-nebula/ext/glimmer/swt/cdt_proxy'
|
3
|
+
|
4
|
+
module Glimmer
|
5
|
+
module DSL
|
6
|
+
module SWT
|
7
|
+
# Extends Glimmer DSL to easily build CDT constant values with `cdt(arg)`
|
8
|
+
#
|
9
|
+
# Named CdtExpression (not CDTExpression) so that the DSL engine
|
10
|
+
# discovers quickly by convention
|
11
|
+
class CdtExpression < StaticExpression
|
12
|
+
def can_interpret?(parent, keyword, *args, &block)
|
13
|
+
block.nil? &&
|
14
|
+
args.size > 0
|
15
|
+
end
|
16
|
+
|
17
|
+
def interpret(parent, keyword, *args, &block)
|
18
|
+
Glimmer::SWT::CDTProxy[*args]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Copyright (c) 2020 - Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Glimmer
|
23
|
+
module SWT
|
24
|
+
# This modules just configures Glimmer to work with Nebula CDateTime
|
25
|
+
# Since it is wrapping an existing SWT widget with the same name,
|
26
|
+
# it is not implemented as a typical "Glimmer Custom Widget", yet
|
27
|
+
# just a Glimmer widget proxy that extends Glimmer::SWT::WidgetProxy
|
28
|
+
class CDateTimeProxy < WidgetProxy
|
29
|
+
def text_widget_proxy
|
30
|
+
WidgetProxy.create(swt_widget: swt_widget.text_widget.control) if swt_widget.text_widget
|
31
|
+
end
|
32
|
+
|
33
|
+
def toggle_open
|
34
|
+
swt_widget.set_open(!swt_widget.is_open)
|
35
|
+
end
|
36
|
+
|
37
|
+
WidgetProxy::DEFAULT_STYLES.merge!(
|
38
|
+
'c_date_time' => [:border, :tab_fields, :simple],
|
39
|
+
'c_date' => [:border, :tab_fields, :simple],
|
40
|
+
'c_time' => [:border, :tab_fields, :simple],
|
41
|
+
'c_date_time_drop_down' => [:border, :tab_fields, :drop_down],
|
42
|
+
'c_date_drop_down' => [:border, :tab_fields, :drop_down],
|
43
|
+
'c_time_drop_down' => [:border, :tab_fields, :drop_down],
|
44
|
+
'c_date_time_spinner' => [:border, :tab_fields, :spinner],
|
45
|
+
'c_date_spinner' => [:border, :tab_fields, :spinner],
|
46
|
+
'c_time_spinner' => [:border, :tab_fields, :spinner],
|
47
|
+
'c_date_time_compact' => [:border, :tab_fields, :compact],
|
48
|
+
'c_date_compact' => [:border, :tab_fields, :compact],
|
49
|
+
'c_time_compact' => [:border, :tab_fields, :compact],
|
50
|
+
)
|
51
|
+
|
52
|
+
WidgetProxy::DEFAULT_INITIALIZERS['c_date_time'] = WidgetProxy::DEFAULT_INITIALIZERS['c_date_time_compact'] = WidgetProxy::DEFAULT_INITIALIZERS['c_date_time_spinner'] = WidgetProxy::DEFAULT_INITIALIZERS['c_date_time_drop_down'] = lambda do |widget|
|
53
|
+
has_pattern_style = %w[time_short time_medium date_short date_medium date_long].reduce(false) {|result, style| result || widget.get_data('proxy').has_style?(style)}
|
54
|
+
widget.pattern = 'MM/dd/yyyy hh:mm a' unless has_pattern_style
|
55
|
+
end
|
56
|
+
WidgetProxy::DEFAULT_INITIALIZERS['c_date'] = WidgetProxy::DEFAULT_INITIALIZERS['c_date_compact'] = WidgetProxy::DEFAULT_INITIALIZERS['c_date_spinner'] = WidgetProxy::DEFAULT_INITIALIZERS['c_date_drop_down'] = lambda do |widget|
|
57
|
+
has_pattern_style = %w[time_short time_medium date_short date_medium date_long].reduce(false) {|result, style| result || widget.get_data('proxy').has_style?(style)}
|
58
|
+
unless has_pattern_style
|
59
|
+
widget.format = Glimmer::SWT::CDTProxy[:date_short]
|
60
|
+
widget.pattern = 'MM/dd/yyyy'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
WidgetProxy::DEFAULT_INITIALIZERS['c_time'] = WidgetProxy::DEFAULT_INITIALIZERS['c_time_compact'] = WidgetProxy::DEFAULT_INITIALIZERS['c_time_spinner'] = WidgetProxy::DEFAULT_INITIALIZERS['c_time_drop_down'] = lambda do |widget|
|
64
|
+
has_pattern_style = %w[time_short time_medium date_short date_medium date_long].reduce(false) {|result, style| result || widget.get_data('proxy').has_style?(style)}
|
65
|
+
unless has_pattern_style
|
66
|
+
widget.format = Glimmer::SWT::CDTProxy[:time_short]
|
67
|
+
widget.pattern = 'hh:mm a'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
WidgetProxy::KEYWORD_ALIASES.merge!(
|
72
|
+
'c_date' => 'c_date_time',
|
73
|
+
'c_time' => 'c_date_time',
|
74
|
+
'c_date_time_compact' => 'c_date_time',
|
75
|
+
'c_date_compact' => 'c_date_time',
|
76
|
+
'c_time_compact' => 'c_date_time',
|
77
|
+
'c_date_time_spinner' => 'c_date_time',
|
78
|
+
'c_date_spinner' => 'c_date_time',
|
79
|
+
'c_time_spinner' => 'c_date_time',
|
80
|
+
'c_date_time_drop_down' => 'c_date_time',
|
81
|
+
'c_date_drop_down' => 'c_date_time',
|
82
|
+
'c_time_drop_down' => 'c_date_time',
|
83
|
+
)
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def interpret_style(*styles)
|
88
|
+
CDTProxy[*styles] rescue super
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright (c) 2020 - Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/swt/style_constantizable'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
# Proxy for org.eclipse.nebula.widgets.cdatetime.CDT
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class CDTProxy
|
30
|
+
include Glimmer::SWT::StyleConstantizable
|
31
|
+
|
32
|
+
class << self
|
33
|
+
JAVA_IMPORT = 'org.eclipse.nebula.widgets.cdatetime.CDT'
|
34
|
+
|
35
|
+
java_import JAVA_IMPORT
|
36
|
+
|
37
|
+
def constant_java_import
|
38
|
+
JAVA_IMPORT
|
39
|
+
end
|
40
|
+
|
41
|
+
def constant_source_class
|
42
|
+
CDT
|
43
|
+
end
|
44
|
+
|
45
|
+
def constant_value_none
|
46
|
+
CDT::NONE
|
47
|
+
end
|
48
|
+
|
49
|
+
def extra_styles
|
50
|
+
{}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -1,35 +1,43 @@
|
|
1
|
+
require 'glimmer-cw-cdatetime-nebula/ext/glimmer/swt/c_date_time_proxy'
|
2
|
+
|
1
3
|
module Nebula
|
2
4
|
# This modules just configures Glimmer to work with Nebula CDateTime
|
3
5
|
module CDateTime
|
4
6
|
include Glimmer
|
5
|
-
|
6
|
-
Glimmer::SWT::
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
|
8
|
+
keywords = ['c_date_time'] + Glimmer::SWT::WidgetProxy::KEYWORD_ALIASES.select do |key, value|
|
9
|
+
value == 'c_date_time'
|
10
|
+
end.keys
|
11
|
+
|
12
|
+
keywords.each do |keyword|
|
13
|
+
Glimmer::SWT::TableProxy.editors[keyword] ||= {
|
14
|
+
widget_value_property: :selection,
|
15
|
+
editor_gui: lambda do |args, model, property, table_proxy|
|
16
|
+
args << cdt(:drop_down) if args.empty?
|
17
|
+
table_editor_widget_proxy = send(keyword, *args) {
|
18
|
+
table_proxy.table_editor.minimumHeight = 20
|
19
|
+
selection model.send(property)
|
20
|
+
focus true
|
21
|
+
on_focus_lost {
|
19
22
|
table_proxy.finish_edit!
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
}
|
24
|
+
on_key_pressed { |key_event|
|
25
|
+
if key_event.keyCode == swt(:cr)
|
26
|
+
table_proxy.finish_edit!
|
27
|
+
elsif key_event.keyCode == swt(:esc)
|
28
|
+
table_proxy.cancel_edit!
|
29
|
+
end
|
30
|
+
}
|
31
|
+
on_widget_selected { |event|
|
32
|
+
table_proxy.finish_edit! unless event.widget.is_open
|
33
|
+
}
|
34
|
+
on_widget_default_selected { |event|
|
35
|
+
table_proxy.finish_edit! unless event.widget.is_open
|
36
|
+
}
|
29
37
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
38
|
+
table_editor_widget_proxy
|
39
|
+
end
|
40
|
+
}
|
41
|
+
end
|
34
42
|
end
|
35
43
|
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# Copyright (c) 2020 - Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require_relative '../../lib/glimmer-cw-cdatetime-nebula'
|
23
|
+
|
24
|
+
class CDateTimeGallery
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
def open
|
28
|
+
shell {
|
29
|
+
grid_layout(4, false) {
|
30
|
+
vertical_spacing 20
|
31
|
+
}
|
32
|
+
text 'Nebula CDateTime Glimmer Custom Widget Gallery'
|
33
|
+
|
34
|
+
label {
|
35
|
+
layout_data(:center, :center, true, false) {
|
36
|
+
horizontal_span 4
|
37
|
+
}
|
38
|
+
text 'Nebula CDateTime Glimmer Custom Widget Gallery'
|
39
|
+
font height: 24, style: :bold
|
40
|
+
}
|
41
|
+
|
42
|
+
tab_folder {
|
43
|
+
tab_item {
|
44
|
+
grid_layout 2, false
|
45
|
+
text 'Simple'
|
46
|
+
|
47
|
+
label {
|
48
|
+
text 'c_date_time'
|
49
|
+
font name: 'Consolas', height: 14
|
50
|
+
}
|
51
|
+
c_date_time
|
52
|
+
|
53
|
+
label {
|
54
|
+
text 'c_date'
|
55
|
+
font name: 'Consolas', height: 14
|
56
|
+
}
|
57
|
+
c_date
|
58
|
+
|
59
|
+
label {
|
60
|
+
text 'c_time'
|
61
|
+
font name: 'Consolas', height: 14
|
62
|
+
}
|
63
|
+
c_time
|
64
|
+
}
|
65
|
+
|
66
|
+
tab_item {
|
67
|
+
grid_layout 2, false
|
68
|
+
text 'Drop Down'
|
69
|
+
|
70
|
+
label {
|
71
|
+
text 'c_date_time_drop_down'
|
72
|
+
font name: 'Consolas', height: 14
|
73
|
+
}
|
74
|
+
c_date_time_drop_down {
|
75
|
+
layout_data(:fill, :center, true, true)
|
76
|
+
}
|
77
|
+
|
78
|
+
label {
|
79
|
+
text 'c_date_drop_down'
|
80
|
+
font name: 'Consolas', height: 14
|
81
|
+
}
|
82
|
+
c_date_drop_down {
|
83
|
+
layout_data(:fill, :center, true, true)
|
84
|
+
}
|
85
|
+
|
86
|
+
label {
|
87
|
+
text 'c_time_drop_down'
|
88
|
+
font name: 'Consolas', height: 14
|
89
|
+
}
|
90
|
+
c_time_drop_down {
|
91
|
+
layout_data(:fill, :center, true, true)
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
tab_item {
|
96
|
+
grid_layout 2, false
|
97
|
+
text 'Spinner'
|
98
|
+
|
99
|
+
label {
|
100
|
+
text 'c_date_time_spinner'
|
101
|
+
font name: 'Consolas', height: 14
|
102
|
+
}
|
103
|
+
c_date_time_spinner {
|
104
|
+
layout_data(:fill, :center, true, true)
|
105
|
+
}
|
106
|
+
|
107
|
+
label {
|
108
|
+
text 'c_date_spinner'
|
109
|
+
font name: 'Consolas', height: 14
|
110
|
+
}
|
111
|
+
c_date_spinner {
|
112
|
+
layout_data(:fill, :center, true, true)
|
113
|
+
}
|
114
|
+
|
115
|
+
label {
|
116
|
+
text 'c_time_spinner'
|
117
|
+
font name: 'Consolas', height: 14
|
118
|
+
}
|
119
|
+
c_time_spinner {
|
120
|
+
layout_data(:fill, :center, true, true)
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
tab_item {
|
125
|
+
grid_layout 2, false
|
126
|
+
text 'Compact'
|
127
|
+
|
128
|
+
label {
|
129
|
+
text 'c_date_time_compact'
|
130
|
+
font name: 'Consolas', height: 14
|
131
|
+
}
|
132
|
+
c_date_time_compact {
|
133
|
+
layout_data(:fill, :center, true, true)
|
134
|
+
}
|
135
|
+
|
136
|
+
label {
|
137
|
+
text 'c_date_compact'
|
138
|
+
font name: 'Consolas', height: 14
|
139
|
+
}
|
140
|
+
c_date_compact {
|
141
|
+
layout_data(:fill, :center, true, true)
|
142
|
+
}
|
143
|
+
|
144
|
+
label {
|
145
|
+
text 'c_time_compact'
|
146
|
+
font name: 'Consolas', height: 14
|
147
|
+
}
|
148
|
+
c_time_compact {
|
149
|
+
layout_data(:fill, :center, true, true)
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}.open
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
CDateTimeGallery.new.open
|
File without changes
|
metadata
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-cw-cdatetime-nebula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0.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: 2020-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 0.
|
18
|
+
version: 4.17.0.0
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 5.0.0.0
|
22
22
|
name: glimmer-dsl-swt
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
@@ -26,10 +26,10 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 4.17.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 5.0.0.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
@@ -72,22 +72,8 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
requirement: !ruby/object:Gem::Requirement
|
77
|
-
requirements:
|
78
|
-
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: '0'
|
81
|
-
name: glimmer-cs-gladiator
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
89
75
|
description: Nebula CDateTime Widget - Glimmer Custom Widget - A Date and Time selection
|
90
|
-
widget that can be used in a
|
76
|
+
widget that can be used in a simple, dropdown, spinner, or compact style.
|
91
77
|
email: andy.am@gmail.com
|
92
78
|
executables: []
|
93
79
|
extensions: []
|
@@ -95,13 +81,18 @@ extra_rdoc_files:
|
|
95
81
|
- LICENSE.txt
|
96
82
|
- README.md
|
97
83
|
files:
|
84
|
+
- CHANGELOG.md
|
98
85
|
- LICENSE.txt
|
99
86
|
- README.md
|
100
87
|
- VERSION
|
101
88
|
- lib/glimmer-cw-cdatetime-nebula.rb
|
89
|
+
- lib/glimmer-cw-cdatetime-nebula/ext/glimmer/dsl/swt/cdt_expression.rb
|
90
|
+
- lib/glimmer-cw-cdatetime-nebula/ext/glimmer/swt/c_date_time_proxy.rb
|
91
|
+
- lib/glimmer-cw-cdatetime-nebula/ext/glimmer/swt/cdt_proxy.rb
|
102
92
|
- lib/views/nebula/c_date_time.rb
|
103
|
-
-
|
104
|
-
- vendor/nebula/org.eclipse.nebula.
|
93
|
+
- samples/nebula/c_date_time_gallery.rb
|
94
|
+
- vendor/nebula/org.eclipse.nebula.cwt_1.1.0.202007241204.jar
|
95
|
+
- vendor/nebula/org.eclipse.nebula.widgets.cdatetime_1.5.0.202007241204.jar
|
105
96
|
homepage: http://github.com/AndyObtiva/glimmer-cw-cdatetime-nebula
|
106
97
|
licenses:
|
107
98
|
- MIT
|
Binary file
|