rsence 2.0.0.10.pre → 2.0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. data/.yardopts +10 -0
  2. data/INSTALL.rdoc +52 -86
  3. data/{LICENSE → LICENSE.txt} +0 -0
  4. data/README.rdoc +52 -49
  5. data/VERSION +1 -1
  6. data/bin/rsence +4 -6
  7. data/conf/default_conf.yaml +314 -305
  8. data/conf/default_strings.yaml +70 -71
  9. data/docs/ExampleGuiPlugin.rdoc +193 -0
  10. data/{js/comm/comm/autosync/js.inc → docs/JavascriptBundles.rdoc} +0 -0
  11. data/docs/PluginBundleInfo.rdoc +173 -0
  12. data/docs/PluginBundles.rdoc +96 -0
  13. data/docs/Values.rdoc +163 -0
  14. data/js/comm/{comm/autosync → autosync}/autosync.js +1 -2
  15. data/js/comm/{comm → autosync}/js.inc +0 -0
  16. data/js/comm/{comm/comm.js → comm.js} +1 -0
  17. data/js/comm/{comm/queue/js.inc → js.inc} +0 -0
  18. data/js/comm/jsloader/jsloader.js +2 -4
  19. data/js/comm/{comm/session → queue}/js.inc +0 -0
  20. data/js/comm/{comm/queue → queue}/queue.js +1 -0
  21. data/js/comm/{comm/sessionwatcher → session}/js.inc +0 -0
  22. data/js/comm/{comm/session → session}/session.js +4 -3
  23. data/js/comm/{comm/transporter → sessionwatcher}/js.inc +0 -0
  24. data/js/comm/{comm/sessionwatcher → sessionwatcher}/sessionwatcher.js +1 -0
  25. data/js/comm/{comm/urlresponder → transporter}/js.inc +0 -0
  26. data/js/comm/{comm/transporter → transporter}/transporter.js +1 -0
  27. data/js/comm/{comm/values → urlresponder}/js.inc +0 -0
  28. data/js/comm/{comm/urlresponder → urlresponder}/urlresponder.js +1 -0
  29. data/js/comm/{reloadapp → values}/js.inc +0 -0
  30. data/js/comm/{comm/values → values}/values.js +1 -0
  31. data/js/controls/button/button.js +10 -1
  32. data/js/controls/checkbox/checkbox.js +2 -0
  33. data/js/controls/dialogs/alert_sheet/alert_sheet.js +1 -0
  34. data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +1 -0
  35. data/js/controls/dialogs/sheet/sheet.js +1 -0
  36. data/js/controls/imageview/imageview.js +1 -0
  37. data/js/controls/passwordcontrol/passwordcontrol.js +1 -0
  38. data/js/controls/progress/progressbar/progressbar.js +1 -0
  39. data/js/controls/progress/progressindicator/progressindicator.js +1 -0
  40. data/js/controls/radiobutton/radiobutton.js +3 -1
  41. data/js/controls/sliders/slider/slider.js +1 -0
  42. data/js/controls/sliders/vslider/vslider.js +1 -0
  43. data/js/controls/stepper/stepper.js +1 -0
  44. data/js/controls/stringview/stringview.js +2 -2
  45. data/js/controls/tab/tab.js +7 -5
  46. data/js/controls/textarea/textarea.js +1 -0
  47. data/js/controls/textcontrol/textcontrol.js +3 -1
  48. data/js/controls/uploader/uploader.js +1 -0
  49. data/js/controls/validatorview/validatorview.js +62 -59
  50. data/js/controls/window/window.js +1 -0
  51. data/js/core/class/class.js +2 -1
  52. data/js/core/elem/elem.js +27 -27
  53. data/js/core/event/event.js +3 -874
  54. data/js/{comm/sha → core/rsence_ns}/js.inc +0 -0
  55. data/js/core/rsence_ns/rsence_ns.js +15 -0
  56. data/js/{controls/datetime → datetime}/calendar/calendar.js +1 -0
  57. data/js/{comm/values/value → datetime/calendar}/js.inc +0 -0
  58. data/js/{controls/datetime → datetime}/calendar/themes/default/calendar.css +0 -0
  59. data/js/{controls/datetime → datetime}/calendar/themes/default/calendar.html +0 -0
  60. data/js/{controls/datetime → datetime}/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
  61. data/js/{controls/datetime → datetime}/calendar/themes/default/calendar_arrows.png +0 -0
  62. data/js/{controls/datetime → datetime}/datetimevalue/datetimevalue.js +1 -0
  63. data/js/{comm/values/valuematrix → datetime/datetimevalue}/js.inc +0 -0
  64. data/js/{controls/datetime/calendar → datetime/timesheet}/js.inc +0 -0
  65. data/js/{controls/datetime → datetime}/timesheet/themes/default/timesheet.css +0 -0
  66. data/js/{controls/datetime → datetime}/timesheet/themes/default/timesheet.html +0 -0
  67. data/js/{controls/datetime → datetime}/timesheet/timesheet.js +1 -0
  68. data/js/{controls/datetime/datetimevalue → datetime/timesheet_item}/js.inc +0 -0
  69. data/js/{controls/datetime → datetime}/timesheet_item/themes/default/timesheet_item.css +0 -0
  70. data/js/{controls/datetime → datetime}/timesheet_item/themes/default/timesheet_item.html +0 -0
  71. data/js/{controls/datetime → datetime}/timesheet_item/timesheet_item.js +1 -0
  72. data/js/{controls/datetime/timesheet → datetime/timesheet_item_edit}/js.inc +0 -0
  73. data/js/{controls/datetime → datetime}/timesheet_item_edit/timesheet_item_edit.js +1 -1
  74. data/js/foundation/application/application.js +1 -2
  75. data/js/foundation/control/control.js +1 -4
  76. data/js/foundation/control/controldefaults/controldefaults.js +1 -4
  77. data/js/foundation/control/dummyvalue/dummyvalue.js +1 -0
  78. data/js/foundation/control/dyncontrol/dyncontrol.js +1 -2
  79. data/js/foundation/control/eventresponder/eventresponder.js +11 -3
  80. data/js/{controls/datetime/timesheet_item → foundation/control/valuematrix}/js.inc +0 -0
  81. data/js/{comm/values → foundation/control}/valuematrix/valuematrix.js +2 -5
  82. data/js/foundation/control/valueresponder/valueresponder.js +3 -1
  83. data/js/foundation/eventmanager/eventmanager.js +884 -0
  84. data/js/{controls/datetime/timesheet_item_edit → foundation/eventmanager}/js.inc +0 -0
  85. data/js/foundation/geom/point/point.js +2 -2
  86. data/js/foundation/geom/rect/rect.js +1 -0
  87. data/js/foundation/json_renderer/json_renderer.js +2 -0
  88. data/js/foundation/system/system.js +2 -1
  89. data/js/foundation/thememanager/thememanager.js +29 -23
  90. data/js/{controls/lists/checkboxlist → foundation/value}/js.inc +0 -0
  91. data/js/{comm/values → foundation}/value/value.js +1 -0
  92. data/js/foundation/view/markupview/markupview.js +2 -1
  93. data/js/foundation/view/morphanimation/morphanimation.js +1 -0
  94. data/js/foundation/view/view.js +6 -12
  95. data/js/foundation/view/viewdefaults/viewdefaults.js +1 -0
  96. data/js/{controls/lists → lists}/checkboxlist/checkboxlist.js +1 -0
  97. data/js/{controls/lists/listitems → lists/checkboxlist}/js.inc +0 -0
  98. data/js/{controls/lists/radiobuttonlist → lists/listitems}/js.inc +0 -0
  99. data/js/{controls/lists → lists}/listitems/listitems.js +22 -3
  100. data/js/lists/radiobuttonlist/js.inc +0 -0
  101. data/js/{controls/lists → lists}/radiobuttonlist/radiobuttonlist.js +2 -12
  102. data/js/util/reloadapp/js.inc +0 -0
  103. data/js/{comm → util}/reloadapp/reloadapp.js +10 -8
  104. data/js/{comm → util}/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
  105. data/js/{comm → util}/reloadapp/themes/default/reloadapp_warning.png +0 -0
  106. data/js/util/sha/js.inc +0 -0
  107. data/js/{comm → util}/sha/sha.js +27 -33
  108. data/js/views/centerview/centerview.js +33 -3
  109. data/js/views/inlineview/inlineview.js +1 -0
  110. data/js/views/scrollview/scrollview.js +1 -0
  111. data/lib/conf/argv.rb +34 -22
  112. data/lib/conf/default.rb +165 -173
  113. data/lib/daemon/daemon.rb +9 -9
  114. data/lib/daemon/sigcomm.rb +4 -4
  115. data/lib/http/broker.rb +30 -27
  116. data/lib/http/rackup.rb +2 -3
  117. data/lib/http/request.rb +1 -2
  118. data/lib/http/response.rb +10 -10
  119. data/lib/plugins/dependencies.rb +2 -1
  120. data/lib/plugins/gui_plugin.rb +77 -50
  121. data/lib/plugins/guiparser.rb +26 -22
  122. data/lib/plugins/plugin.rb +207 -427
  123. data/lib/plugins/plugin_base.rb +162 -0
  124. data/lib/plugins/plugin_plugins.rb +21 -15
  125. data/lib/plugins/plugin_sqlite_db.rb +45 -20
  126. data/lib/plugins/pluginmanager.rb +10 -5
  127. data/lib/plugins/plugins.rb +65 -31
  128. data/lib/plugins/servlet.rb +74 -26
  129. data/lib/rsence.rb +32 -0
  130. data/lib/session/msg.rb +131 -96
  131. data/lib/session/sessionmanager.rb +5 -4
  132. data/lib/session/sessionstorage.rb +4 -3
  133. data/lib/transporter/transporter.rb +30 -21
  134. data/lib/util/gzstring.rb +4 -2
  135. data/lib/util/ruby19_fixes.rb +18 -0
  136. data/lib/values/hvalue.rb +139 -88
  137. data/lib/values/valuemanager.rb +60 -46
  138. data/plugins/client_pkg/client_pkg.rb +6 -5
  139. data/plugins/client_pkg/lib/client_pkg_build.rb +5 -5
  140. data/plugins/client_pkg/lib/client_pkg_serve.rb +8 -0
  141. data/plugins/index_html/index_html.rb +3 -1
  142. data/plugins/index_html/tmpl/index.html +2 -3
  143. data/plugins/main/js/main.js +84 -0
  144. data/plugins/main/main.rb +54 -27
  145. data/plugins/ticket/lib/common.rb +4 -2
  146. data/plugins/ticket/lib/favicon.rb +3 -2
  147. data/plugins/ticket/lib/file.rb +2 -2
  148. data/plugins/ticket/lib/img.rb +2 -2
  149. data/plugins/ticket/lib/objblob.rb +2 -2
  150. data/plugins/ticket/lib/rsrc.rb +2 -2
  151. data/plugins/ticket/lib/upload.rb +9 -8
  152. data/plugins/ticket/ticket.rb +141 -8
  153. data/setup/welcome/welcome.rb +1 -0
  154. metadata +76 -72
  155. data/lib/plugins/plugin_util.rb +0 -107
  156. data/plugins/index_html/tmpl/startup_index.html +0 -29
  157. data/plugins/main/js/riassence_ns.js +0 -87
  158. data/setup/legacy/info.yaml +0 -18
  159. data/setup/legacy/legacy.rb +0 -17
  160. data/setup/welcome/gui/welcome.yaml +0 -68
  161. data/setup/welcome/text/welcome.html +0 -8
@@ -1,4 +1,3 @@
1
- #--
2
1
  ## RSence
3
2
  # Copyright 2008 Riassence Inc.
4
3
  # http://riassence.com/
@@ -6,7 +5,7 @@
6
5
  # You should have received a copy of the GNU General Public License along
7
6
  # with this software package. If not, contact licensing@riassence.com
8
7
  ##
9
- #++
8
+
10
9
 
11
10
  # Use rubygems to load rack
12
11
  require 'rubygems'
@@ -14,22 +13,23 @@ require 'rubygems'
14
13
  # Transporter is the top-level handler for calls coming from the javascript COMM.Transporter.
15
14
  require 'transporter/transporter'
16
15
 
17
- ## Broker routes requests to the correct handler
16
+ # Broker routes requests to the correct handler
18
17
  require 'http/broker'
19
18
 
20
19
 
21
- module ::RSence
20
+ module RSence
22
21
 
22
+ # @private The process id of the launch process (usually the PID of the 'rsence' command)
23
23
  @@launch_pid = Process.pid
24
24
 
25
- # Returns the pid of the process when starting up.
26
- # PID is different for the forked child process(es)
25
+ # @private Returns the pid of the process when starting up.
26
+ # PID is different for the forked child process or processes
27
27
  def self.launch_pid
28
28
  return @@launch_pid
29
29
  end
30
30
 
31
- # The Controller module handles the damonizing
32
- # operations of the process referred to as +daemon+
31
+ # @private The Controller module handles the daemonizing
32
+ # operations of the process referred to as +daemon+
33
33
  module Daemon
34
34
 
35
35
  # Writes the process id to disk, the pid_fn method of the daemon contains
@@ -254,7 +254,7 @@ module ::RSence
254
254
 
255
255
  end
256
256
 
257
- # Simple process control, constructed here and called from Daemon::Controller
257
+ # @private Simple process control, constructed here and called from Daemon::Controller
258
258
  class HTTPDaemon
259
259
 
260
260
  # RSence top-level run handler. Almost identical to start.
@@ -1,4 +1,3 @@
1
- #--
2
1
  ## RSence
3
2
  # Copyright 2010 Riassence Inc.
4
3
  # http://riassence.com/
@@ -6,12 +5,13 @@
6
5
  # You should have received a copy of the GNU General Public License along
7
6
  # with this software package. If not, contact licensing@riassence.com
8
7
  ##
9
- #++
10
8
 
11
- # RSence async signal communication handler, uses temporary files for communication.
12
- # Utilized by ARGVParser and Daemon.
9
+
13
10
 
14
11
  module RSence
12
+
13
+ # @private RSence async signal communication handler, uses temporary files for communication.
14
+ # Utilized by ARGVParser and Daemon.
15
15
  module SIGComm
16
16
  def self.delete_signal_response( pid_fn )
17
17
  sig_fn = pid_fn+'.response.'+signal
@@ -1,4 +1,3 @@
1
- #--
2
1
  ## RSence
3
2
  # Copyright 2008 Riassence Inc.
4
3
  # http://riassence.com/
@@ -6,11 +5,6 @@
6
5
  # You should have received a copy of the GNU General Public License along
7
6
  # with this software package. If not, contact licensing@riassence.com
8
7
  ##
9
- #++
10
-
11
-
12
-
13
- module RSence
14
8
 
15
9
  require 'rubygems'
16
10
  require 'rack'
@@ -21,12 +15,17 @@ require 'http/response'
21
15
  ## Minimally WEBrick -compatible request object
22
16
  require 'http/request'
23
17
 
24
- # Broker routes requests to the proper request processing instance.
25
- # It's the top-level http handler.
18
+
19
+ module RSence
20
+
21
+
22
+ # Broker sets up Rack and routes requests to the proper request processing instance.
26
23
  class Broker
27
24
 
28
- # This method is called from Rack. The env is the Rack environment.
29
- def call(env)
25
+ # This method is called from Rack.
26
+ # @param [Hash] env is the Rack environment.
27
+ # @return [Array(Number, Hash, String)] Rack-style response status, header, body
28
+ def call( env )
30
29
  sleep @@ping_sim if @@ping_sim
31
30
  unless @@transporter.online?
32
31
  puts "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} -- Server busy."
@@ -50,10 +49,9 @@ class Broker
50
49
 
51
50
  # Returns a dynamically created "REST Dispatcher" kind of class that has
52
51
  # request and response as instance variables and the rest of the Broker
53
- # class as the superclass.
54
- # It calls the method according to the http method.
55
- # Called from #call
56
- # Broker currently implements only get and post methods.
52
+ # class as the superclass. It calls the method according to the http method. Called from {#call}
53
+ # Broker currently implements only the {#get} and {#post} methods.
54
+ # @return [Broker] An instance of Broker with a {Request} instance as +@request+ and a {Response} instance as +@response+
57
55
  def dispatcher_class
58
56
  @dispatcher ||= Class.new(self.class) do
59
57
  attr_accessor :content_type
@@ -64,13 +62,14 @@ class Broker
64
62
  end
65
63
  end
66
64
 
67
- # This method is used to create the Rack instance
68
- # and set up itself accordingly.
69
- # The transporter parameter is an instance of the Transporter class,
70
- # which does all the actual delegation.
71
- # The conf parameter contains a hash with at least the following:
72
- # :bind_address, :port, :rack_require
73
- def self.start( transporter, conf )
65
+ # Creates the Rack instance and set up itself accordingly.
66
+ #
67
+ # @param [Transporter] transporter The single {Transporter} instance initialized by {HTTPDaemon}
68
+ # @param [Hash{Symbol => String}] conf Rack initialization settings
69
+ # @option conf [String] :bind_address ('127.0.0.1') The TCP/IP address or mask to bind to.
70
+ # @option conf [#to_i] :port ('8001') The TCP port to bind to.
71
+ # @option conf [String] :rack_require ('mongrel') The Rack handler to use.
72
+ def self.start( transporter, conf = {:bind_address => '127.0.0.1', :port => '8001', :rack_require => 'mongrel'} )
74
73
 
75
74
  host = conf[:bind_address]
76
75
  port = conf[:port]
@@ -115,21 +114,25 @@ class Broker
115
114
 
116
115
  end
117
116
 
117
+ =begin
118
+ # Extends the receiver with SingletonMethods
118
119
  def self.included( receiver )
119
120
  receiver.extend( SingletonMethods )
120
121
  end
122
+ =end
123
+
121
124
 
122
- # Generic 404 handler
125
+ # Generic 404 error handler. Just sets up response status, headers, body as a small "Page Not Found" html page
123
126
  def not_found
124
127
  puts "/404: #{@request.fullpath.inspect}" if RSence.args[:verbose]
125
128
  @response.status = 404
126
129
  err404 = '<html><head><title>404 - Page Not Found</title></head><body>404 - Page Not Found</body></html>'
127
- @response['content-type'] = 'text/html; charset=UTF-8'
128
- @response['content-length'] = err404.length.to_s
130
+ @response['Content-Type'] = 'text/html; charset=UTF-8'
131
+ @response['Content-Length'] = err404.length.to_s
129
132
  @response.body = err404
130
133
  end
131
134
 
132
- ## Post requests are always xhr requests
135
+ # Routes POST requests to {Transporter#servlet}
133
136
  def post
134
137
 
135
138
  puts "post: #{@request.fullpath}" if RSence.args[:verbose]
@@ -138,7 +141,7 @@ class Broker
138
141
 
139
142
  end
140
143
 
141
- ## Get requests are different, depending on the uri requested
144
+ # Routes GET requests to {Transporter#servlet}
142
145
  def get
143
146
 
144
147
  puts "get: #{@request.fullpath}" if RSence.args[:verbose]
@@ -147,7 +150,7 @@ class Broker
147
150
 
148
151
  end
149
152
 
150
- ### -- Add more http methods here when we have some apps to test with, caldav implementation maybe? ++
153
+ ### -- Add more http methods here when we have some apps to test with CalDAV implementation maybe? ++
151
154
 
152
155
  end
153
156
 
@@ -1,4 +1,3 @@
1
- #--
2
1
  ## RSence
3
2
  # Copyright 2008 Riassence Inc.
4
3
  # http://riassence.com/
@@ -6,7 +5,7 @@
6
5
  # You should have received a copy of the GNU General Public License along
7
6
  # with this software package. If not, contact licensing@riassence.com
8
7
  ##
9
- #++
8
+
10
9
 
11
10
  warn "Current RSence rackup Broker implementation does not work."
12
11
  warn "Please try again in a future revision."
@@ -47,7 +46,7 @@ module Broker
47
46
  @@transporter = Transporter.new
48
47
 
49
48
  def self.start
50
- conf = ::RSence.config[:http_server][:latency]
49
+ conf = RSence.config[:http_server][:latency]
51
50
  if conf == 0
52
51
  @@ping_sim = false
53
52
  else
@@ -1,4 +1,3 @@
1
- #--
2
1
  ## RSence
3
2
  # Copyright 2008 Riassence Inc.
4
3
  # http://riassence.com/
@@ -6,7 +5,7 @@
6
5
  # You should have received a copy of the GNU General Public License along
7
6
  # with this software package. If not, contact licensing@riassence.com
8
7
  ##
9
- #++
8
+
10
9
 
11
10
 
12
11
  require 'rubygems'
@@ -1,4 +1,3 @@
1
- #--
2
1
  ## RSence
3
2
  # Copyright 2008 Riassence Inc.
4
3
  # http://riassence.com/
@@ -6,22 +5,23 @@
6
5
  # You should have received a copy of the GNU General Public License along
7
6
  # with this software package. If not, contact licensing@riassence.com
8
7
  ##
9
- #++
8
+
10
9
 
11
10
 
12
11
  module RSence
13
12
 
14
- # Simply adds the + method "operator" to an extended Array.
15
- # Used for pushing http body data.
16
- class ResponseBody < Array
17
- def +(body_data)
18
- self.push(body_data)
19
- end
20
- end
21
-
22
13
  # Classic WEBrick -compatible Response object for Rack.
23
14
  # Implements only the methods used by the framework.
24
15
  class Response
16
+
17
+ # Adds the + method "operator" to an extended Array.
18
+ # Used for pushing http body data.
19
+ class ResponseBody < Array
20
+ def +(body_data)
21
+ self.push(body_data)
22
+ end
23
+ end
24
+
25
25
  def initialize
26
26
  @body = ResponseBody.new(1)
27
27
  @body[0] = ''
@@ -6,6 +6,7 @@
6
6
  # with this software package. If not, contact licensing@riassence.com
7
7
  ##
8
8
 
9
+
9
10
  module RSence
10
11
 
11
12
  # = Description:
@@ -126,7 +127,7 @@ module RSence
126
127
  # List of categories
127
128
  attr_reader :categories
128
129
 
129
- # Adds the gategory +name+.
130
+ # Adds the category +name+.
130
131
  def add_category( name )
131
132
  @categories.push( name ) unless @categories.include?( name )
132
133
  end
@@ -6,32 +6,31 @@
6
6
  # with this software package. If not, contact licensing@riassence.com
7
7
  ##
8
8
 
9
- module ::RSence
9
+
10
+ module RSence
10
11
  module Plugins
11
12
 
12
- ## The GUIPlugin extends Plugin by automatically initializing an GUIParser
13
- ## instance as @gui
14
- ## It makes the include_js method public to enable automatic dependency
15
- ## loading based on the dependencies item in the YAML gui declaration.
16
- ## It also makes the @path public.
17
- ## It inits the gui automatically.
18
- ## Extend the gui_params method to define your own params for the gui data.
19
- ##
20
- ## HValues can be defined inside values.yaml at the root directory of
21
- ## plugin. The HValues may be linked directly with methods on the values.yaml
22
- ## as well.
23
- ##
24
- ## == Values.yaml
25
- ## :valuename: # name of the HValue
26
- ## :value: 2.56 # defined value
27
- ## :responders: # methods responding to the value on ruby code upon change
28
- ## - :method: validate_convert_factor
29
- ##
30
- ##
31
- ##
32
- class GUIPluginTemplate < PluginTemplate
13
+ # The CUIPlugin__ is actually available as +GUIPlugin+ from plugin bundle code using the {RSence::Plugins::GUIPlugin} class mimic method.
14
+ #
15
+ # GUIPlugin extends {Plugin__ Plugin} by automatically initializing an {GUIParser} instance as +@gui+.
16
+ #
17
+ # Read {Plugin__ Plugin} for usage of the API, {file:ExampleGuiPlugin Example GUIPlugin} for an example of use and {file:PluginBundles Plugin Bundles} for overall information about plugin bundle usage.
18
+ #
19
+ # * It implements automatic dependency loading based on the dependencies item in the YAML gui declaration.
20
+ # * It inits the gui automatically.
21
+ #
22
+ # = User Interface -related hooks:
23
+ # * {#init_ui +#init_ui+} -- Extend to implement logic when the {MainPlugin} plugin has started the client. The {GUIPlugin__ +GUIPlugin+} class extends this method to automatically load and initialize the user interface from a +GUITree+ data structure defined in the +gui/main.yaml+ document in the bundle directory.
24
+ # * {#gui_params +#gui_params+} -- Extend to define your own params for the gui data.
25
+ #
26
+ class GUIPlugin__ < Plugin__
27
+
28
+ # @private Class type identifier for the PluginManager.
29
+ # @return [:GUIPlugin]
33
30
  def self.bundle_type; :GUIPlugin; end
34
-
31
+
32
+
33
+ # @private Placeholder for actual gui yaml file.
35
34
  @@default_yaml_src = <<-END
36
35
  type: GUITree
37
36
  version: 0.6
@@ -41,8 +40,10 @@ options:
41
40
  label: "Dummy Application"
42
41
 
43
42
  END
44
-
45
- # Automatically initializes an GUIParser instance as @gui
43
+
44
+ # In addition to {Plugin__#init Plugin#init}, also automatically initializes a {GUIParser} instance as +@gui+
45
+ #
46
+ # @return [nil]
46
47
  def init
47
48
  super
48
49
  yaml_src = file_read( "gui/#{@name}.yaml" )
@@ -52,16 +53,36 @@ options:
52
53
  @client_pkgs = false
53
54
  end
54
55
 
55
- # Extend this method to return custom params to GUIParser#init.
56
- # Called from init_ui.
57
- # By default assigns the session values as :values to use for
58
- # valueObjId: ":values.my_value_name" in the YAML GUI file.
56
+ # Extend this method to return custom params to {GUIParser#init}.
57
+ #
58
+ # Called from {#init_ui}.
59
+ #
60
+ # By default assigns the session values as :values to use for +bind: :values.my_value_name+ in the YAML GUI file for client-side value bindings.
61
+ #
62
+ # @param [Message] msg The message is supplied by the system.
63
+ #
64
+ # @return [Hash] Parameters for {GUIParser#init @gui#init}
65
+ #
66
+ # @example To provide extra parameters, do this:
67
+ # def gui_params( msg )
68
+ # params = super
69
+ # params[:extra] = {
70
+ # :foo => "Foo", # use in the GUITree as :extra.foo
71
+ # :num => 124334, # use in the GUITree as :extra.num
72
+ # :bar => {
73
+ # :barbar => "Bar" # use in the GUITree as :extra.bar.barbar
74
+ # }
75
+ # :arr => [1,2,4,8] # use in the GUITree as :extra.arr
76
+ # }
77
+ # params[:more] = "More" # use in the GUITree as :more
78
+ # return params
79
+ # end
80
+ #
59
81
  def gui_params( msg )
60
- return {
61
- :values => @gui.values( get_ses( msg ) )
62
- }
82
+ { :values => @gui.values( get_ses( msg ) ) }
63
83
  end
64
-
84
+
85
+ # @private Method that implements +client_pkgs.yaml+ loading
65
86
  def install_client_pkgs
66
87
  if @client_pkgs
67
88
  warn "install_client_pkgs: called with @client_pkgs defined; returning"
@@ -82,7 +103,8 @@ options:
82
103
  @plugins.client_pkg.rebuild_client
83
104
  end
84
105
  end
85
-
106
+
107
+ # @private Method that implements +client_pkgs.yaml+ unloading
86
108
  def uninstall_client_pkgs
87
109
  if not @client_pkgs
88
110
  warn "uninstall_client_pkgs: called without @client_pkgs defined"
@@ -101,33 +123,38 @@ options:
101
123
  end
102
124
  @client_pkgs = false
103
125
  end
104
-
126
+
127
+ # @private calls install_client_pkgs, if a 'client_pkgs.yaml' file is found
105
128
  def open
106
129
  super
107
130
  install_client_pkgs if File.exist? bundle_path( 'client_pkgs.yaml' )
108
131
  end
109
-
132
+
133
+ # @private calls uninstall_client_pkgs, if a 'client_pkgs.yaml' file was loaded
110
134
  def close
111
135
  super
112
136
  uninstall_client_pkgs if @client_pkgs
113
137
  end
114
-
115
- # Sends gui specification to the main plugin
138
+
139
+ # @private Sends gui specification to the main plugin
116
140
  def spec_ui( msg )
117
141
  # TODO
118
142
  end
119
-
120
- # Automatically inits the UI using GUIParser#init.
121
- # Passes on the return value of gui_params.
122
- def init_ui( msg ); @gui.init( msg, gui_params( msg ) ); end
123
-
124
- # Automatically kills the UI using GUIParser#kill
125
- def kill_ui( msg ); @gui.kill( msg ); end
126
-
127
- # Makes include_js public to enable calls to it from GUIParser
128
- public :include_js, :read_js_once
129
-
130
- attr_reader :plugins
143
+
144
+ # Automatically inits the UI using {GUIParser#init}
145
+ #
146
+ # @param [Message] msg The message is supplied by the system.
147
+ #
148
+ # @return [nil]
149
+ def init_ui( msg )
150
+ @gui.init( msg, gui_params( msg ) )
151
+ end
152
+
153
+ # @private Automatically kills the UI using {GUIParser#kill}
154
+ def kill_ui( msg )
155
+ @gui.kill( msg )
156
+ end
157
+
131
158
  end
132
159
  end
133
160
  end