Learn R Programming

traitr (version 0.14)

Item: Base Trait for an Item

Description

An Item combines a model, view and controller interface into one convenient package. Items may be combined into an ItemGroup or a Dialog to be shown.

Usage

Item

Arguments

Format

proto object 
 $ set_model              :function (., model)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 255 36 283 26 36 26 255 283 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ attr                   : list() 
 $ tooltip                : chr "" 
 $ init_ui                :function (., container, attr = .$attr, context, ...)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 496 33 504 25 33 25 496 504 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ new                    :function (., ...)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 514 30 518 26 30 26 514 518 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ set_validate           :function (., f)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 208 40 208 68 40 68 208 208 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ show_label             : logi TRUE 
 $ to_string              :function (., drop = TRUE)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 462 38 466 26 38 26 462 466 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ instance               :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 526 35 532 26 35 26 526 532 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ visible_when           :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 183 42 183 59 42 59 183 183 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ make_ui                :function (., container, attr = .$attr, context, ...)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 164 36 168 26 36 26 164 168 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ make_default_gui_layout:function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 174 51 174 63 51 63 174 174 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ get_model              :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 295 36 295 54 36 54 295 295 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ handler_user_data      : NULL 
 $ setattr                :function (., key, value, notify_private = TRUE)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 329 34 360 26 34 26 329 360 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ set_model_from_item    :function (., item)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 285 46 291 26 46 26 285 291 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ parent                 : NULL 
 $ validate               :function (., rawvalue)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 225 35 233 26 35 26 225 233 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ update_ui              :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 537 36 542 26 36 26 537 542 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ visible                :function (., value)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 188 37 190 27 37 27 188 190 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ label                  : chr "label" 
 $ init                   :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 508 31 510 26 31 26 508 510 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ to_R                   :function (., drop = TRUE)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 445 33 454 26 33 26 445 454 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ init_model             :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 382 37 434 26 37 26 382 434 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ init_controller        :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 477 41 488 26 41 26 477 488 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ class                  : chr [1:3] "Item" "Model" "TraitR" 
 $ on_realized            : NULL 
 $ remove_observer        :function (., o)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 308 44 310 26 44 26 308 310 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ coerce_with            : NULL 
 $ set_editor             :function (., editor)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 143 39 150 26 39 26 143 150 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ enabled                :function (., value)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 202 37 204 27 37 27 202 204 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ default_get            :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 365 37 367 25 37 25 365 367 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ controller             : NULL 
 $ default_set            :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 373 37 375 25 37 25 373 375 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ excluded_property_names: chr [1:2] "editor" "model" 
 $ model                  : NULL 
 $ is_valid               :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 240 34 243 25 34 25 240 243 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ icon                   : chr "" 
 $ name                   : chr "" 
 $ enabled_when           :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 197 42 197 59 42 59 197 197 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ add_observer           :function (., o)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 301 41 303 26 41 26 301 303 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ get_editor             :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 154 39 154 58 39 58 154 154 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ editor                 : NULL 
 $ properties             : NULL 
 $ getattr                :function (., key)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 316 34 321 26 34 26 316 321 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 $ add_handler_name       : chr "addHandlerChanged" 
 $ value                  : chr "default value" 
 $ help                   : chr "" 
 $ get_controller         :function (.)   
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 475 42 475 65 42 65 475 475 
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'   
 parent: proto object 

Details

The make_ui method creates the user interface, initializes the model and the controller. The init_model, init_controller and init_ui do the work.

The model may be shared with different items. See set_model_from_item or the instance proto method.

Items implement the observer interface, so one can add observers to listen for changes to the properties. (Properties are listed in the property "properties".)

Items use the Adpater interface to link the model with the view (an Editor). The "properties" property lists the names of model properties. One should use "value" for the special one to be returned by the method to_R. (This method gathers values from the items after coercion)

When an item's user interface is made, the method on_realized is called.