glimmer-dsl-opal 0.9.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +50 -43
  5. data/VERSION +1 -1
  6. data/lib/display.rb +1 -1
  7. data/lib/glimmer-dsl-opal.rb +2 -1
  8. data/lib/glimmer-dsl-opal/ext/file.rb +1 -1
  9. data/lib/glimmer-dsl-opal/ext/glimmer/dsl/engine.rb +3 -2
  10. data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact_repository.rb +4 -4
  11. data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +1 -1
  12. data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +1 -1
  13. data/lib/glimmer-dsl-opal/samples/hello/hello_button.rb +1 -1
  14. data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +1 -1
  15. data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +1 -1
  16. data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +1 -1
  17. data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +1 -1
  18. data/lib/glimmer-dsl-opal/samples/hello/hello_computed/contact.rb +1 -1
  19. data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +1 -1
  20. data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +1 -1
  21. data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +1 -1
  22. data/lib/glimmer-dsl-opal/samples/hello/hello_dialog.rb +78 -0
  23. data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +1 -1
  24. data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +1 -1
  25. data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +1 -1
  26. data/lib/glimmer-dsl-opal/samples/hello/hello_menu_bar.rb +1 -1
  27. data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +1 -1
  28. data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +1 -1
  29. data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +1 -1
  30. data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +1 -1
  31. data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +1 -1
  32. data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +1 -1
  33. data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +1 -1
  34. data/lib/glimmer-dsl-swt.rb +1 -1
  35. data/lib/glimmer/dsl/opal/async_exec_expression.rb +1 -1
  36. data/lib/glimmer/dsl/opal/block_property_expression.rb +1 -1
  37. data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +1 -1
  38. data/lib/glimmer/dsl/opal/color_expression.rb +1 -1
  39. data/lib/glimmer/dsl/opal/custom_widget_expression.rb +1 -1
  40. data/lib/glimmer/dsl/opal/dialog_expression.rb +20 -0
  41. data/lib/glimmer/dsl/opal/display_expression.rb +1 -1
  42. data/lib/glimmer/dsl/opal/dsl.rb +1 -1
  43. data/lib/glimmer/dsl/opal/exec_expression.rb +1 -1
  44. data/lib/glimmer/dsl/opal/font_expression.rb +1 -1
  45. data/lib/glimmer/dsl/opal/menu_bar_expression.rb +1 -1
  46. data/lib/glimmer/dsl/opal/menu_expression.rb +1 -1
  47. data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +1 -1
  48. data/lib/glimmer/dsl/opal/rgb_expression.rb +1 -1
  49. data/lib/glimmer/dsl/opal/rgba_expression.rb +1 -1
  50. data/lib/glimmer/dsl/opal/swt_expression.rb +4 -4
  51. data/lib/glimmer/dsl/opal/sync_exec_expression.rb +1 -1
  52. data/lib/glimmer/swt.rb +1 -1
  53. data/lib/glimmer/swt/color_proxy.rb +1 -1
  54. data/lib/glimmer/swt/control_editor.rb +1 -1
  55. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  56. data/lib/glimmer/swt/custom/radio_group.rb +1 -1
  57. data/lib/glimmer/swt/dialog_proxy.rb +173 -0
  58. data/lib/glimmer/swt/display_proxy.rb +4 -0
  59. data/lib/glimmer/swt/font_proxy.rb +1 -1
  60. data/lib/glimmer/swt/label_proxy.rb +1 -1
  61. data/lib/glimmer/swt/latest_dialog_proxy.rb +42 -0
  62. data/lib/glimmer/swt/latest_message_box_proxy.rb +1 -1
  63. data/lib/glimmer/swt/latest_shell_proxy.rb +1 -1
  64. data/lib/glimmer/swt/layout_data_proxy.rb +4 -0
  65. data/lib/glimmer/swt/make_shift_shell_proxy.rb +1 -1
  66. data/lib/glimmer/swt/menu_item_proxy.rb +1 -1
  67. data/lib/glimmer/swt/menu_proxy.rb +1 -1
  68. data/lib/glimmer/swt/message_box_proxy.rb +3 -7
  69. data/lib/glimmer/swt/row_layout_proxy.rb +22 -2
  70. data/lib/glimmer/swt/shell_proxy.rb +13 -1
  71. data/lib/glimmer/swt/style_constantizable.rb +1 -1
  72. data/lib/glimmer/swt/swt_proxy.rb +1 -1
  73. data/lib/glimmer/swt/tab_folder_proxy.rb +1 -1
  74. data/lib/glimmer/swt/table_editor.rb +1 -1
  75. data/lib/glimmer/swt/table_item_proxy.rb +1 -1
  76. data/lib/glimmer/swt/table_proxy.rb +1 -1
  77. data/lib/glimmer/swt/widget_proxy.rb +3 -2
  78. data/lib/glimmer/ui/custom_shell.rb +1 -1
  79. data/lib/glimmer/ui/custom_widget.rb +1 -1
  80. data/lib/glimmer/util/proc_tracker.rb +1 -1
  81. data/lib/net/http.rb +1 -1
  82. data/lib/os.rb +1 -1
  83. metadata +10 -6
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -17,6 +17,8 @@ module Glimmer
17
17
  :grab_excess_vertical_space,
18
18
  :width_hint,
19
19
  :height_hint
20
+ alias width width_hint
21
+ alias height height_hint
20
22
 
21
23
  def initialize(parent, args)
22
24
  @parent = parent
@@ -35,12 +37,14 @@ module Glimmer
35
37
  @parent.dom_element.css('width', "#{@width_hint}px")
36
38
  # reapply
37
39
  end
40
+ alias width= width_hint=
38
41
 
39
42
  def height_hint=(height_hint)
40
43
  @height_hint = height_hint
41
44
  @parent.dom_element.css('height', "#{@height_hint}px")
42
45
  # reapply
43
46
  end
47
+ alias height= height_hint=
44
48
 
45
49
  def horizontal_alignment=(horizontal_alignment)
46
50
  @horizontal_alignment = horizontal_alignment
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -28,7 +28,7 @@ module Glimmer
28
28
  STYLE = <<~CSS
29
29
  .modal {
30
30
  position: fixed;
31
- z-index: 1;
31
+ z-index: 1000;
32
32
  padding-top: 100px;
33
33
  left: 0;
34
34
  top: 0;
@@ -111,10 +111,6 @@ module Glimmer
111
111
  Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Opal::MessageBoxExpression.new, &block)
112
112
  end
113
113
 
114
- def name
115
- 'div'
116
- end
117
-
118
114
  def selector
119
115
  super + ' .close'
120
116
  end
@@ -136,7 +132,7 @@ module Glimmer
136
132
  div(id: id, class: "modal #{name}") {
137
133
  div(class: 'modal-content') {
138
134
  header(class: 'text') {
139
- text
135
+ "#{text}&nbsp;" # ensure title area occuppied when there is no text by adding non-breaking space (&nbsp;)
140
136
  }
141
137
  tag(_name: 'p', id: 'message', class: 'message') {
142
138
  html_message
@@ -14,6 +14,16 @@ module Glimmer
14
14
  .row-layout-pack-false {
15
15
  align-items: stretch;
16
16
  }
17
+
18
+ .row-layout-center.row-layout-horizontal > * {
19
+ margin-top: auto;
20
+ margin-bottom: auto;
21
+ }
22
+
23
+ .row-layout-center.row-layout-vertical > * {
24
+ margin-left: auto;
25
+ margin-right: auto;
26
+ }
17
27
 
18
28
  .row-layout-horizontal {
19
29
  flex-direction: row;
@@ -32,7 +42,7 @@ module Glimmer
32
42
  }
33
43
  CSS
34
44
 
35
- attr_reader :type, :margin_width, :margin_height, :margin_top, :margin_right, :margin_bottom, :margin_left, :spacing, :pack
45
+ attr_reader :type, :margin_width, :margin_height, :margin_top, :margin_right, :margin_bottom, :margin_left, :spacing, :pack, :center
36
46
 
37
47
  def initialize(parent, args)
38
48
  super(parent, args)
@@ -67,6 +77,16 @@ module Glimmer
67
77
  end
68
78
  end
69
79
 
80
+ def center=(center_value)
81
+ @center = center_value
82
+ # Using padding for width since margin-right isn't getting respected with width 100%
83
+ if @center
84
+ parent.dom_element.add_class("row-layout-center")
85
+ else
86
+ parent.dom_element.remove_class("row-layout-center")
87
+ end
88
+ end
89
+
70
90
  def margin_width=(pixels)
71
91
  @margin_width = pixels
72
92
  # Using padding for width since margin-right isn't getting respected with width 100%
@@ -101,7 +121,7 @@ module Glimmer
101
121
  @margin_left = pixels
102
122
  @parent.dom_element.css('padding-left', @margin_left)
103
123
  end
104
-
124
+
105
125
  def spacing=(spacing)
106
126
  @spacing = spacing.to_i
107
127
  # TODO implement changes to accomodate layout_data in the future
@@ -24,6 +24,17 @@ module Glimmer
24
24
  width: 100%;
25
25
  height: 100%;
26
26
  }
27
+ .shell .dialog-overlay {
28
+ position: fixed;
29
+ z-index: 10;
30
+ padding-top: 100px;
31
+ left: 0;
32
+ top: 0;
33
+ width: 100%;
34
+ height: 100%;
35
+ overflow: auto;
36
+ background-color: rgba(0,0,0,0.4);
37
+ }
27
38
  CSS
28
39
 
29
40
  # TODO consider renaming to ShellProxy to match SWT API
@@ -98,7 +109,8 @@ module Glimmer
98
109
  }
99
110
  end
100
111
  end
101
- ''
112
+ div(class: 'dialog-overlay hide') {
113
+ }
102
114
  }
103
115
  }.to_s
104
116
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -186,6 +186,7 @@ module Glimmer
186
186
  def path
187
187
  "#{parent_path} #{element}##{id}.#{name}"
188
188
  end
189
+ alias widget_path path # pure path without subchildren modifications
189
190
 
190
191
  # Root element representing widget. Must be overridden by subclasses if different from div
191
192
  def element
@@ -252,7 +253,6 @@ module Glimmer
252
253
  the_parent_dom_element.append(@dom) # TODO make a method attach to allow subclasses to override if needed
253
254
  else
254
255
  old_element.replace_with(@dom)
255
- old_element.replace_with(@dom)
256
256
  end
257
257
  observation_requests&.each do |keyword, event_listener_set|
258
258
  event_listener_set.each do |event_listener|
@@ -896,6 +896,7 @@ require 'glimmer/swt/button_proxy'
896
896
  require 'glimmer/swt/combo_proxy'
897
897
  require 'glimmer/swt/checkbox_proxy'
898
898
  require 'glimmer/swt/composite_proxy'
899
+ require 'glimmer/swt/dialog_proxy'
899
900
  require 'glimmer/swt/date_time_proxy'
900
901
  require 'glimmer/swt/group_proxy'
901
902
  require 'glimmer/swt/label_proxy'
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
data/lib/os.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-09 00:00:00.000000000 Z
11
+ date: 2021-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.5
19
+ version: 1.0.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.5
26
+ version: 1.0.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: glimmer-dsl-xml
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,7 +92,7 @@ dependencies:
92
92
  requirements:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 1.0.1
95
+ version: 1.0.2
96
96
  - - "<"
97
97
  - !ruby/object:Gem::Version
98
98
  version: 2.0.0
@@ -102,7 +102,7 @@ dependencies:
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: 1.0.1
105
+ version: 1.0.2
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
108
  version: 2.0.0
@@ -288,6 +288,7 @@ files:
288
288
  - lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb
289
289
  - lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb
290
290
  - lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb
291
+ - lib/glimmer-dsl-opal/samples/hello/hello_dialog.rb
291
292
  - lib/glimmer-dsl-opal/samples/hello/hello_group.rb
292
293
  - lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb
293
294
  - lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb
@@ -332,6 +333,7 @@ files:
332
333
  - lib/glimmer/dsl/opal/combo_selection_data_binding_expression.rb
333
334
  - lib/glimmer/dsl/opal/custom_widget_expression.rb
334
335
  - lib/glimmer/dsl/opal/data_binding_expression.rb
336
+ - lib/glimmer/dsl/opal/dialog_expression.rb
335
337
  - lib/glimmer/dsl/opal/display_expression.rb
336
338
  - lib/glimmer/dsl/opal/dsl.rb
337
339
  - lib/glimmer/dsl/opal/exec_expression.rb
@@ -367,6 +369,7 @@ files:
367
369
  - lib/glimmer/swt/custom/checkbox_group.rb
368
370
  - lib/glimmer/swt/custom/radio_group.rb
369
371
  - lib/glimmer/swt/date_time_proxy.rb
372
+ - lib/glimmer/swt/dialog_proxy.rb
370
373
  - lib/glimmer/swt/display_proxy.rb
371
374
  - lib/glimmer/swt/event_listener_proxy.rb
372
375
  - lib/glimmer/swt/fill_layout_proxy.rb
@@ -374,6 +377,7 @@ files:
374
377
  - lib/glimmer/swt/grid_layout_proxy.rb
375
378
  - lib/glimmer/swt/group_proxy.rb
376
379
  - lib/glimmer/swt/label_proxy.rb
380
+ - lib/glimmer/swt/latest_dialog_proxy.rb
377
381
  - lib/glimmer/swt/latest_message_box_proxy.rb
378
382
  - lib/glimmer/swt/latest_shell_proxy.rb
379
383
  - lib/glimmer/swt/layout_data_proxy.rb