rk.plugin.component: Generate RKWard plugin components

View source: R/rk.plugin.component.R

rk.plugin.componentR Documentation

Generate RKWard plugin components

Description

Generate RKWard plugin components

Usage

rk.plugin.component(
  about,
  xml = list(),
  js = list(),
  rkh = list(),
  provides = c("logic", "dialog"),
  scan = c("var", "saveobj", "settings", "preview"),
  unused.vars = FALSE,
  guess.getter = FALSE,
  hierarchy = "test",
  include = NULL,
  create = c("xml", "js", "rkh"),
  dependencies = NULL,
  hints = TRUE,
  gen.info = TRUE,
  indent.by = rk.get.indent()
)

Arguments

about

Either a character string with the name of this plugin component, or an object of class XiMpLe.node with further descriptive information on it, like its authors and dependencies (see link[XiMpLe:rk.XML.about]{rk.XML.about} for details). This is only useful for information that differs from the <about> section of the .pluginmap file.

xml

A named list of options to be forwarded to rk.XML.plugin, to generate the GUI XML file. Not all options are supported because some don't make sense in this context. Valid options are: "dialog", "wizard", "logic" and "snippets". If not set, their default values are used. See rk.XML.plugin for details.

js

A named list of options to be forwarded to rk.JS.doc, to generate the JavaScript file. Not all options are supported because some don't make sense in this context. Valid options are: "require", "results.header", "header.add", "variables", "globals", "preprocess", "calculate", "printout", "doPrintout", "preview" and "load.silencer". If not set, their default values are used. See rk.JS.doc for details.

rkh

A named list of options to be forwarded to rk.rkh.doc, to generate the help file. Not all options are supported because some don't make sense in this context. Valid options are: "summary", "usage", "sections", "settings", "related" and "technical". If not set, their default values are used. See rk.rkh.doc for details.

provides

Character vector with possible entries of "logic", "dialog" or "wizard", defining what sections the GUI XML file should provide even if dialog, wizard and logic are NULL. These sections must be edited manually and some parts are therefore commented out.

scan

A character vector to trigger various automatic scans of the generated GUI XML file. Valid enties are:

"var"

Calls rk.JS.scan to define all needed variables in the calculate() function of the JavaScript file. These variables will be added to variables defined by the js option, if any (see below).

"saveobj"

Calls rk.JS.saveobj to generate code to save R results in the printout() function of the JavaScript file. This code will be added to the code defined by the js option, if any (see below).

"settings"

Calls rk.rkh.scan to generate <setting> sections for each relevant GUI element in the <settings> section of the help file. This option will be overruled if you provide that section manually by the rkh option (see below).

"preview"

Calls rk.JS.scan to search for <preview> nodes in the XML code. An according preview() function will be added to the JS code if needed. Will be overwritten by a preview function that was defined by the js option.

unused.vars

Logical, if TRUE all variables found by scan are being defined, even if they are not used in the JavaScript code. By default only matching variables will be kept. This option should only be used for debugging.

guess.getter

Logical, if TRUE try to get a good default getter function for JavaScript variable values (if scan is active). This will use some functions which were added with RKWard 0.6.1, and therefore raise the dependencies for your plugin/component accordingly. Nonetheless, it's recommended.

hierarchy

A character vector with instructions where to place this component in the menu hierarchy, one list or string. Valid single values are "file", "edit", "view", "workspace", "run", "data", "analysis", "plots", "distributions", "windows", "settings" and "help", anything else will place it in a "test" menu. If hierarchy is a list, each entry represents the label of a menu level.

include

Character string or vector, relative path(s) to other file(s), which will then be included in the head of the GUI XML document.

create

A character vector with one or more of these possible entries:

"xml"

Create the plugin .xml XML file skeleton.

"js"

Create the plugin .js JavaScript file skeleton.

"rkh"

Create the plugin .rkh help file skeleton.

dependencies

An object of class XiMpLe.node to be pasted as the <dependencies> section, See rk.XML.dependencies for details. Skipped if NULL. This is only useful for information that differs from the <dependencies> section of the .pluginmap file.

hints

Logical, if TRUE and you leave optional entries empty (like rkh=list()), dummy sections will be added.

gen.info

Logical, if TRUE comment notes will be written into the genrated documents, that they were generated by rkwarddev and changes should be done to the script. You can also provide a character string naming the very rkwarddev script file that generates this component, which will then also be added to the comment.

indent.by

A character string defining the indentation string to use.

Value

An object of class rk.plug.comp.

See Also

Introduction to Writing Plugins for RKWard

Examples

## Not run: 
test.dropdown <- rk.XML.dropdown("mydrop",
  options=list("First Option"=c(val="val1"),
  "Second Option"=c(val="val2", chk=TRUE)))
test.checkboxes <- rk.XML.row(rk.XML.col(
  list(test.dropdown,
    rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
    rk.XML.cbox(label="bar", val="bar2"))
  ))
test.vars <- rk.XML.vars("select some vars", "vars go here")
test.tabbook <- rk.XML.dialog(rk.XML.tabbook("My Tabbook",
  tabs=c("First Tab"=test.checkboxes, "Second Tab"=test.vars)))

rk.plugin.component("Square the Circle",
  xml=list(dialog=test.tabbook))

## End(Not run)

rkward-community/rkwarddev documentation built on May 9, 2022, 3:02 p.m.