Class: RSence::Plugins::GUIPlugin__
- Defined in:
- lib/rsence/plugins/gui_plugin.rb
Overview
The CUIPlugin__ is actually available as GUIPlugin from plugin bundle code using the GUIPlugin class mimic method.
GUIPlugin extends Plugin by automatically initializing an GUIParser instance as @gui.
Read Plugin for usage of the API, Example GUIPlugin for an example of use and Plugin Bundles for overall information about plugin bundle usage.
-
It implements automatic dependency loading based on the dependencies item in the YAML gui declaration.
-
It inits the gui automatically.
User Interface -related hooks:
-
#init_ui– Extend to implement logic when the MainPlugin plugin has started the client. TheGUIPluginclass extends this method to automatically load and initialize the user interface from aGUITreedata structure defined in thegui/main.yamldocument in the bundle directory. -
#gui_params– Extend to define your own params for the gui data.
Instance Attribute Summary
Attributes inherited from Plugin__
Instance Method Summary collapse
-
#gui_params(msg) ⇒ Hash
Extend this method to return custom params to RSence::Plugins::GUIParser#init.
-
#init ⇒ nil
In addition to Plugin#init, also automatically initializes a GUIParser instance as @gui.
-
#init_ui(msg) ⇒ nil
Automatically inits the UI using RSence::Plugins::GUIParser#init.
Methods inherited from Plugin__
#cloned_source, #cloned_target, #get_ses, #idle, #include_js, #init_ses, #name_with_manager_s, #read_js, #read_js_once, #restore_ses, #restore_ses_value, #values_js
Methods included from PluginBase
#bundle_path, #file_read, #file_write, #flush, #httime, #method_missing, #yaml_read, #yaml_write
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RSence::Plugins::PluginBase
Instance Method Details
#gui_params(msg) ⇒ Hash
Extend this method to return custom params to RSence::Plugins::GUIParser#init.
Called from #init_ui.
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.
77 78 79 80 |
# File 'lib/rsence/plugins/gui_plugin.rb', line 77 def gui_params( msg ) return unless @gui { :values => @gui.values( get_ses( msg ) ) } end |
#init ⇒ nil
In addition to Plugin#init, also automatically initializes a RSence::Plugins::GUIParser instance as @gui
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rsence/plugins/gui_plugin.rb', line 35 def init super yaml_src = false [ "#{@name}.yaml", 'gui.yaml', "gui/#{@name}.yaml", "gui/main.yaml" ].each do |yaml_name| yaml_src = file_read( yaml_name ) break if yaml_src end if yaml_src @gui = GUIParser.new( self, yaml_src, @name ) else @gui = nil end @client_pkgs = false end |
#init_ui(msg) ⇒ nil
Automatically inits the UI using RSence::Plugins::GUIParser#init
151 152 153 154 |
# File 'lib/rsence/plugins/gui_plugin.rb', line 151 def init_ui( msg ) return unless @gui @gui.init( msg, gui_params( msg ) ) end |