glimmer-cw-cdatetime-nebula 1.4.0.2.0 → 1.4.0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +218 -48
- data/VERSION +1 -1
- data/lib/glimmer-cw-cdatetime-nebula.rb +2 -42
- data/lib/glimmer-cw-cdatetime-nebula/ext/glimmer/swt/c_date_time_proxy.rb +53 -36
- data/lib/views/nebula/c_date_time.rb +35 -27
- data/samples/nebula/c_date_time_gallery.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c390330481758698b8ec35c2356503c6c660be9dc75151a3085ba45feab75d3
|
4
|
+
data.tar.gz: 3a3c0c9c43dc15a5935d3b7563bcf56bf0e8c244ae46c45b5e9718e441893c36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97905ee9b09fd152996fa90efaba4a0b2430e19757a45105f9828cb8c376329f6db0d24d46e1c10596ce2ac2b00886cea71f802040e2929394b4fdfc93b75126
|
7
|
+
data.tar.gz: 7daed57b597f0045460f42b08e2b510ef11bc3976ff1d9bfd45ca2ece436e83ca9e0f4995af61acac184c949cf70e155d28c21f7a62f122fffda92029a70f378
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# Nebula CDateTime Widget 1.4.0.2.
|
1
|
+
# Nebula CDateTime Widget 1.4.0.2.1
|
2
2
|
## [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 /> Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer#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
|
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
8
|
|
9
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
10
|
|
@@ -12,34 +12,35 @@ Packaged as a [Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer#cust
|
|
12
12
|
|
13
13
|
## Table of contents
|
14
14
|
|
15
|
-
|
15
|
+
# Table of contents
|
16
|
+
|
17
|
+
- [Nebula CDateTime Widget 1.4.0.2.1](#nebula-cdatetime-widget-14021)
|
16
18
|
- [Pre-requisites](#pre-requisites)
|
17
19
|
- [Setup](#setup)
|
18
20
|
- [Glimmer Application](#glimmer-application)
|
19
21
|
- [Glimmer Custom Shell or Glimmer Custom Widget](#glimmer-custom-shell-or-glimmer-custom-widget)
|
20
22
|
- [Java Imports](#java-imports)
|
21
|
-
- [Instructions](#instructions)
|
23
|
+
- [Usage Instructions](#usage-instructions)
|
22
24
|
- [Sample](#sample)
|
23
|
-
- [
|
25
|
+
- [Simple Style](#simple-style)
|
24
26
|
- [`c_date_time`](#cdatetime)
|
25
27
|
- [`c_date`](#cdate)
|
26
28
|
- [`c_time`](#ctime)
|
27
|
-
- [Drop Down](#drop-down)
|
29
|
+
- [Drop Down Style](#drop-down-style)
|
28
30
|
- [`c_date_time_drop_down`](#cdatetimedropdown)
|
29
31
|
- [`c_date_drop_down`](#cdatedropdown)
|
30
32
|
- [`c_time_drop_down`](#ctimedropdown)
|
31
|
-
- [Spinner](#spinner)
|
33
|
+
- [Spinner Style](#spinner-style)
|
32
34
|
- [`c_date_time_spinner`](#cdatetimespinner)
|
33
35
|
- [`c_date_spinner`](#cdatespinner)
|
34
36
|
- [`c_time_spinner`](#ctimespinner)
|
35
|
-
- [Compact](#compact)
|
37
|
+
- [Compact Style](#compact-style)
|
36
38
|
- [`c_date_time_compact`](#cdatetimecompact)
|
37
39
|
- [`c_date_compact`](#cdatecompact)
|
38
40
|
- [`c_time_compact`](#ctimecompact)
|
39
|
-
- [Style](#style)
|
40
|
-
- [`cdt`](#cdt)
|
41
|
+
- [`CDT` Style Arguments](#cdt-style-arguments)
|
41
42
|
- [Data-Binding and Observers:](#data-binding-and-observers)
|
42
|
-
- [Table
|
43
|
+
- [Table Editor](#table-editor)
|
43
44
|
- [API](#api)
|
44
45
|
- [Glimmer Custom API](#glimmer-custom-api)
|
45
46
|
- [`toggle_open`](#toggleopen)
|
@@ -66,7 +67,7 @@ Versions follow this convention:
|
|
66
67
|
Add the following to a [Glimmer](https://github.com/AndyObtiva/glimmer) application `Gemfile`:
|
67
68
|
|
68
69
|
```ruby
|
69
|
-
gem 'glimmer-cw-cdatetime-nebula', '1.4.0.2.
|
70
|
+
gem 'glimmer-cw-cdatetime-nebula', '1.4.0.2.1'
|
70
71
|
```
|
71
72
|
|
72
73
|
Run:
|
@@ -95,9 +96,9 @@ Requiring the gem automatically configures java imports in [Glimmer](https://git
|
|
95
96
|
|
96
97
|
## Usage Instructions
|
97
98
|
|
98
|
-
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#glimmer-dsl-syntax) as well as other alias keywords as explained below.
|
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#glimmer-dsl-syntax) as well as other alias keywords (e.g. drop down style, spinner style, and compact style) as explained below.
|
99
100
|
|
100
|
-
The `c_date_time` keyword takes [`CDT`](#cdt) style bits as arguments.
|
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.
|
101
102
|
|
102
103
|
Example:
|
103
104
|
|
@@ -115,79 +116,234 @@ Please run the following command to launch the [Nebula CDateTime Glimmer Custom
|
|
115
116
|
glimmer sample:run[c_date_time_gallery]
|
116
117
|
```
|
117
118
|
|
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.
|
119
263
|
|
120
|
-
|
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)
|
121
267
|
|
122
268
|
#### `c_date_time`
|
123
269
|
|
124
|
-
Main keyword representing the Nebula CDateTime custom widget. Defaults to date/time pattern `'MM/dd/yyyy hh:mm a'` and
|
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
|
125
271
|
|
126
272
|
#### `c_date`
|
127
273
|
|
128
|
-
Alias keyword that specifies date pattern `'MM/dd/yyyy'` and
|
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
|
129
275
|
|
130
276
|
#### `c_time`
|
131
277
|
|
132
|
-
Alias keyword that specifies time pattern `'hh:mm a'` and
|
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
|
133
281
|
|
134
|
-
|
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.
|
135
283
|
|
136
|
-
|
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)
|
137
287
|
|
138
288
|
#### `c_date_time_drop_down`
|
139
289
|
|
140
|
-
Alias keyword that specifies date/time pattern `'MM/dd/yyyy hh:mm a'` and drop down style with a border
|
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
|
141
291
|
|
142
|
-
![
|
292
|
+
![date time dropdown screenshot](images/glimmer-cw-cdatetime-nebula-drop-down-date-time.png)
|
143
293
|
|
144
294
|
#### `c_date_drop_down`
|
145
295
|
|
146
|
-
Alias keyword that specifies date pattern `'MM/dd/yyyy'` and drop down style with a border
|
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
|
147
297
|
|
148
|
-
![
|
298
|
+
![date dropdown screenshot](images/glimmer-cw-cdatetime-nebula-drop-down-date.png)
|
149
299
|
|
150
300
|
#### `c_time_drop_down`
|
151
301
|
|
152
|
-
Alias that specifies time pattern `'hh:mm a'` and drop down style with a border
|
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
|
153
307
|
|
154
|
-
|
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.
|
155
309
|
|
156
|
-
|
310
|
+
`CDT::SPINNER` style is applied by default but may be overriden by manually passing arguments to the keywords.
|
157
311
|
|
158
|
-
![
|
312
|
+
![spinner screenshot](images/glimmer-cw-cdatetime-nebula-spinner.png)
|
159
313
|
|
160
314
|
#### `c_date_time_spinner`
|
161
315
|
|
162
|
-
Alias that specifies date/time pattern `'MM/dd/yyyy hh:mm a'` and spinner style with a border
|
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
|
163
317
|
|
164
318
|
#### `c_date_spinner`
|
165
319
|
|
166
|
-
Alias that specifies date pattern `'MM/dd/yyyy'` and spinner style with a border
|
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
|
167
321
|
|
168
322
|
#### `c_time_spinner`
|
169
323
|
|
170
|
-
Alias that specifies time pattern `'hh:mm a'` and spinner style with a border
|
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
|
171
325
|
|
172
|
-
### Compact
|
326
|
+
### Compact Style
|
173
327
|
|
174
|
-
|
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.
|
329
|
+
|
330
|
+
`CDT::COMPACT` style is applied by default but may be overriden by manually passing arguments to the keywords.
|
331
|
+
|
332
|
+
![compact screenshot](images/glimmer-cw-cdatetime-nebula-compact.png)
|
175
333
|
|
176
334
|
#### `c_date_time_compact`
|
177
335
|
|
178
|
-
Alias that specifies date/time pattern `'MM/dd/yyyy hh:mm a'` and compact style (just a text field) with a border
|
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
|
179
337
|
|
180
338
|
#### `c_date_compact`
|
181
339
|
|
182
|
-
Alias that specifies date pattern `'MM/dd/yyyy'` and compact style (just a text field) with a border
|
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
|
183
341
|
|
184
342
|
#### `c_time_compact`
|
185
343
|
|
186
|
-
Alias that specifies time pattern `'hh:mm a'` and compact style (just a text field) with a border
|
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
|
187
345
|
|
188
|
-
### Style
|
189
|
-
|
190
|
-
#### `cdt`
|
346
|
+
### `CDT` Style Arguments
|
191
347
|
|
192
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).
|
193
349
|
|
@@ -196,19 +352,19 @@ The `cdt` keyword builds a [`CDT`](https://www.eclipse.org/nebula/releases/lates
|
|
196
352
|
For example, instead of passing style as bit-or'ed `CDT` Constant style bits:
|
197
353
|
|
198
354
|
```ruby
|
199
|
-
c_date_time(CDT::BORDER | CDT::
|
355
|
+
c_date_time(CDT::BORDER | CDT::TAB_FIELDS | CDT::DROP_DOWN | CDT::DATE_LONG)
|
200
356
|
```
|
201
357
|
|
202
358
|
You instead pass style as comma-separated symbols:
|
203
359
|
|
204
360
|
```ruby
|
205
|
-
c_date_time(cdt(:border, :
|
361
|
+
c_date_time(cdt(:border, :tab_fields, :drop_down, :date_long))
|
206
362
|
```
|
207
363
|
|
208
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.
|
209
365
|
|
210
366
|
```ruby
|
211
|
-
c_date_time(:border, :
|
367
|
+
c_date_time(:border, :tab_fields, :drop_down, :date_long)
|
212
368
|
```
|
213
369
|
|
214
370
|
Furthermore, `c_date_time` has pre-configured smart defaults for `CDT` styles:
|
@@ -251,9 +407,9 @@ Example:
|
|
251
407
|
|
252
408
|
![Nebula CDateTime Example](images/glimmer-cw-cdatetime-nebula-example.png)
|
253
409
|
|
254
|
-
### Table
|
410
|
+
### Table Editor
|
255
411
|
|
256
|
-
`c_date_time` can be used as a `table` / `table_column` editor.
|
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).
|
257
413
|
|
258
414
|
Example:
|
259
415
|
|
@@ -269,7 +425,7 @@ Example:
|
|
269
425
|
table_column {
|
270
426
|
text 'End Date'
|
271
427
|
width CONFIG[:table_column_width_hint]
|
272
|
-
editor :
|
428
|
+
editor :c_date_drop_down, property: :end_at
|
273
429
|
}
|
274
430
|
# ... other table_column declarations
|
275
431
|
items bind(Task, :list), column_properties(:project_name, :task_type, :name, :start_date, :end_date, :duration, :priority)
|
@@ -284,6 +440,20 @@ Example:
|
|
284
440
|
|
285
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).
|
286
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
|
+
|
287
457
|
### Glimmer Custom API
|
288
458
|
|
289
459
|
Glimmer adds a few extra API methods to CDateTime from Nebula.
|
@@ -302,7 +472,7 @@ Example:
|
|
302
472
|
c_time { |proxy|
|
303
473
|
proxy.text_widget_proxy.content {
|
304
474
|
on_swt_mouseup { |event|
|
305
|
-
|
475
|
+
proxy.toggle_open
|
306
476
|
}
|
307
477
|
}
|
308
478
|
}
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.0.2.
|
1
|
+
1.4.0.2.1
|
@@ -20,12 +20,11 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
|
23
|
-
$LOAD_PATH.unshift(File.expand_path('../..', __FILE__))
|
24
23
|
|
25
24
|
require 'glimmer-dsl-swt'
|
26
25
|
|
27
|
-
|
28
|
-
|
26
|
+
require_relative '../vendor/nebula/org.eclipse.nebula.cwt_1.1.0.jar'
|
27
|
+
require_relative '../vendor/nebula/org.eclipse.nebula.widgets.cdatetime_1.4.0.jar'
|
29
28
|
|
30
29
|
Glimmer::Config.import_swt_packages += [
|
31
30
|
'org.eclipse.nebula.cwt',
|
@@ -36,43 +35,4 @@ require 'glimmer-cw-cdatetime-nebula/ext/glimmer/dsl/swt/cdt_expression'
|
|
36
35
|
require 'glimmer-cw-cdatetime-nebula/ext/glimmer/swt/c_date_time_proxy'
|
37
36
|
require 'views/nebula/c_date_time'
|
38
37
|
|
39
|
-
Glimmer::SWT::WidgetProxy::DEFAULT_STYLES.merge!(
|
40
|
-
'c_date_time' => [:border, :tab_fields, :simple],
|
41
|
-
'c_date' => [:border, :tab_fields, :date_short, :simple],
|
42
|
-
'c_time' => [:border, :tab_fields, :time_short, :simple],
|
43
|
-
'c_date_time_compact' => [:border, :tab_fields, :compact],
|
44
|
-
'c_date_compact' => [:border, :tab_fields, :date_short, :compact],
|
45
|
-
'c_time_compact' => [:border, :tab_fields, :time_short, :compact],
|
46
|
-
'c_date_time_spinner' => [:border, :tab_fields, :spinner],
|
47
|
-
'c_date_spinner' => [:border, :tab_fields, :date_short, :spinner],
|
48
|
-
'c_time_spinner' => [:border, :tab_fields, :time_short, :spinner],
|
49
|
-
'c_date_time_drop_down' => [:border, :tab_fields, :drop_down],
|
50
|
-
'c_date_drop_down' => [:border, :tab_fields, :drop_down, :date_short],
|
51
|
-
'c_time_drop_down' => [:border, :tab_fields, :drop_down, :time_short],
|
52
|
-
)
|
53
|
-
|
54
|
-
Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_date_time'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_date_time_compact'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_date_time_spinner'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_date_time_drop_down'] = lambda do |widget|
|
55
|
-
widget.pattern = 'MM/dd/yyyy hh:mm a'
|
56
|
-
end
|
57
|
-
Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_date'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_date_compact'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_date_spinner'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_date_drop_down'] = lambda do |widget|
|
58
|
-
widget.pattern = 'MM/dd/yyyy'
|
59
|
-
end
|
60
|
-
Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_time'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_time_compact'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_time_spinner'] = Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['c_time_drop_down'] = lambda do |widget|
|
61
|
-
widget.pattern = 'hh:mm a'
|
62
|
-
end
|
63
|
-
|
64
|
-
Glimmer::SWT::WidgetProxy::KEYWORD_ALIASES.merge!(
|
65
|
-
'c_date' => 'c_date_time',
|
66
|
-
'c_time' => 'c_date_time',
|
67
|
-
'c_date_time_compact' => 'c_date_time',
|
68
|
-
'c_date_compact' => 'c_date_time',
|
69
|
-
'c_time_compact' => 'c_date_time',
|
70
|
-
'c_date_time_spinner' => 'c_date_time',
|
71
|
-
'c_date_spinner' => 'c_date_time',
|
72
|
-
'c_time_spinner' => 'c_date_time',
|
73
|
-
'c_date_time_drop_down' => 'c_date_time',
|
74
|
-
'c_date_drop_down' => 'c_date_time',
|
75
|
-
'c_time_drop_down' => 'c_date_time',
|
76
|
-
)
|
77
|
-
|
78
38
|
Glimmer::Config::SAMPLE_DIRECTORIES << File.expand_path('../../samples/nebula', __FILE__)
|
@@ -25,52 +25,69 @@ module Glimmer
|
|
25
25
|
# Since it is wrapping an existing SWT widget with the same name,
|
26
26
|
# it is not implemented as a typical "Glimmer Custom Widget", yet
|
27
27
|
# just a Glimmer widget proxy that extends Glimmer::SWT::WidgetProxy
|
28
|
-
class CDateTimeProxy <
|
28
|
+
class CDateTimeProxy < WidgetProxy
|
29
29
|
def text_widget_proxy
|
30
|
-
|
30
|
+
WidgetProxy.create(swt_widget: swt_widget.text_widget.control) if swt_widget.text_widget
|
31
31
|
end
|
32
32
|
|
33
33
|
def toggle_open
|
34
34
|
swt_widget.set_open(!swt_widget.is_open)
|
35
35
|
end
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
50
55
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
55
62
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
else
|
62
|
-
begin
|
63
|
-
CDTProxy[*styles]
|
64
|
-
rescue
|
65
|
-
begin
|
66
|
-
SWTProxy[*styles]
|
67
|
-
rescue
|
68
|
-
DNDProxy[*styles]
|
69
|
-
end
|
70
|
-
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'
|
71
68
|
end
|
72
69
|
end
|
73
|
-
|
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
|
+
|
74
91
|
end
|
75
92
|
|
76
93
|
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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-cw-cdatetime-nebula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0.2.
|
4
|
+
version: 1.4.0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
@@ -15,7 +15,7 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 0.6.
|
18
|
+
version: 0.6.9
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 2.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.6.
|
29
|
+
version: 0.6.9
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.0.0
|
@@ -86,9 +86,8 @@ dependencies:
|
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
-
description: Nebula CDateTime Widget - Glimmer Custom Widget - A Date and Time
|
90
|
-
widget that can be used in a
|
91
|
-
style.
|
89
|
+
description: Nebula CDateTime Widget 1.4.0 - Glimmer Custom Widget - A Date and Time
|
90
|
+
selection widget that can be used in a simple, dropdown, spinner, or compact style.
|
92
91
|
email: andy.am@gmail.com
|
93
92
|
executables: []
|
94
93
|
extensions: []
|
@@ -129,5 +128,5 @@ requirements: []
|
|
129
128
|
rubygems_version: 3.0.6
|
130
129
|
signing_key:
|
131
130
|
specification_version: 4
|
132
|
-
summary: Nebula CDateTime Widget - Glimmer Custom Widget
|
131
|
+
summary: Nebula CDateTime Widget 1.4.0 - Glimmer Custom Widget
|
133
132
|
test_files: []
|