limelight 0.2.0-java → 0.2.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. data/bin/limelight +2 -3
  2. data/lib/limelight.jar +0 -0
  3. data/lib/limelight/animation.rb +32 -12
  4. data/lib/limelight/build_exception.rb +3 -0
  5. data/lib/limelight/builtin/players/button.rb +17 -2
  6. data/lib/limelight/builtin/players/check_box.rb +21 -2
  7. data/lib/limelight/builtin/players/combo_box.rb +31 -3
  8. data/lib/limelight/builtin/players/combo_box_popup_list.rb +1 -1
  9. data/lib/limelight/builtin/players/combo_box_popup_list_item.rb +1 -1
  10. data/lib/limelight/builtin/players/curtains.rb +1 -1
  11. data/lib/limelight/builtin/players/radio_button.rb +27 -3
  12. data/lib/limelight/builtin/players/text_area.rb +11 -2
  13. data/lib/limelight/builtin/players/text_box.rb +11 -2
  14. data/lib/limelight/button_group_cache.rb +2 -2
  15. data/lib/limelight/casting_director.rb +6 -1
  16. data/lib/limelight/commands.rb +10 -24
  17. data/lib/limelight/file_chooser.rb +16 -3
  18. data/lib/limelight/file_filter.rb +10 -3
  19. data/lib/limelight/java_couplings.rb +11 -10
  20. data/lib/limelight/java_util.rb +36 -3
  21. data/lib/limelight/limelight_exception.rb +3 -1
  22. data/lib/limelight/loaders/file_scene_loader.rb +1 -1
  23. data/lib/limelight/main.rb +108 -0
  24. data/lib/limelight/menu_bar.rb +31 -12
  25. data/lib/limelight/paint_action.rb +4 -2
  26. data/lib/limelight/pen.rb +39 -9
  27. data/lib/limelight/producer.rb +35 -7
  28. data/lib/limelight/production.rb +18 -9
  29. data/lib/limelight/production_builder.rb +22 -5
  30. data/lib/limelight/prop.rb +127 -45
  31. data/lib/limelight/prop_builder.rb +70 -11
  32. data/lib/limelight/scene.rb +25 -21
  33. data/lib/limelight/stage.rb +68 -18
  34. data/lib/limelight/stage_builder.rb +68 -27
  35. data/lib/limelight/styles.rb +327 -30
  36. data/lib/limelight/styles_builder.rb +91 -21
  37. data/lib/limelight/theater.rb +23 -11
  38. data/lib/limelight/util.rb +28 -6
  39. data/lib/limelight/version.rb +1 -1
  40. data/productions/startup/players/browse_button.rb +1 -1
  41. data/spec/builtin/players/check_box_spec.rb +1 -1
  42. data/spec/builtin/players/radio_button_spec.rb +2 -2
  43. data/spec/builtin/players/text_area_spec.rb +1 -1
  44. data/spec/builtin/players/text_box_spec.rb +1 -1
  45. data/spec/commands_spec.rb +4 -3
  46. data/spec/prop_builder_spec.rb +40 -29
  47. data/spec/prop_spec.rb +5 -1
  48. data/spec/stage_spec.rb +15 -15
  49. data/spec/styles_spec.rb +36 -0
  50. data/spec/theater_spec.rb +8 -8
  51. metadata +6 -3
data/bin/limelight CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env jruby
2
2
  require File.expand_path(File.dirname(__FILE__) + "/../lib/init")
3
- require 'limelight/commands'
4
-
5
- Limelight::Commands.run(ARGV)
3
+ require 'limelight/main'
6
4
 
5
+ Limelight::Main.run(ARGV)
data/lib/limelight.jar CHANGED
Binary file
@@ -1,20 +1,40 @@
1
1
  #- Copyright 2008 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
- class Animation < Limelight::AnimationTask
4
+ module Limelight
5
5
 
6
- def initialize(prop, block, options={})
7
- @block = block
8
- name = options[:name] || "#{prop.to_s} animation"
9
- updates_per_second = options[:updates_per_second] || 60
10
- super(name, updates_per_second, prop.panel)
11
- end
6
+ # An object to manage a seqeunce of changes, assuably to a prop. The Animation object is constructed with options
7
+ # and a block. Once the Animation is started, the block is invoked repeatedly until the Animation is stopped.
8
+ #
9
+ # Although, this object does not update the screen, it provides a means to perform sequential updates in evenly
10
+ # spaced time frames.
11
+ #
12
+ class Animation < Limelight::AnimationTask
13
+
14
+ # A Prop and block are required to construct an Animation. Options may include :name (string), :updates_per_second
15
+ # (int defaults to 60)
16
+ #
17
+ # animation = Animation.new(prop, Proc.new { "do something"}, :updates_per_second => 20)
18
+ # animation.start
19
+ # # time passes
20
+ # animation.stop
21
+ #
22
+ def initialize(prop, block, options={})
23
+ @block = block
24
+ name = options[:name] || "#{prop.to_s} animation"
25
+ updates_per_second = options[:updates_per_second] || 60
26
+ super(name, updates_per_second, prop.panel)
27
+ end
12
28
 
13
- def doPerform
14
- @block.call
15
- end
29
+ def doPerform #:nodoc:
30
+ @block.call
31
+ end
16
32
 
17
- def running?
18
- return is_running
33
+ # Lets you know if the animation is currently running or not.
34
+ #
35
+ def running?
36
+ return is_running
37
+ end
19
38
  end
39
+
20
40
  end
@@ -2,6 +2,9 @@
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  module Limelight
5
+
6
+ # An Exception used by many of the DSL Builders. Allows nice errors messages, with line numbers, to be printed.
7
+ #
5
8
  class BuildException < Exception
6
9
 
7
10
  attr_reader :filename, :line_number
@@ -5,17 +5,32 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
+ # A Builtin Player that adds the look and behavior of a native button. It may be applied in the PropBuilder DSL
9
+ # like so:
10
+ #
11
+ # my_button :players => "button"
12
+ #
13
+ # Props including this Player should implement the button_pressed hook.
14
+ #
15
+ # def button_pressed(e)
16
+ # # do something
17
+ # end
18
+ #
19
+ # Props including this Player may implement any of the key and focus event hooks:
20
+ #
21
+ # key_pressed, key_typed, key_released, focus_gained, focus_lost
22
+ #
8
23
  module Button
9
24
  class << self
10
25
 
11
- def extended(prop)
26
+ def extended(prop) #:nodoc:
12
27
  button = Limelight::UI::Model::Inputs::ButtonPanel.new
13
28
  prop.panel.add(button)
14
29
  prop.button = button.button
15
30
  end
16
31
  end
17
32
 
18
- attr_accessor :button
33
+ attr_accessor :button #:nodoc:
19
34
 
20
35
  end
21
36
 
@@ -5,21 +5,40 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
+ # A Builtin Player that adds the look and behavior of a native check box. It may be applied in the PropBuilder DSL
9
+ # like so:
10
+ #
11
+ # my_check_box :players => "check_box"
12
+ #
13
+ # Props including this Player may implement the button_pressed hook.
14
+ #
15
+ # def button_pressed(e)
16
+ # # do something
17
+ # end
18
+ #
19
+ # Props including this Player may implement any of the key and focus event hooks:
20
+ #
21
+ # key_pressed, key_typed, key_released, focus_gained, focus_lost
22
+ #
8
23
  module CheckBox
9
24
  class << self
10
- def extended(prop)
25
+ def extended(prop) #:nodoc:
11
26
  check_box = Limelight::UI::Model::Inputs::CheckBoxPanel.new
12
27
  prop.panel.add(check_box)
13
28
  prop.check_box = check_box.check_box
14
29
  end
15
30
  end
16
31
 
17
- attr_accessor :check_box
32
+ attr_accessor :check_box #:nodoc:
18
33
 
34
+ # Will place or remove a check mark in the check box.
35
+ #
19
36
  def checked=(value)
20
37
  check_box.selected = value
21
38
  end
22
39
 
40
+ # Returns true if the check box is checked.
41
+ #
23
42
  def checked
24
43
  return check_box.selected?
25
44
  end
@@ -5,17 +5,41 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
+ # A Builtin Player that adds the look and behavior of a native combo box. It may be applied in the PropBuilder DSL
9
+ # like so:
10
+ #
11
+ # my_button :players => "combo_box"
12
+ #
13
+ # Props including this Player must not override the mouse_pressed event.
14
+ #
15
+ # Props including this Player may implement an additional hook:
16
+ #
17
+ # def value_changed(e)
18
+ # # do something
19
+ # end
20
+ #
21
+ # Props including this Player may implement any of the key and focus event hooks:
22
+ #
23
+ # key_pressed, key_typed, key_released, focus_gained, focus_lost
24
+ #
8
25
  module ComboBox
26
+
9
27
  class << self
10
- def extended(prop)
28
+ def extended(prop) #:nodoc:
11
29
  combo_box = Limelight::UI::Model::Inputs::ComboBoxPanel.new
12
30
  prop.panel.add(combo_box)
13
31
  prop.combo_box = combo_box.combo_box
14
32
  end
15
33
  end
16
34
 
17
- attr_accessor :combo_box
35
+ attr_accessor :combo_box #:nodoc:
18
36
 
37
+ # Sets the choices listed in the combo_box. The value parameter should an Array or a String that
38
+ # can be evalulated into an Array. All choices in a combo_box are strings.
39
+ #
40
+ # combo_box.choices = ["one", "two", "three"]
41
+ # combo_box.choices = "['one', 'two', 'three']"
42
+ #
19
43
  def choices=(value)
20
44
  value = eval(value) if value.is_a? String
21
45
  raise "Invalid choices type: #{value.class}. Choices have to be an array." if !value.is_a?(Array)
@@ -24,15 +48,19 @@ module Limelight
24
48
  value.each { |choice| combo_box.add_item(choice) }
25
49
  end
26
50
 
51
+ # Sets the value of the combo box. The value provided should be one choices in the combo box.
52
+ #
27
53
  def value=(text)
28
54
  self.text = text
29
55
  end
30
56
 
57
+ # Returns the value of the currently selected choice.
58
+ #
31
59
  def value
32
60
  return self.text
33
61
  end
34
62
 
35
- def mouse_pressed(e)
63
+ def mouse_pressed(e) #:nodoc:
36
64
  curtains = Limelight::Prop.new(:name => "limelight_builtin_players_curtains", :players => "curtains")
37
65
 
38
66
  popup_list = Limelight::Prop.new(:name => "limelight_builtin_players_combo_box_popup_list", :players => "combo_box_popup_list", :curtains => curtains)
@@ -5,7 +5,7 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
- module ComboBoxPopupList
8
+ module ComboBoxPopupList #:nodoc:
9
9
 
10
10
  attr_accessor :curtains
11
11
 
@@ -5,7 +5,7 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
- module ComboBoxPopupListItem
8
+ module ComboBoxPopupListItem #:nodoc:
9
9
 
10
10
  attr_accessor :combo_box
11
11
 
@@ -5,7 +5,7 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
- module Curtains
8
+ module Curtains #:nodoc:
9
9
 
10
10
  def open
11
11
  scene.remove(self)
@@ -5,28 +5,52 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
+ # A Builtin Player that adds the look and behavior of a native radio button. It may be applied in the PropBuilder DSL
9
+ # like so:
10
+ #
11
+ # my_radio_button :players => "radio_button", :id => "radio1", :group => "my_radio_button_group"
12
+ #
13
+ # When including this Player, it's important to specify a group and id. All radio buttons in the same group will
14
+ # be mutually exclusive. The value of a radio button group will be the id of the selected radio button.
15
+ #
16
+ # Props including this Player may implement the button_pressed hook.
17
+ #
18
+ # def button_pressed(e)
19
+ # # do something
20
+ # end
21
+ #
22
+ # Props including this Player may implement any of the key and focus event hooks:
23
+ #
24
+ # key_pressed, key_typed, key_released, focus_gained, focus_lost
25
+ #
8
26
  module RadioButton
9
27
  class << self
10
- def extended(prop)
28
+ def extended(prop) #:nodoc:
11
29
  radio_button = Limelight::UI::Model::Inputs::RadioButtonPanel.new
12
30
  prop.panel.add(radio_button)
13
31
  prop.radio_button = radio_button.radio_button
14
32
  end
15
33
  end
16
34
 
17
- attr_accessor :radio_button
18
- attr_reader :button_group
35
+ attr_accessor :radio_button #:nodoc:
36
+ attr_reader :button_group #:nodoc:
19
37
 
38
+ # Sets the radio button group to which this radio button belongs.
39
+ #
20
40
  def group=(group_name)
21
41
  @button_group = scene.button_groups[group_name]
22
42
  @button_group.add(@radio_button)
23
43
  end
24
44
 
45
+ # Checks or unchecks this radio button.
46
+ #
25
47
  def checked=(value)
26
48
  @radio_button.selected = value
27
49
  end
28
50
  alias :selected= :checked=
29
51
 
52
+ # Returns true is this radio is button is checked.
53
+ #
30
54
  def checked
31
55
  return @radio_button.is_selected
32
56
  end
@@ -5,10 +5,19 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
+ # A Builtin Player that adds the look and behavior of a native text area. It may be applied in the PropBuilder DSL
9
+ # like so:
10
+ #
11
+ # my_text_area :players => "text_area"
12
+ #
13
+ # Props including this Player may implement any of the key and focus event hooks:
14
+ #
15
+ # key_pressed, key_typed, key_released, focus_gained, focus_lost
16
+ #
8
17
  module TextArea
9
18
  class << self
10
19
 
11
- def extended(prop)
20
+ def extended(prop) #:nodoc:
12
21
  text_area = Limelight::UI::Model::Inputs::TextAreaPanel.new
13
22
  prop.panel.add(text_area)
14
23
  prop.text_area = text_area.text_area
@@ -16,7 +25,7 @@ module Limelight
16
25
 
17
26
  end
18
27
 
19
- attr_accessor :text_area
28
+ attr_accessor :text_area #:nodoc:
20
29
 
21
30
  end
22
31
 
@@ -5,10 +5,19 @@ module Limelight
5
5
  module Builtin
6
6
  module Players
7
7
 
8
+ # A Builtin Player that adds the look and behavior of a native text box. It may be applied in the PropBuilder DSL
9
+ # like so:
10
+ #
11
+ # my_text_box :players => "text_box"
12
+ #
13
+ # Props including this Player may implement any of the key and focus event hooks:
14
+ #
15
+ # key_pressed, key_typed, key_released, focus_gained, focus_lost
16
+ #
8
17
  module TextBox
9
18
  class << self
10
19
 
11
- def extended(prop)
20
+ def extended(prop) #:nodoc:
12
21
  text_box = Limelight::UI::Model::Inputs::TextBoxPanel.new
13
22
  prop.panel.add(text_box)
14
23
  prop.text_box = text_box.text_box
@@ -16,7 +25,7 @@ module Limelight
16
25
 
17
26
  end
18
27
 
19
- attr_accessor :text_box
28
+ attr_accessor :text_box #:nodoc:
20
29
 
21
30
  end
22
31
 
@@ -2,8 +2,8 @@
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  module Limelight
5
- ButtonGroupCache = UI::ButtonGroupCache
6
- class ButtonGroupCache
5
+ ButtonGroupCache = UI::ButtonGroupCache #:nodoc:
6
+ class ButtonGroupCache #:nodoc:
7
7
  def [](key)
8
8
  return self.get(key)
9
9
  end
@@ -4,7 +4,12 @@
4
4
  require 'limelight/builtin/players'
5
5
 
6
6
  module Limelight
7
-
7
+
8
+ # The CastingDirector is responsible for finding Players for Props within a Production.
9
+ # Each Producer has an instance of a CastingDirector
10
+ #
11
+ # Users of Limelight need not be concerned with this class.
12
+ #
8
13
  class CastingDirector
9
14
 
10
15
  def initialize(loader)
@@ -1,14 +1,18 @@
1
1
  #- Copyright 2008 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
- require 'optparse'
5
-
6
4
  module Limelight
7
5
 
8
6
  DEFAULT_PRODUCTION = File.expand_path(File.dirname(__FILE__) + "/../../productions/startup")
9
7
 
8
+ # Commands used in the Main method.
9
+ #
10
10
  module Commands
11
11
 
12
+ # Opens a Production
13
+ #
14
+ # jruby -S limelight open <production_name>
15
+ #
12
16
  class OpenProduction
13
17
  def self.description
14
18
  return "Open a limelight production or scene."
@@ -22,6 +26,10 @@ module Limelight
22
26
  end
23
27
  end
24
28
 
29
+ # Compresses the specified Production into a single .llp file.
30
+ #
31
+ # jruby -S limelight pack <production_name>
32
+ #
25
33
  class PackProduction
26
34
  def self.description
27
35
  return "Pack the designated limelight production into a .llp file."
@@ -38,28 +46,6 @@ module Limelight
38
46
  "pack" => PackProduction
39
47
  }
40
48
 
41
- class << self
42
- def run(args)
43
- command_name = args.shift
44
- command = COMMANDS[command_name]
45
- if command
46
- command.new.run(args)
47
- else
48
- usage
49
- end
50
- end
51
-
52
- def usage
53
- puts "Usage: limelight <command> [options] [params]"
54
- puts "commands:"
55
- COMMANDS.keys.sort.each do |key|
56
- command = COMMANDS[key]
57
- puts "\t#{key}\t\t#{command.description}"
58
- end
59
- end
60
- end
61
-
62
-
63
49
  end
64
50
 
65
51