epall-limelight 0.5.1-java → 0.5.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/lib/init.rb +2 -6
  2. data/lib/limelight.jar +0 -0
  3. data/lib/limelight/builtin/utilities_production/alert/players/alert.rb +4 -1
  4. data/lib/limelight/builtin/utilities_production/production.rb +6 -2
  5. data/lib/limelight/commands/create_command.rb +1 -1
  6. data/lib/limelight/commands/open_command.rb +4 -4
  7. data/lib/limelight/dsl/styles_builder.rb +5 -0
  8. data/lib/limelight/java_couplings.rb +3 -2
  9. data/lib/limelight/limelight_init.rb +12 -0
  10. data/lib/limelight/main.rb +43 -46
  11. data/lib/limelight/producer.rb +54 -13
  12. data/lib/limelight/production.rb +34 -7
  13. data/lib/limelight/scene.rb +1 -1
  14. data/lib/limelight/specs/spec_helper.rb +1 -1
  15. data/lib/limelight/specs/test_scene_opener.rb +3 -0
  16. data/lib/limelight/stage.rb +65 -5
  17. data/lib/limelight/studio.rb +28 -159
  18. data/lib/limelight/styles/style.rb +288 -0
  19. data/lib/limelight/theater.rb +27 -2
  20. data/lib/limelight/version.rb +2 -2
  21. data/productions/examples/sandbox/alerts/players/alerts.rb +1 -1
  22. data/productions/examples/sandbox/stage_handles/players/sizer.rb +3 -0
  23. data/spec/limelight/builtin/players/combo_box_spec.rb +1 -1
  24. data/spec/limelight/builtin/players/radio_button_spec.rb +1 -1
  25. data/spec/limelight/builtin/utilities_production/utilities_production_spec.rb +39 -38
  26. data/spec/limelight/casting_director_spec.rb +1 -1
  27. data/spec/limelight/commands/create_command_spec.rb +4 -4
  28. data/spec/limelight/commands/open_command_spec.rb +5 -4
  29. data/spec/limelight/commands/pack_command_spec.rb +1 -1
  30. data/spec/limelight/commands/unpack_command_spec.rb +1 -1
  31. data/spec/limelight/dsl/prop_builder_spec.rb +6 -6
  32. data/spec/limelight/dsl/stage_builder_spec.rb +1 -1
  33. data/spec/limelight/file_chooser_spec.rb +1 -1
  34. data/spec/limelight/file_filter_spec.rb +2 -2
  35. data/spec/limelight/main_spec.rb +2 -2
  36. data/spec/limelight/paint_action_spec.rb +1 -1
  37. data/spec/limelight/pen_spec.rb +1 -1
  38. data/spec/limelight/producer_spec.rb +30 -11
  39. data/spec/limelight/production_spec.rb +12 -20
  40. data/spec/limelight/prop_spec.rb +2 -2
  41. data/spec/limelight/scene_spec.rb +1 -1
  42. data/spec/limelight/stage_spec.rb +51 -6
  43. data/spec/limelight/templates/templater_spec.rb +1 -1
  44. data/spec/limelight/theater_spec.rb +49 -1
  45. data/spec/spec_helper.rb +0 -6
  46. metadata +5 -7
  47. data/lib/limelight/client/playbills.rb +0 -86
  48. data/lib/limelight/styles.rb +0 -347
  49. data/spec/limelight/client/playbills_spec.rb +0 -79
  50. data/spec/limelight/studio_spec.rb +0 -157
@@ -88,7 +88,7 @@ module Limelight
88
88
  # Creates a new Producer to open the specified Production.
89
89
  #
90
90
  def open_production(production_path)
91
- Thread.new { Studio.open(production_path) }
91
+ Thread.new { Context.instance.studio.open(production_path) }
92
92
  end
93
93
 
94
94
  # Opens the specified Scene on the Stage currently occupied by this Scene.
@@ -34,7 +34,7 @@ module Spec
34
34
  uses_limelight({:scene => scene_name}.merge(options))
35
35
  end
36
36
 
37
- def self.uses_limelight(options, &prop_block)
37
+ def self.uses_limelight(options = {}, &prop_block)
38
38
  include Limelight::Specs::SpecHelper
39
39
 
40
40
  before(:each) do
@@ -1,3 +1,6 @@
1
+ #- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
2
+ #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
+
1
4
  module Limelight
2
5
  module Specs
3
6
  module SpecHelper
@@ -186,6 +186,7 @@ module Limelight
186
186
  # See load_scene
187
187
  #
188
188
  def open(scene)
189
+ @current_scene.visible = false if @current_scene
189
190
  scene.stage = self
190
191
  scene.illuminate
191
192
  load_scene(scene)
@@ -197,16 +198,13 @@ module Limelight
197
198
  # Closes the Stage. It's window will no longer be displayed on the screen.
198
199
  #
199
200
  def close
200
- @theater.stage_closed(self)
201
201
  @frame.close
202
- @current_scene.visible = false if @current_scene
203
- @current_scene = nil
204
202
  end
205
203
 
206
204
  # Loads a scene on the Stage. If the Stage is currently hosting a Scene, the original Scene will be removed and
207
205
  # the new Scene will replace it.
208
206
  #
209
- def load_scene(scene)
207
+ def load_scene(scene)
210
208
  # @frame.setJMenuBar(scene.menu_bar)
211
209
  @frame.load(scene.panel)
212
210
  if (has_static_size?(scene.style))
@@ -233,7 +231,7 @@ module Limelight
233
231
  def alert(message)
234
232
  Thread.new do
235
233
  begin
236
- Studio.utilities_production.alert(message)
234
+ Context.instance.studio.utilities_production.alert(message)
237
235
  rescue StandardError => e
238
236
  puts "Error on alert: #{e}"
239
237
  end
@@ -254,6 +252,68 @@ module Limelight
254
252
  @current_scene = scene
255
253
  end
256
254
 
255
+ # returns true if the stage has been closed. Closed stages may not be reopened.
256
+ #
257
+ def closed?
258
+ return @frame.closed?
259
+ end
260
+
261
+ # Invoked when the stage is being closed.
262
+ # System hook that should NOT be called by you.
263
+ #
264
+ def closing(e)
265
+ end
266
+
267
+ # Invoked when the stage has been closed.
268
+ # System hook that should NOT be called by you.
269
+ #
270
+ def closed(e)
271
+ @current_scene.visible = false if @current_scene
272
+ @current_scene = nil
273
+ @theater.stage_closed(self)
274
+ end
275
+
276
+ # Invoked when the stage has gained focus on the desktop. Only 1 stage my have focus at a time.
277
+ # System hook that should NOT be called by you.
278
+ #
279
+ def focus_gained(e)
280
+ @theater.stage_activated(self)
281
+ end
282
+
283
+ # Invoked when the stage has lost focus on the desktop. Only 1 stage my have focus at a time.
284
+ # System hook that should NOT be called by you.
285
+ #
286
+ def focus_lost(e)
287
+ end
288
+
289
+ # Invoked when the stage has been iconified. This occurs when the stage is no longer visible on the desktop
290
+ # and an icon for the stage has been added to the OS's taskbar or dock.
291
+ # System hook that should NOT be called by you.
292
+ #
293
+ def iconified(e)
294
+ end
295
+
296
+ # Invoked when the stage has been deiconified. This occurs when the icon for the stage has been removed from the
297
+ # taskbar or dock, and the stage is again visible on the desktop.
298
+ # System hook that should NOT be called by you.
299
+ #
300
+ def deiconified(e)
301
+ end
302
+
303
+ # Invoked when the stage has become the active stage on the desktop. Only 1 stage my be active at a time.
304
+ # System hook that should NOT be called by you.
305
+ #
306
+ def activated(e)
307
+ @theater.stage_activated(self)
308
+ end
309
+
310
+ # Invoked when the stage has lost status as the active stage. Only 1 stage my have focus at a time.
311
+ # System hook that should NOT be called by you.
312
+ #
313
+ def deactivated(e)
314
+ @theater.stage_deactivated(self)
315
+ end
316
+
257
317
  protected #############################################
258
318
 
259
319
  def new_frame
@@ -1,184 +1,53 @@
1
1
  #- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
-
4
- require 'limelight/producer'
3
+ raise "studio.rb is present for solely to document it's Java counterpart limelight.Studio. This file should NOT be loaded in the Ruby runtime."
5
4
 
6
5
  module Limelight
7
6
 
8
7
  # A Studio creates Productions. There is only one instance of Studio per Limelight runtime. All open productions
9
- # are opened by the studio.
8
+ # are opened and tracked by the studio.
10
9
  #
11
10
  class Studio
12
11
 
13
- include Limelight::UI::Api::Studio
14
-
15
- class << self
16
-
17
- def install #:nodoc:
18
- Context.instance.studio = instance
19
- end
20
-
21
- def instance #:nodoc:
22
- @studio = self.new if @studio.nil?
23
- return @studio
24
- end
25
-
26
- def index(production) #:nodoc:
27
- @index = [] if @index.nil?
28
- if name_taken?(production.name)
29
- assign_unique_name(production)
30
- elsif production.name.nil?
31
- assign_name_to(production)
32
- else
33
- error_if_duplicate_name(production.name)
34
- end
35
- @index << production
36
- end
37
-
38
- # Returns the production with the specified name that was previously opened but the Studio.
39
- #
40
- def [](name)
41
- return nil if @index.nil?
42
- return @index.find { |production| production.name == name }
43
- end
44
-
45
- def name_taken?(name) #:nodoc:
46
- return self[name] != nil
47
- end
48
-
49
- def reset #:nodoc:
50
- @index = []
51
- @is_shutdown = false
52
- @is_shutting_down = false
53
- @studio = nil
54
- end
55
-
56
- def error_if_duplicate_name(name) #:nodoc:
57
- raise Limelight::LimelightException.new("Production name '#{name}' is already taken") if name_taken?(name)
58
- end
59
-
60
- # Opens the production at the specified path.
61
- #
62
- def open(production_path)
63
- begin
64
- producer = Producer.new(production_path)
65
- production = producer.production
66
- index(production)
67
- producer.open
68
- return production
69
- rescue StandardError => e
70
- alert_and_shutdown(e)
71
- end
72
- end
73
-
74
- # Returns true if all of the open productions allow closing.
75
- #
76
- def should_allow_shutdown
77
- return true if @index.nil?
78
- return @index.all? { |production| production.allow_close? }
79
- end
80
-
81
- # If allowed (should_allow_shutdown), this will close all open productions and shutdown the limelight runtime.
82
- #
83
- def shutdown
84
- return if @is_shutdown || @is_shutting_down
85
- return unless should_allow_shutdown
86
- @is_shutting_down = true
87
- @index.each { |production| production.close } if @index
88
- @utilities_production.close if @utilities_production
89
- @is_shutdown = true
90
- Thread.new { Context.instance().shutdown }
91
- end
92
-
93
- # Called when a production is closed to notify the studio of the event.
94
- #
95
- def production_closed(production)
96
- @index.delete(production) if @index
97
- shutdown if @index && @index.empty?
98
- end
99
-
100
- # Returns an array of all the productions
101
- #
102
- def productions
103
- return @index.nil? ? [] : @index.dup
104
- end
105
-
106
- # Publish the Studio, using DRb, on the specified port.
107
- #
108
- def publish_on_drb(port)
109
- @drb_server = DRb.start_service("druby://0.0.0.0:#{port}", self)
110
- end
111
-
112
- # Returns the utilities production; a production used by limelight.
113
- #
114
- def utilities_production
115
- if @utilities_production == nil
116
- producer = Producer.new(File.join($LIMELIGHT_LIB, "limelight", "builtin", "utilities_production"))
117
- @utilities_production = producer.production
118
- producer.open
119
- end
120
- return @utilities_production
121
- end
122
-
123
- # Returns a hash of all the built-in Limglight Styles
124
- #
125
- def builtin_styles
126
- unless @builtin_styles
127
- builtin_styles_file = File.join($LIMELIGHT_LIB, "limelight", "builtin", "styles.rb")
128
- @builtin_styles = Limelight.build_styles_from_file(builtin_styles_file)
129
- end
130
- return @builtin_styles
131
- end
132
-
133
- private #############################################
12
+ # Opens the production at the specified path.
13
+ #
14
+ def open(production_path)
15
+ end
134
16
 
135
- def assign_unique_name(production) #:nodoc:
136
- count = 2
137
- name = production.name
138
- while name_taken?(name)
139
- name = "#{production.name}_#{count}"
140
- count += 1
141
- end
142
- production.name = name
143
- end
17
+ # Returns the production with the specified name. If the studio never opened a production by that name, nil
18
+ # will be returned.
19
+ #
20
+ def get(name)
21
+ end
144
22
 
145
- def assign_name_to(production) #:nodoc:
146
- count = @index.length + 1
147
- while name_taken?(count.to_s)
148
- count += 1
149
- end
150
- production.name = count.to_s
151
- end
23
+ # Returns true if all of the open productions allow closing.
24
+ #
25
+ def should_allow_shutdown
26
+ end
152
27
 
153
- def alert_and_shutdown(e)
154
- begin
155
- message = "#{e}\n#{e.backtrace.join("\n")}"
156
- utilities_production.alert(message)
157
- shutdown if @index.nil? || @index.empty?
158
- rescue Exception => e
159
- puts e
160
- puts e.backtrace
161
- end
162
- end
28
+ # If allowed (should_allow_shutdown), this will close all open productions and shutdown the limelight runtime.
29
+ #
30
+ def shutdown
31
+ end
163
32
 
33
+ # Called when a production is closed to notify the studio of the event. Developers should not need to call this method.
34
+ #
35
+ def production_closed(production)
164
36
  end
165
37
 
166
- # Same as the class level method.
38
+ # Returns a list of all the productions
167
39
  #
168
- def open(production_path)
169
- self.class.open(production_path)
40
+ def productions
170
41
  end
171
42
 
172
- # Same as the class level method.
43
+ # Returns the utilities production; a production used by limelight.
173
44
  #
174
- def should_allow_shutdown
175
- return self.class.should_allow_shutdown
45
+ def utilities_production
176
46
  end
177
47
 
178
- # Same as the class level method.
48
+ # Returns true if the Studio has been shutdown. ie. The procees is exiting.
179
49
  #
180
- def shutdown
181
- self.class.shutdown()
50
+ def shutdown?
182
51
  end
183
52
  end
184
53
 
@@ -0,0 +1,288 @@
1
+ raise "studio.rb is present for solely to document it's Java counterpart limelight.Studio. This file should NOT be loaded in the Ruby runtime."
2
+
3
+ module Limelight
4
+ module Styles
5
+ class Style
6
+ # Specifies the Width attribute of a prop.
7
+ # type: dimension
8
+ # default_value: auto
9
+ attr_accessor :width
10
+
11
+ # Specifies the Height attribute of a prop.
12
+ # type: dimension
13
+ # default_value: auto
14
+ attr_accessor :height
15
+
16
+ # Specifies the Min Width attribute of a prop.
17
+ # type: noneable simple dimension
18
+ # default_value: none
19
+ attr_accessor :min_width
20
+
21
+ # Specifies the Min Height attribute of a prop.
22
+ # type: noneable simple dimension
23
+ # default_value: none
24
+ attr_accessor :min_height
25
+
26
+ # Specifies the Max Width attribute of a prop.
27
+ # type: noneable simple dimension
28
+ # default_value: none
29
+ attr_accessor :max_width
30
+
31
+ # Specifies the Max Height attribute of a prop.
32
+ # type: noneable simple dimension
33
+ # default_value: none
34
+ attr_accessor :max_height
35
+
36
+ # Specifies the Vertical Scrollbar attribute of a prop.
37
+ # type: on/off
38
+ # default_value: off
39
+ attr_accessor :vertical_scrollbar
40
+
41
+ # Specifies the Horizontal Scrollbar attribute of a prop.
42
+ # type: on/off
43
+ # default_value: off
44
+ attr_accessor :horizontal_scrollbar
45
+
46
+ # Specifies the Top Border Color attribute of a prop.
47
+ # type: color
48
+ # default_value: #000000ff
49
+ attr_accessor :top_border_color
50
+
51
+ # Specifies the Right Border Color attribute of a prop.
52
+ # type: color
53
+ # default_value: #000000ff
54
+ attr_accessor :right_border_color
55
+
56
+ # Specifies the Bottom Border Color attribute of a prop.
57
+ # type: color
58
+ # default_value: #000000ff
59
+ attr_accessor :bottom_border_color
60
+
61
+ # Specifies the Left Border Color attribute of a prop.
62
+ # type: color
63
+ # default_value: #000000ff
64
+ attr_accessor :left_border_color
65
+
66
+ # Specifies the Top Border Width attribute of a prop.
67
+ # type: pixels
68
+ # default_value: 0
69
+ attr_accessor :top_border_width
70
+
71
+ # Specifies the Right Border Width attribute of a prop.
72
+ # type: pixels
73
+ # default_value: 0
74
+ attr_accessor :right_border_width
75
+
76
+ # Specifies the Bottom Border Width attribute of a prop.
77
+ # type: pixels
78
+ # default_value: 0
79
+ attr_accessor :bottom_border_width
80
+
81
+ # Specifies the Left Border Width attribute of a prop.
82
+ # type: pixels
83
+ # default_value: 0
84
+ attr_accessor :left_border_width
85
+
86
+ # Specifies the Top Margin attribute of a prop.
87
+ # type: pixels
88
+ # default_value: 0
89
+ attr_accessor :top_margin
90
+
91
+ # Specifies the Right Margin attribute of a prop.
92
+ # type: pixels
93
+ # default_value: 0
94
+ attr_accessor :right_margin
95
+
96
+ # Specifies the Bottom Margin attribute of a prop.
97
+ # type: pixels
98
+ # default_value: 0
99
+ attr_accessor :bottom_margin
100
+
101
+ # Specifies the Left Margin attribute of a prop.
102
+ # type: pixels
103
+ # default_value: 0
104
+ attr_accessor :left_margin
105
+
106
+ # Specifies the Top Padding attribute of a prop.
107
+ # type: pixels
108
+ # default_value: 0
109
+ attr_accessor :top_padding
110
+
111
+ # Specifies the Right Padding attribute of a prop.
112
+ # type: pixels
113
+ # default_value: 0
114
+ attr_accessor :right_padding
115
+
116
+ # Specifies the Bottom Padding attribute of a prop.
117
+ # type: pixels
118
+ # default_value: 0
119
+ attr_accessor :bottom_padding
120
+
121
+ # Specifies the Left Padding attribute of a prop.
122
+ # type: pixels
123
+ # default_value: 0
124
+ attr_accessor :left_padding
125
+
126
+ # Specifies the Background Color attribute of a prop.
127
+ # type: color
128
+ # default_value: #00000000
129
+ attr_accessor :background_color
130
+
131
+ # Specifies the Secondary Background Color attribute of a prop.
132
+ # type: color
133
+ # default_value: #00000000
134
+ attr_accessor :secondary_background_color
135
+
136
+ # Specifies the Background Image attribute of a prop.
137
+ # type: noneable string
138
+ # default_value: none
139
+ attr_accessor :background_image
140
+
141
+ # Specifies the Background Image Fill Strategy attribute of a prop.
142
+ # type: fill strategy
143
+ # default_value: repeat
144
+ attr_accessor :background_image_fill_strategy
145
+
146
+ # Specifies the Gradient attribute of a prop.
147
+ # type: on/off
148
+ # default_value: off
149
+ attr_accessor :gradient
150
+
151
+ # Specifies the Gradient Angle attribute of a prop.
152
+ # type: degrees
153
+ # default_value: 90
154
+ attr_accessor :gradient_angle
155
+
156
+ # Specifies the Gradient Penetration attribute of a prop.
157
+ # type: percentage
158
+ # default_value: 100%
159
+ attr_accessor :gradient_penetration
160
+
161
+ # Specifies the Cyclic Gradient attribute of a prop.
162
+ # type: on/off
163
+ # default_value: off
164
+ attr_accessor :cyclic_gradient
165
+
166
+ # Specifies the Horizontal Alignment attribute of a prop.
167
+ # type: horizontal alignment
168
+ # default_value: left
169
+ attr_accessor :horizontal_alignment
170
+
171
+ # Specifies the Vertical Alignment attribute of a prop.
172
+ # type: vertical alignment
173
+ # default_value: top
174
+ attr_accessor :vertical_alignment
175
+
176
+ # Specifies the Text Color attribute of a prop.
177
+ # type: color
178
+ # default_value: #000000ff
179
+ attr_accessor :text_color
180
+
181
+ # Specifies the Font Face attribute of a prop.
182
+ # type: string
183
+ # default_value: Arial
184
+ attr_accessor :font_face
185
+
186
+ # Specifies the Font Size attribute of a prop.
187
+ # type: integer
188
+ # default_value: 12
189
+ attr_accessor :font_size
190
+
191
+ # Specifies the Font Style attribute of a prop.
192
+ # type: font style
193
+ # default_value: plain
194
+ attr_accessor :font_style
195
+
196
+ # Specifies the Transparency attribute of a prop.
197
+ # type: percentage
198
+ # default_value: 0%
199
+ attr_accessor :transparency
200
+
201
+ # Specifies the Top Right Rounded Corner Radius attribute of a prop.
202
+ # type: pixels
203
+ # default_value: 0
204
+ attr_accessor :top_right_rounded_corner_radius
205
+
206
+ # Specifies the Bottom Right Rounded Corner Radius attribute of a prop.
207
+ # type: pixels
208
+ # default_value: 0
209
+ attr_accessor :bottom_right_rounded_corner_radius
210
+
211
+ # Specifies the Bottom Left Rounded Corner Radius attribute of a prop.
212
+ # type: pixels
213
+ # default_value: 0
214
+ attr_accessor :bottom_left_rounded_corner_radius
215
+
216
+ # Specifies the Top Left Rounded Corner Radius attribute of a prop.
217
+ # type: pixels
218
+ # default_value: 0
219
+ attr_accessor :top_left_rounded_corner_radius
220
+
221
+ # Specifies the Top Right Border Width attribute of a prop.
222
+ # type: pixels
223
+ # default_value: 0
224
+ attr_accessor :top_right_border_width
225
+
226
+ # Specifies the Bottom Right Border Width attribute of a prop.
227
+ # type: pixels
228
+ # default_value: 0
229
+ attr_accessor :bottom_right_border_width
230
+
231
+ # Specifies the Bottom Left Border Width attribute of a prop.
232
+ # type: pixels
233
+ # default_value: 0
234
+ attr_accessor :bottom_left_border_width
235
+
236
+ # Specifies the Top Left Border Width attribute of a prop.
237
+ # type: pixels
238
+ # default_value: 0
239
+ attr_accessor :top_left_border_width
240
+
241
+ # Specifies the Top Right Border Color attribute of a prop.
242
+ # type: color
243
+ # default_value: #000000ff
244
+ attr_accessor :top_right_border_color
245
+
246
+ # Specifies the Bottom Right Border Color attribute of a prop.
247
+ # type: color
248
+ # default_value: #000000ff
249
+ attr_accessor :bottom_right_border_color
250
+
251
+ # Specifies the Bottom Left Border Color attribute of a prop.
252
+ # type: color
253
+ # default_value: #000000ff
254
+ attr_accessor :bottom_left_border_color
255
+
256
+ # Specifies the Top Left Border Color attribute of a prop.
257
+ # type: color
258
+ # default_value: #000000ff
259
+ attr_accessor :top_left_border_color
260
+
261
+ # Specifies the Float attribute of a prop.
262
+ # type: on/off
263
+ # default_value: off
264
+ attr_accessor :float
265
+
266
+ # Specifies the X attribute of a prop.
267
+ # type: x-coordinate
268
+ # default_value: 0
269
+ attr_accessor :x
270
+
271
+ # Specifies the Y attribute of a prop.
272
+ # type: y-coordinate
273
+ # default_value: 0
274
+ attr_accessor :y
275
+
276
+ # Specifies the Background Image X attribute of a prop.
277
+ # type: x-coordinate
278
+ # default_value: 0
279
+ attr_accessor :background_image_x
280
+
281
+ # Specifies the Background Image Y attribute of a prop.
282
+ # type: y-coordinate
283
+ # default_value: 0
284
+ attr_accessor :background_image_y
285
+
286
+ end
287
+ end
288
+ end