[rkward-cvs] SF.net SVN: rkward:[3839] trunk/rkward/rkward/rbackend/rpackages/rkwarddev
m-eik at users.sourceforge.net
m-eik at users.sourceforge.net
Mon Sep 26 13:07:50 UTC 2011
Revision: 3839
http://rkward.svn.sourceforge.net/rkward/?rev=3839&view=rev
Author: m-eik
Date: 2011-09-26 13:07:50 +0000 (Mon, 26 Sep 2011)
Log Message:
-----------
rkwarddev: added full wizard support; changed options rk.XML.plugin()/rk.plugin.skeleton() which brekas backwards compatibility for earlier releses but is much more consistent.
Modified Paths:
--------------
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.convert.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.formula.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.logic.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.convert.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.formula.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd
Added Paths:
-----------
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.copy.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dialog.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.page.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varselector.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.wizard.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.copy.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dialog.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.page.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varselector.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.wizard.Rd
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog 2011-09-26 13:07:50 UTC (rev 3839)
@@ -1,6 +1,13 @@
ChangeLog for package rkwarddev
-## 0.01-5 (2011-09-23)
+## 0.02-0 (2011-09-26)
+ - redesigned options for rk.XML.plugin() and rk.plugin.skeleton() for more consistency.
+ unfortunately, this breaks backwards compatibility!
+ - added functions rk.XML.varselector(), rk.XML.copy(), rk.XML.dialog(), rk.XML.page() and
+ rk.XML.wizard()
+ - updated rk.XML.formula()
+
+## 0.01-5 (2011-09-25)
- added functions rk.XML.formula(), rk.XML.convert(), rk.XML.connect(), rk.XML.logic(),
rk.XML.set() and rk.XML.external()
- added possibility to add custom XML code to the logic section with rk.XML.plugin()
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION 2011-09-26 13:07:50 UTC (rev 3839)
@@ -14,8 +14,8 @@
URL: http://rkward.sourceforge.net
Authors at R: c(person(given="Meik", family="Michalke",
email="meik.michalke at hhu.de", role=c("aut", "cre")))
-Version: 0.01-5
-Date: 2011-09-25
+Version: 0.02-0
+Date: 2011-09-26
Collate:
'rk-internal.R'
'rk.JS.array.R'
@@ -33,12 +33,15 @@
'rk.XML.col.R'
'rk.XML.connect.R'
'rk.XML.convert.R'
+ 'rk.XML.copy.R'
+ 'rk.XML.dialog.R'
'rk.XML.dropdown.R'
'rk.XML.external.R'
'rk.XML.formula.R'
'rk.XML.frame.R'
'rk.XML.input.R'
'rk.XML.logic.R'
+ 'rk.XML.page.R'
'rk.XML.pluginmap.R'
'rk.XML.plugin.R'
'rk.XML.radio.R'
@@ -49,5 +52,7 @@
'rk.XML.stretch.R'
'rk.XML.tabbook.R'
'rk.XML.text.R'
+ 'rk.XML.varselector.R'
'rk.XML.varslot.R'
'rk.XML.vars.R'
+ 'rk.XML.wizard.R'
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE 2011-09-26 13:07:50 UTC (rev 3839)
@@ -11,12 +11,15 @@
export(rk.XML.col)
export(rk.XML.connect)
export(rk.XML.convert)
+export(rk.XML.copy)
+export(rk.XML.dialog)
export(rk.XML.dropdown)
export(rk.XML.external)
export(rk.XML.formula)
export(rk.XML.frame)
export(rk.XML.input)
export(rk.XML.logic)
+export(rk.XML.page)
export(rk.XML.plugin)
export(rk.XML.pluginmap)
export(rk.XML.radio)
@@ -28,4 +31,6 @@
export(rk.XML.tabbook)
export(rk.XML.text)
export(rk.XML.vars)
+export(rk.XML.varselector)
export(rk.XML.varslot)
+export(rk.XML.wizard)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.convert.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.convert.R 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.convert.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -31,7 +31,8 @@
#' @param required Logical, sets the state of the \code{required_true} attribute. If \code{TRUE},
#' the plugin submit button is only enabled if this property is true.
#' @param id.name Character string, a unique ID for this plugin element.
-#' If \code{"auto"}, an ID will be generated automatically from the sources and mode value.
+#' If \code{"auto"}, an ID will be generated automatically from the \code{sources}
+#' and \code{mode} value.
#' @return A list of objects of class \code{XiMpLe.node}.
#' @export
#' @seealso
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.copy.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.copy.R (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.copy.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,48 @@
+#' Create XML copy node for RKWard plugins
+#'
+#' @param id Either a character string (the \code{id} of the property to be copied),
+#' or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used).
+#' @param as A character string resembling the \code{copy_element_tag_name} value. I.e., must be
+#' a valid tag name. Will cause a change of tag name of the \code{id} (e.g. "tab") to \code{as}
+#' (e.g. "page").
+#' @return A list of objects of class \code{XiMpLe.node}.
+#' @export
+#' @seealso
+#' \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}},
+#' \code{\link[rkwarddev:rk.plugin.skeleton]{rk.plugin.skeleton}}
+#' @examples
+#' # define a checkbox for the actual dialog
+#' test.cbox1 <- rk.XML.cbox(label="More than 30 subjects", val="true")
+#' # define the wizard
+#' test.text <- rk.XML.text("Did you test more than 30 subjects?")
+#' test.copy <- rk.XML.copy(id=test.cbox1)
+#' test.wizard <- rk.XML.wizard(rk.XML.page(list(test.text, test.copy)))
+#' cat(pasteXMLNode(test.wizard, shine=1))
+
+rk.XML.copy <- function(id, as=NULL){
+ if(length(id) > 1 | length(as) > 1){
+ stop(simpleError("'id' and 'as' must be of length 1!"))
+ } else {}
+
+ # let's see if we need to extract IDs first
+ id.name <- check.ID(id)
+ attr.list <- list(id=id.name)
+
+ if(!is.null(as)){
+ invalid.sets <- !as %in% c("browser", "checkbox", "column", "copy",
+ "dropdown", "formula", "frame", "input", "page", "radio", "row", "saveobject",
+ "spinbox", "stretch", "tabbook", "text", "varselector", "varslot")
+ if(any(invalid.sets)){
+ stop(simpleError(paste("Invalid XML nodes ('as') for wizard/dialog section: ", paste(as, collapse=", "), sep="")))
+ } else {
+ attr.list[["as"]] <- as.character(as)
+ }
+ } else {}
+
+ node <- new("XiMpLe.node",
+ name="copy",
+ attributes=attr.list
+ )
+
+ return(node)
+}
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dialog.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dialog.R (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dialog.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,40 @@
+#' Create XML dialog section for RKWard plugins
+#'
+#' This function will create a dialog section with optional child nodes "browser", "checkbox",
+#' "column", "copy", "dropdown", "formula", "frame", "input", "radio", "row", "saveobject",
+#' "spinbox", "stretch", "tabbook", "text", "varselector" and "varslot".
+#'
+#' @param nodes A (list of) objects of class \code{XiMpLe.node}.
+#' @return A list of objects of class \code{XiMpLe.node}.
+#' @export
+#' @seealso
+#' \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}},
+#' \code{\link[rkwarddev:rk.plugin.skeleton]{rk.plugin.skeleton}}
+#' @examples
+#' # define an input field and two checkboxes
+#' test.input <- rk.XML.input("Type some text")
+#' test.cbox1 <- rk.XML.cbox(label="Want to type?", val="true")
+#' test.cbox2 <- rk.XML.cbox(label="Are you shure?", val="true")
+#' test.dialog <- rk.XML.dialog(rk.XML.col(list(test.input, test.cbox1, test.cbox2)))
+#' cat(pasteXMLNode(test.dialog, shine=1))
+
+rk.XML.dialog <- function(nodes){
+ # check the node names and allow only valid ones
+ node.names <- sapply(child.list(nodes), function(this.node){
+ this.node at name
+ })
+
+ invalid.sets <- !node.names %in% c("browser", "checkbox", "column", "copy",
+ "dropdown", "formula", "frame", "input", "radio", "row", "saveobject",
+ "spinbox", "stretch", "tabbook", "text", "varselector", "varslot")
+ if(any(invalid.sets)){
+ stop(simpleError(paste("Invalid XML nodes for dialog section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
+ } else {}
+
+ node <- new("XiMpLe.node",
+ name="dialog",
+ children=child.list(nodes)
+ )
+
+ return(node)
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.formula.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.formula.R 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.formula.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -1,17 +1,52 @@
#' Create XML node "formula" for RKWard plugins
#'
+#' If \code{fixed} or \code{dependent} are objects of class \code{XiMpLe.node},
+#' their \code{id} will be extracted and used.
+#'
#' @param fixed The \code{id} of the varslot holding the selected fixed factors.
#' @param dependent The \code{id} of the varslot holding the selected dependent variable.
+#' @param id.name Character string, a unique ID for this plugin element.
+#' If \code{"auto"}, an ID will be generated automatically from the \code{fixed} and \code{dependent} value.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @seealso
+#' \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}},
+#' \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}}
#' @examples
-#' test.formula <- rk.XML.formula(fixed="vrs.one", dependent="vsr.two")
+#' test.varselector <- rk.XML.varselector("Select some vars")
+#' test.varslot1 <- rk.XML.varslot("Fixed factors", source=test.varselector)
+#' test.varslot2 <- rk.XML.varslot("Dependent variables", source=test.varselector)
+#' test.formula <- rk.XML.formula(fixed=test.varslot1, dependent=test.varslot2)
#' cat(pasteXMLNode(test.formula, shine=1))
-rk.XML.formula <- function(fixed, dependent){
+rk.XML.formula <- function(fixed, dependent, id.name="auto"){
+ # check if these are actually varslots
+ sapply(list(fixed, dependent), function(this.attr){
+ if(inherits(this.attr, "XiMpLe.node")){
+ this.attr.name <- this.attr at name
+ if(!identical(this.attr.name, "varslot")){
+ stop(simpleError(paste("'fixed' and 'dependent' must be <varslot> nodes! You provided: <", this.attr.name, ">", sep="")))
+ } else {}
+ } else {}
+ })
+
+ fixed.id <- check.ID(fixed)
+ depnd.id <- check.ID(dependent)
+
+ if(identical(id.name, "auto")){
+ attr.list <- list(id=auto.ids(paste(fixed.id, depnd.id, sep=""), prefix=ID.prefix("formula")))
+ } else if(!is.null(id.name)){
+ attr.list <- list(id=id.name)
+ } else {
+ stop(simpleError("'id.name' must have a value!"))
+ }
+
+ attr.list[["fixed_factors"]] <- fixed.id
+ attr.list[["dependent"]] <- depnd.id
+
node <- new("XiMpLe.node",
name="formula",
- attributes=list("fixed_factors"=fixed, dependent=dependent)
+ attributes=attr.list
)
return(node)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.logic.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.logic.R 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.logic.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -28,13 +28,13 @@
rk.XML.logic <- function(nodes){
# check the node names and allow only valid ones
- node.names <- sapply(nodes, function(this.node){
+ node.names <- sapply(child.list(nodes), function(this.node){
this.node at name
})
invalid.sets <- !node.names %in% c("connect", "convert","external","set")
if(any(invalid.sets)){
- stop(simpleError(paste("Invalid XML nodes for logic section: ", paste(invalid.sets, collapse=", "), sep="")))
+ stop(simpleError(paste("Invalid XML nodes for logic section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
} else {}
node <- new("XiMpLe.node",
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.page.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.page.R (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.page.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,40 @@
+#' Create XML page node for RKWard plugins
+#'
+#' This function will create a page node for wizard sections, with optional child nodes "browser", "checkbox",
+#' "column", "copy", "dropdown", "formula", "frame", "input", "page", "radio", "row", "saveobject",
+#' "spinbox", "stretch", "tabbook", "text", "varselector" and "varslot".
+#'
+#' @param nodes A (list of) objects of class \code{XiMpLe.node}.
+#' @return A list of objects of class \code{XiMpLe.node}.
+#' @export
+#' @seealso
+#' \code{\link[rkwarddev:rk.XML.wizard]{rk.XML.wizard}}
+#' @examples
+#' # define a checkbox for the actual dialog
+#' test.cbox1 <- rk.XML.cbox(label="More than 30 subjects", val="true")
+#' # define the wizard
+#' test.text <- rk.XML.text("Did you test more than 30 subjects?")
+#' test.copy <- rk.XML.copy(id.name=test.cbox1)
+#' test.wizard <- rk.XML.wizard(rk.XML.page(list(test.text, test.copy)))
+#' cat(pasteXMLNode(test.wizard, shine=1))
+
+rk.XML.page <- function(nodes){
+ # check the node names and allow only valid ones
+ node.names <- sapply(child.list(nodes), function(this.node){
+ this.node at name
+ })
+
+ invalid.sets <- !node.names %in% c("browser", "checkbox", "column", "copy",
+ "dropdown", "formula", "frame", "input", "page", "radio", "row", "saveobject",
+ "spinbox", "stretch", "tabbook", "text", "varselector", "varslot")
+ if(any(invalid.sets)){
+ stop(simpleError(paste("Invalid XML nodes for page/wizard section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
+ } else {}
+
+ node <- new("XiMpLe.node",
+ name="page",
+ children=child.list(nodes)
+ )
+
+ return(node)
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -2,15 +2,18 @@
#'
#' @param name Character string, the name of the plugin.
#' @param label Character string, a text label for the plugin's top level, i.e. the window title of the dialog.
-#' @param children An optional list with objects of class \code{XiMpLe.node}. Will be included inside the top level node as the dialog code.
-#' @param wiz.children An optional list with objects of class \code{XiMpLe.node}. Will be included inside the top level node as the wizard code
-#' (but only if \code{provides} includes \code{"wizard"} as well).
-#' @param help Logical, if \code{TRUE} an include tag for a help file named \emph{"<name>.rkh"} will be added to the header.
+#' @param dialog An object of class \code{XiMpLe.node} to be pasted as the \code{<dialog>} section
+#' (but only if \code{provides} includes \code{"dialog"} as well). See
+#' \code{\link[rkwarddev:rk.XML.dialog]{rk.XML.dialog}} for details.
+#' @param wizard An object of class \code{XiMpLe.node} to be pasted as the \code{<wizard>} section
+#' (but only if \code{provides} includes \code{"wizard"} as well). See
+#' \code{\link[rkwarddev:rk.XML.wizard]{rk.XML.wizard}} for details.
#' @param logic An object of class \code{XiMpLe.node} to be pasted as the \code{<logic>} section
#' (but only if \code{provides} includes \code{"logic"} as well). See
#' \code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}} for details.
#' @param provides Character vector with at least one entry of \code{"logic"}, \code{"dialog"} or \code{"wizard"}, defining what the document provides.
#' If \code{"logic"} is specified, a logic section will be added to the document. If \code{logic=NULL}, must be edited manually and is therefore commented out.
+#' @param help Logical, if \code{TRUE} an include tag for a help file named \emph{"<name>.rkh"} will be added to the header.
#' @param pluginmap Character string, relative path to the pluginmap file, which will then be included in the head of this document.
#' @return An object of class \code{XiMpLe.doc}.
#' @export
@@ -24,12 +27,12 @@
#' "Second Option"=c(val="val2", chk=TRUE)))
#' # combine the above into a tabbook
#' test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
-#' "Second Tab"), children=list(test.checkboxes, test.dropdown))
+#' "Second Tab"), dialog=list(test.checkboxes, test.dropdown))
#' # make a plugin with that tabbook
-#' test.plugin <- rk.XML.plugin("My test", label="Check this out", children=test.tabbook)
+#' test.plugin <- rk.XML.plugin("My test", label="Check this out", dialog=test.tabbook)
#' cat(pasteXMLTree(test.plugin, shine=1))
-rk.XML.plugin <- function(name, label, children=list(), wiz.children=list(), help=TRUE, logic=NULL, provides=c("logic", "dialog"), pluginmap=NULL){
+rk.XML.plugin <- function(name, label, dialog=NULL, wizard=NULL, logic=NULL, provides=c("logic", "dialog"), help=TRUE, pluginmap=NULL){
name.orig <- name
name <- gsub("[[:space:]]*[^[:alnum:]]*", "", name)
if(!identical(name.orig, name)){
@@ -85,32 +88,50 @@
} else {}
if("dialog" %in% provides){
- plugin.dialog <- new("XiMpLe.node",
- name="dialog",
- attributes=list(label=label),
- value="")
- if(length(children) > 0){
- plugin.dialog at children <- child.list(children)
- } else {}
- all.children[[length(all.children)+1]] <- plugin.dialog
+ if(is.null(dialog)){
+ all.children[[length(all.children)+1]] <- new("XiMpLe.node",
+ name="dialog",
+ attributes=list(label=label),
+ value="")
+ } else {
+ # check if this is *really* a dialog section
+ if(inherits(dialog, "XiMpLe.node")){
+ dialog.node.name <- dialog at name
+ } else {
+ dialog.node.name <- "yougottabekiddingme"
+ }
+ if(!identical(dialog.node.name, "dialog")){
+ stop(simpleError("I don't know what this is, but 'dialog' is not a dialog section!"))
+ } else {}
+ all.children[[length(all.children)+1]] <- dialog
+ }
} else {}
if("wizard" %in% provides){
- ## TODO: wizard code
- # create a first page for the wizard section
- plugin.wizard.page <- new("XiMpLe.node",
- name="page",
- attributes=list(label=label),
- value="")
- if(length(wiz.children) > 0){
- plugin.wizard.page at children <- child.list(wiz.children)
- } else {}
- plugin.wizard <- new("XiMpLe.node",
- name="wizard",
- attributes=list(label=label),
- children=child.list(plugin.wizard.page),
- value="")
- all.children[[length(all.children)+1]] <- plugin.wizard
+ if(is.null(wizard)){
+ # create a first page for the wizard section
+ plugin.wizard.page <- new("XiMpLe.node",
+ name="page",
+ attributes=list(label=label),
+ value="")
+ plugin.wizard <- new("XiMpLe.node",
+ name="wizard",
+ attributes=list(label=label),
+ children=child.list(plugin.wizard.page),
+ value="")
+ all.children[[length(all.children)+1]] <- plugin.wizard
+ } else {
+ # check if this is *really* a wizard section
+ if(inherits(wizard, "XiMpLe.node")){
+ wizard.node.name <- wizard at name
+ } else {
+ wizard.node.name <- "yougottabekiddingme"
+ }
+ if(!identical(wizard.node.name, "wizard")){
+ stop(simpleError("I don't know what this is, but 'wizard' is not a wizard section!"))
+ } else {}
+ all.children[[length(all.children)+1]] <- wizard
+ }
}
top.doc <- new("XiMpLe.node",
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -1,8 +1,11 @@
#' Create a variable selector for RKWard plugins
#'
-#' This function will create a <frame> node including a <varselector> and a <varslot> node.
+#' This function will create a <frame> node including a <varselector> and a <varslot> node. It is
+#' actually a wrapper for \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}} and
+#' \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}}, since you usually won't define one
+#' without the other.
#'
-#' @param label Character string, a text label for the whole frame.
+#' @param label Character string, a text label for the variable browser.
#' @param slot.text Character string, a text label for the variable selection slot.
#' @param required Logical, whether the selection of variables is mandatory or not.
#' @param multi Logical, whether the varslot holds only one or several objects.
@@ -24,33 +27,39 @@
#' @param horiz Logical. If \code{TRUE}, the varslot will be placed next to the selector,
#' if \code{FALSE} below it.
#' @param add.nodes A list of objects of class \code{XiMpLe.node} to be placed after the varslot.
+#' @param frame.label Character string, a text label for the whole frame.
#' @param id.name Character vector, unique IDs for the frame (first entry), the varselector (second entry)
#' and varslot (third entry).
#' If \code{"auto"}, IDs will be generated automatically from \code{label} and \code{slot.text}.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @seealso
+#' \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}},
+#' \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}}
#' @examples
#' test.vars <- rk.XML.vars("Select some vars", "Vars go here")
#' cat(pasteXMLNode(test.vars, shine=1))
rk.XML.vars <- function(label, slot.text, required=FALSE, multi=FALSE, min=1, any=1, max=0,
- dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, horiz=TRUE, add.nodes=NULL, id.name="auto"){
+ dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, horiz=TRUE, add.nodes=NULL, frame.label=NULL, id.name="auto"){
if(identical(id.name, "auto")){
## if this ID generation get's changed, change it in rk.XML.varslot(), too!
var.sel.attr <- list(id=auto.ids(label, prefix=ID.prefix("varselector", length=3)))
- var.slot.id <- auto.ids(label, prefix=ID.prefix("varslot", length=4))
+ var.slot.id <- auto.ids(slot.text, prefix=ID.prefix("varslot", length=4))
} else if(!is.null(id.name)){
var.sel.attr <- list(id=id.name[[2]])
var.slot.id <- id.name[[3]]
} else {}
-
- v.selector <- new("XiMpLe.node",
- name="varselector",
- attributes=var.sel.attr)
+ var.sel.attr[["label"]] <- label
+
+ v.selector <- rk.XML.varselector(
+ label=label,
+ id.name=var.sel.attr[["id"]])
+
v.slot <- rk.XML.varslot(
label=slot.text,
- source=var.sel.attr[["id"]],
+ source=v.selector,
required=required,
multi=multi,
min=min,
@@ -79,7 +88,7 @@
vars.frame <- rk.XML.frame(
children=child.list(aligned.chld),
- label=label,
+ label=frame.label,
id.name=id.name[[1]])
return(vars.frame)
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varselector.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varselector.R (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varselector.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,29 @@
+#' Create node "varselector" for RKWard plugins
+#'
+#' @param label Character string, a text label for the variable selection slot.
+#' @param id.name Character vector, unique ID for this element.
+#' @return An object of class \code{XiMpLe.node}.
+#' @export
+#' @seealso
+#' \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}},
+#' \code{\link[rkwarddev:rk.XML.vars]{rk.XML.vars}}
+#' @examples
+#' test.varselector <- rk.XML.varselector("Select some vars")
+#' cat(pasteXMLNode(test.varselector, shine=1))
+
+rk.XML.varselector <- function(label, id.name="auto"){
+ if(identical(id.name, "auto")){
+ ## if this ID generation get's changed, change it in rk.XML.vars(), too!
+ attr.list <- list(id=auto.ids(label, prefix=ID.prefix("varselector", length=3)))
+ } else if(!is.null(id.name)){
+ attr.list <- list(id=id.name)
+ } else {}
+
+ attr.list[["label"]] <- label
+
+ node <- new("XiMpLe.node",
+ name="varselector",
+ attributes=attr.list)
+
+ return(node)
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -1,8 +1,9 @@
#' Create a XML node "varslot" for RKWard plugins
#'
#' @param label Character string, a text label for the varslot.
-#' @param source Character string with either the \code{id} name of the \code{varselector} to select variables
-#' from, or the label value used for that \code{varselector} (if \code{src.label=TRUE}).
+#' @param source Either a character string (the \code{id} name of the \code{varselector} to select variables
+#' from), or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used, must be
+#' a \code{<varselector>} node).
#' @param required Logical, whether the selection of variables is mandatory or not.
#' @param multi Logical, whether the varslot holds only one or several objects.
#' @param min If \code{multi=TRUE} defines how many objects must be selected.
@@ -20,22 +21,29 @@
#' types. Valid types are "unknown", "number", "string", "factor", "invalid". Optional, use with great care,
#' the user should not be prevented from making valid choices, and rkward does not always know the type
#' of a variable!
-#' @param src.label Logical, determines how to treat \code{source}. If \code{TRUE}, the value of \code{source}
-#' is assumed to be the label rather than the ID of the corresponding \code{varselector}. The ID is then generated
-#' automatically, using the same heuristics as \code{\link[rkwarddev:rk.XML.vars]{rk.XML.vars}}. This
-#' ensures the IDs are identical without needing to know them beforehand.
#' @param id.name Character vector, unique ID for the varslot.
#' If \code{"auto"}, the ID will be generated automatically from \code{label}.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @seealso
+#' \code{\link[rkwarddev:rk.XML.vars]{rk.XML.vars}},
+#' \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}}
#' @examples
#' \dontrun{
-#' test.varslot <- rk.XML.varslot("Vars go here", sources=c("selector.id"))
+#' test.varselector <- rk.XML.varselector("Select some vars")
+#' test.varslot <- rk.XML.varslot("Vars go here", source=test.varselector)
#' cat(pasteXMLNode(test.varslot, shine=1))
#' }
rk.XML.varslot <- function(label, source, required=FALSE, multi=FALSE, min=1, any=1, max=0,
- dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, src.label=FALSE, id.name="auto"){
+ dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, id.name="auto"){
+ if(inherits(source, "XiMpLe.node")){
+ source.name <- source at name
+ if(!identical(source.name, "varselector")){
+ stop(simpleError(paste("'source' must be a <varselector> node! You provided: <", source.name, ">", sep="")))
+ } else {}
+ } else {}
+
if(identical(id.name, "auto")){
var.slot.attr <- list(id=auto.ids(label, prefix=ID.prefix("varslot", length=4)))
} else if(!is.null(id.name)){
@@ -44,12 +52,7 @@
var.slot.attr[["label"]] <- label
- if(isTRUE(src.label)){
- # grab this from rk.XML.vars()
- var.slot.attr[["source"]] <- auto.ids(source, prefix=ID.prefix("varselector", length=3))
- } else {
- var.slot.attr[["source"]] <- source
- }
+ var.slot.attr[["source"]] <- check.ID(source)
if(!is.null(classes)){
var.slot.attr[["classes"]] <- paste(classes, collapse=" ")
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.wizard.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.wizard.R (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.wizard.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,41 @@
+#' Create XML wizard section for RKWard plugins
+#'
+#' This function will create a wizard section with optional child nodes "browser", "checkbox",
+#' "column", "copy", "dropdown", "formula", "frame", "input", "page", "radio", "row", "saveobject",
+#' "spinbox", "stretch", "tabbook", "text", "varselector" and "varslot".
+#'
+#' @param nodes A (list of) objects of class \code{XiMpLe.node}.
+#' @return A list of objects of class \code{XiMpLe.node}.
+#' @export
+#' @seealso
+#' \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}},
+#' \code{\link[rkwarddev:rk.plugin.skeleton]{rk.plugin.skeleton}}
+#' @examples
+#' # define a checkbox for the actual dialog
+#' test.cbox1 <- rk.XML.cbox(label="More than 30 subjects", val="true")
+#' # define the wizard
+#' test.text <- rk.XML.text("Did you test more than 30 subjects?")
+#' test.copy <- rk.XML.copy(id=test.cbox1)
+#' test.wizard <- rk.XML.wizard(rk.XML.page(list(test.text, test.copy)))
+#' cat(pasteXMLNode(test.wizard, shine=1))
+
+rk.XML.wizard <- function(nodes){
+ # check the node names and allow only valid ones
+ node.names <- sapply(child.list(nodes), function(this.node){
+ this.node at name
+ })
+
+ invalid.sets <- !node.names %in% c("browser", "checkbox", "column", "copy",
+ "dropdown", "formula", "frame", "input", "page", "radio", "row", "saveobject",
+ "spinbox", "stretch", "tabbook", "text", "varselector", "varslot")
+ if(any(invalid.sets)){
+ stop(simpleError(paste("Invalid XML nodes for wizard section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
+ } else {}
+
+ node <- new("XiMpLe.node",
+ name="wizard",
+ children=child.list(nodes)
+ )
+
+ return(node)
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -6,19 +6,23 @@
#' See \code{\link[rkwarddev:rk.XML.about]{rk.XML.about}} for details and a full list of elements!
#' If \code{NULL}, no \code{DESCRIPTION} file will be created either.
#' @param path Character sting, path to the main directory where the skeleton should be created.
-#' @param dialog A list of objects of class XiMpLe.node. If provided, will be included in the
-#' created plugin XML file as the dialog.
-#' @param wiz.dialog Like \code{dialog}, but will be included as the wizard dialog code (and only if \code{wizard=TRUE} as well).
+#' @param dialog An object of class \code{XiMpLe.node} to be pasted as the \code{<dialog>} section
+#' (but only if \code{provides} includes \code{"dialog"} as well). See
+#' \code{\link[rkwarddev:rk.XML.dialog]{rk.XML.dialog}} for details.
+#' @param wizard An object of class \code{XiMpLe.node} to be pasted as the \code{<wizard>} section
+#' (but only if \code{provides} includes \code{"wizard"} as well). See
+#' \code{\link[rkwarddev:rk.XML.wizard]{rk.XML.wizard}} for details.
+#' @param logic An object of class \code{XiMpLe.node} to be pasted as the \code{<logic>} section
+#' (but only if \code{provides} includes \code{"logic"} as well). See
+#' \code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}} for details.
+#' @param provides Character vector with at least one entry of \code{"logic"}, \code{"dialog"} or \code{"wizard"}, defining what the plugin XML provides.
+#' If \code{"logic"} is specified, a logic section will be added to the document. If \code{logic=NULL}, must be edited manually and is therefore commented out.
#' @param dial.require A character vector with names of R packages that the dialog requires.
#' @param overwrite Logical, whether existing files should be replaced. Defaults to \code{FALSE}.
-#' @param wizard Logical, whether a \code{<wizard>} section should be added to the \code{<dialog>} section.
-#' Defaults to \code{FALSE}.
#' @param tests Logical, whether directories and files for plugin tests should be created.
#' Defaults to \code{TRUE}.
#' @param lazyLoad Logical, whether the package should be prepared for lazy loading or not. Should be left \code{TRUE},
#' unless you have very good reasons not to.
-#' @param logic An object of class \code{XiMpLe.node} to be pasted as the \code{<logic>} section (see
-#' \code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}}.
#' @param JS.prep A character string with JavaScript code to be included in the \code{preprocess()} function. This string will be
#' pasted as-is, see \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}}.
#' @param JS.calc A character string with JavaScript code to be included in the \code{calculate()} function. This string will be
@@ -89,17 +93,15 @@
#' rk.XML.cbox(label="bar", val="bar2"))
#' ))
#' test.vars <- rk.XML.vars("select some vars", "vars go here")
-#' test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
-#' "Second Tab"), children=list(test.checkboxes, test.vars))
-#' test.plugin <- rk.XML.plugin("My test", label="Check this out",
-#' children=test.tabbook)
+#' test.tabbook <- rk.XML.dialog(rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
+#' "Second Tab"), children=list(test.checkboxes, test.vars)))
#'
#' rk.plugin.skeleton("Square the Circle", about=about.info,
#' dialog=test.tabbook, overwrite=TRUE)
#' }
-rk.plugin.skeleton <- function(name, about=NULL, path=tempdir(), dialog=list(), wiz.dialog=list(),
- dial.require=c(), overwrite=FALSE, wizard=FALSE, tests=TRUE, lazyLoad=TRUE, logic=NULL,
+rk.plugin.skeleton <- function(name, about=NULL, path=tempdir(), dialog=NULL, wizard=NULL, logic=NULL,
+ provides=c("logic", "dialog"), dial.require=c(), overwrite=FALSE, tests=TRUE, lazyLoad=TRUE,
JS.prep=NULL, JS.calc=NULL, JS.prnt=NULL, create=c("pmap", "xml", "js", "rkh", "desc"), edit=FALSE){
# to besure, remove all non-character symbols from name
name.orig <- name
@@ -171,18 +173,13 @@
## create plugin.xml
if("xml" %in% create & isTRUE(checkCreateFiles(plugin.xml))){
- if(isTRUE(wizard))
- plugin.provides <- c("logic","dialog","wizard")
- else {
- plugin.provides <- c("logic","dialog")
- }
XML.plugin <- rk.XML.plugin(
name=name,
label=name.orig,
- children=dialog,
- wiz.children=wiz.dialog,
+ dialog=dialog,
+ wizard=wizard,
logic=logic,
- provides=plugin.provides,
+ provides=provides,
pluginmap=paste("../", name, ".pluginmap", sep=""))
cat(pasteXMLTree(XML.plugin, shine=1), file=plugin.xml)
if(isTRUE(edit)){
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R 2011-09-26 13:07:50 UTC (rev 3839)
@@ -3,8 +3,8 @@
#' \tabular{ll}{
#' Package: \tab rkwarddev\cr
#' Type: \tab Package\cr
-#' Version: \tab 0.01-5\cr
-#' Date: \tab 2011-09-25\cr
+#' Version: \tab 0.02-0\cr
+#' Date: \tab 2011-09-26\cr
#' Depends: \tab R (>= 2.9.0),XiMpLe,rkward\cr
#' Enhances: \tab rkward\cr
#' Encoding: \tab UTF-8\cr
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION 2011-09-26 13:07:50 UTC (rev 3839)
@@ -2,12 +2,12 @@
title="rkwarddev: A collection of tools for RKWard plugin development",
author="Meik Michalke",
year="2011",
- note="(Version 0.01-5)",
+ note="(Version 0.02-0)",
url="http://rkward.sourceforge.net",
textVersion =
paste("Michalke, M. (2011). ",
- "rkwarddev: A collection of tools for RKWard plugin development (Version 0.01-5). ",
+ "rkwarddev: A collection of tools for RKWard plugin development (Version 0.02-0). ",
"Available from http://rkward.sourceforge.net",
sep=""),
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.convert.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.convert.Rd 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.convert.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -38,7 +38,8 @@
\item{id.name}{Character string, a unique ID for this
plugin element. If \code{"auto"}, an ID will be generated
- automatically from the sources and mode value.}
+ automatically from the \code{sources} and \code{mode}
+ value.}
}
\value{
A list of objects of class \code{XiMpLe.node}.
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.copy.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.copy.Rd (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.copy.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,37 @@
+\name{rk.XML.copy}
+\alias{rk.XML.copy}
+\title{Create XML copy node for RKWard plugins}
+\usage{
+ rk.XML.copy(id, as = NULL)
+}
+\arguments{
+ \item{id}{Either a character string (the \code{id} of the
+ property to be copied), or an object of class
+ \code{XiMpLe.node} (whose \code{id} will be extracted and
+ used).}
+
+ \item{as}{A character string resembling the
+ \code{copy_element_tag_name} value. I.e., must be a valid
+ tag name. Will cause a change of tag name of the
+ \code{id} (e.g. "tab") to \code{as} (e.g. "page").}
+}
+\value{
+ A list of objects of class \code{XiMpLe.node}.
+}
+\description{
+ Create XML copy node for RKWard plugins
+}
+\examples{
+# define a checkbox for the actual dialog
+test.cbox1 <- rk.XML.cbox(label="More than 30 subjects", val="true")
+# define the wizard
+test.text <- rk.XML.text("Did you test more than 30 subjects?")
+test.copy <- rk.XML.copy(id=test.cbox1)
+test.wizard <- rk.XML.wizard(rk.XML.page(list(test.text, test.copy)))
+cat(pasteXMLNode(test.wizard, shine=1))
+}
+\seealso{
+ \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}},
+ \code{\link[rkwarddev:rk.plugin.skeleton]{rk.plugin.skeleton}}
+}
+
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dialog.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dialog.Rd (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dialog.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,33 @@
+\name{rk.XML.dialog}
+\alias{rk.XML.dialog}
+\title{Create XML dialog section for RKWard plugins}
+\usage{
+ rk.XML.dialog(nodes)
+}
+\arguments{
+ \item{nodes}{A (list of) objects of class
+ \code{XiMpLe.node}.}
+}
+\value{
+ A list of objects of class \code{XiMpLe.node}.
+}
+\description{
+ This function will create a dialog section with optional
+ child nodes "browser", "checkbox", "column", "copy",
+ "dropdown", "formula", "frame", "input", "radio", "row",
+ "saveobject", "spinbox", "stretch", "tabbook", "text",
+ "varselector" and "varslot".
+}
+\examples{
+# define an input field and two checkboxes
+test.input <- rk.XML.input("Type some text")
+test.cbox1 <- rk.XML.cbox(label="Want to type?", val="true")
+test.cbox2 <- rk.XML.cbox(label="Are you shure?", val="true")
+test.dialog <- rk.XML.dialog(rk.XML.col(list(test.input, test.cbox1, test.cbox2)))
+cat(pasteXMLNode(test.dialog, shine=1))
+}
+\seealso{
+ \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}},
+ \code{\link[rkwarddev:rk.plugin.skeleton]{rk.plugin.skeleton}}
+}
+
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.formula.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.formula.Rd 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.formula.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -2,7 +2,7 @@
\alias{rk.XML.formula}
\title{Create XML node "formula" for RKWard plugins}
\usage{
- rk.XML.formula(fixed, dependent)
+ rk.XML.formula(fixed, dependent, id.name = "auto")
}
\arguments{
\item{fixed}{The \code{id} of the varslot holding the
@@ -10,15 +10,29 @@
\item{dependent}{The \code{id} of the varslot holding the
selected dependent variable.}
+
+ \item{id.name}{Character string, a unique ID for this
+ plugin element. If \code{"auto"}, an ID will be generated
+ automatically from the \code{fixed} and \code{dependent}
+ value.}
}
\value{
An object of class \code{XiMpLe.node}.
}
\description{
- Create XML node "formula" for RKWard plugins
+ If \code{fixed} or \code{dependent} are objects of class
+ \code{XiMpLe.node}, their \code{id} will be extracted and
+ used.
}
\examples{
-test.formula <- rk.XML.formula(fixed="vrs.one", dependent="vsr.two")
+test.varselector <- rk.XML.varselector("Select some vars")
+test.varslot1 <- rk.XML.varslot("Fixed factors", source=test.varselector)
+test.varslot2 <- rk.XML.varslot("Dependent variables", source=test.varselector)
+test.formula <- rk.XML.formula(fixed=test.varslot1, dependent=test.varslot2)
cat(pasteXMLNode(test.formula, shine=1))
}
+\seealso{
+ \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}},
+ \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}}
+}
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.page.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.page.Rd (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.page.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,34 @@
+\name{rk.XML.page}
+\alias{rk.XML.page}
+\title{Create XML page node for RKWard plugins}
+\usage{
+ rk.XML.page(nodes)
+}
+\arguments{
+ \item{nodes}{A (list of) objects of class
+ \code{XiMpLe.node}.}
+}
+\value{
+ A list of objects of class \code{XiMpLe.node}.
+}
+\description{
+ This function will create a page node for wizard
+ sections, with optional child nodes "browser",
+ "checkbox", "column", "copy", "dropdown", "formula",
+ "frame", "input", "page", "radio", "row", "saveobject",
+ "spinbox", "stretch", "tabbook", "text", "varselector"
+ and "varslot".
+}
+\examples{
+# define a checkbox for the actual dialog
+test.cbox1 <- rk.XML.cbox(label="More than 30 subjects", val="true")
+# define the wizard
+test.text <- rk.XML.text("Did you test more than 30 subjects?")
+test.copy <- rk.XML.copy(id.name=test.cbox1)
+test.wizard <- rk.XML.wizard(rk.XML.page(list(test.text, test.copy)))
+cat(pasteXMLNode(test.wizard, shine=1))
+}
+\seealso{
+ \code{\link[rkwarddev:rk.XML.wizard]{rk.XML.wizard}}
+}
+
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -2,9 +2,9 @@
\alias{rk.XML.plugin}
\title{Create XML document for RKWard plugins}
\usage{
- rk.XML.plugin(name, label, children = list(),
- wiz.children = list(), help = TRUE, logic = NULL,
- provides = c("logic", "dialog"), pluginmap = NULL)
+ rk.XML.plugin(name, label, dialog = NULL, wizard = NULL,
+ logic = NULL, provides = c("logic", "dialog"), help =
+ TRUE, pluginmap = NULL)
}
\arguments{
\item{name}{Character string, the name of the plugin.}
@@ -12,19 +12,18 @@
\item{label}{Character string, a text label for the
plugin's top level, i.e. the window title of the dialog.}
- \item{children}{An optional list with objects of class
- \code{XiMpLe.node}. Will be included inside the top level
- node as the dialog code.}
+ \item{dialog}{An object of class \code{XiMpLe.node} to be
+ pasted as the \code{<dialog>} section (but only if
+ \code{provides} includes \code{"dialog"} as well). See
+ \code{\link[rkwarddev:rk.XML.dialog]{rk.XML.dialog}} for
+ details.}
- \item{wiz.children}{An optional list with objects of
- class \code{XiMpLe.node}. Will be included inside the top
- level node as the wizard code (but only if
- \code{provides} includes \code{"wizard"} as well).}
+ \item{wizard}{An object of class \code{XiMpLe.node} to be
+ pasted as the \code{<wizard>} section (but only if
+ \code{provides} includes \code{"wizard"} as well). See
+ \code{\link[rkwarddev:rk.XML.wizard]{rk.XML.wizard}} for
+ details.}
- \item{help}{Logical, if \code{TRUE} an include tag for a
- help file named \emph{"<name>.rkh"} will be added to the
- header.}
-
\item{logic}{An object of class \code{XiMpLe.node} to be
pasted as the \code{<logic>} section (but only if
\code{provides} includes \code{"logic"} as well). See
@@ -38,6 +37,10 @@
If \code{logic=NULL}, must be edited manually and is
therefore commented out.}
+ \item{help}{Logical, if \code{TRUE} an include tag for a
+ help file named \emph{"<name>.rkh"} will be added to the
+ header.}
+
\item{pluginmap}{Character string, relative path to the
pluginmap file, which will then be included in the head
of this document.}
@@ -58,9 +61,9 @@
"Second Option"=c(val="val2", chk=TRUE)))
# combine the above into a tabbook
test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
-"Second Tab"), children=list(test.checkboxes, test.dropdown))
+"Second Tab"), dialog=list(test.checkboxes, test.dropdown))
# make a plugin with that tabbook
-test.plugin <- rk.XML.plugin("My test", label="Check this out", children=test.tabbook)
+test.plugin <- rk.XML.plugin("My test", label="Check this out", dialog=test.tabbook)
cat(pasteXMLTree(test.plugin, shine=1))
}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -5,11 +5,12 @@
rk.XML.vars(label, slot.text, required = FALSE, multi =
FALSE, min = 1, any = 1, max = 0, dim = 0, min.len = 0,
max.len = NULL, classes = NULL, types = NULL, horiz =
- TRUE, add.nodes = NULL, id.name = "auto")
+ TRUE, add.nodes = NULL, frame.label = NULL, id.name =
+ "auto")
}
\arguments{
- \item{label}{Character string, a text label for the whole
- frame.}
+ \item{label}{Character string, a text label for the
+ variable browser.}
\item{slot.text}{Character string, a text label for the
variable selection slot.}
@@ -56,6 +57,9 @@
\item{add.nodes}{A list of objects of class
\code{XiMpLe.node} to be placed after the varslot.}
+ \item{frame.label}{Character string, a text label for the
+ whole frame.}
+
\item{id.name}{Character vector, unique IDs for the frame
(first entry), the varselector (second entry) and varslot
(third entry). If \code{"auto"}, IDs will be generated
@@ -66,10 +70,19 @@
}
\description{
This function will create a <frame> node including a
- <varselector> and a <varslot> node.
+ <varselector> and a <varslot> node. It is actually a
+ wrapper for
+ \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}}
+ and
+ \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}},
+ since you usually won't define one without the other.
}
\examples{
test.vars <- rk.XML.vars("Select some vars", "Vars go here")
cat(pasteXMLNode(test.vars, shine=1))
}
+\seealso{
+ \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}},
+ \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}}
+}
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varselector.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varselector.Rd (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varselector.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,28 @@
+\name{rk.XML.varselector}
+\alias{rk.XML.varselector}
+\title{Create node "varselector" for RKWard plugins}
+\usage{
+ rk.XML.varselector(label, id.name = "auto")
+}
+\arguments{
+ \item{label}{Character string, a text label for the
+ variable selection slot.}
+
+ \item{id.name}{Character vector, unique ID for this
+ element.}
+}
+\value{
+ An object of class \code{XiMpLe.node}.
+}
+\description{
+ Create node "varselector" for RKWard plugins
+}
+\examples{
+test.varselector <- rk.XML.varselector("Select some vars")
+cat(pasteXMLNode(test.varselector, shine=1))
+}
+\seealso{
+ \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}},
+ \code{\link[rkwarddev:rk.XML.vars]{rk.XML.vars}}
+}
+
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -4,17 +4,18 @@
\usage{
rk.XML.varslot(label, source, required = FALSE, multi =
FALSE, min = 1, any = 1, max = 0, dim = 0, min.len = 0,
- max.len = NULL, classes = NULL, types = NULL, src.label =
- FALSE, id.name = "auto")
+ max.len = NULL, classes = NULL, types = NULL, id.name =
+ "auto")
}
\arguments{
\item{label}{Character string, a text label for the
varslot.}
- \item{source}{Character string with either the \code{id}
- name of the \code{varselector} to select variables from,
- or the label value used for that \code{varselector} (if
- \code{src.label=TRUE}).}
+ \item{source}{Either a character string (the \code{id}
+ name of the \code{varselector} to select variables from),
+ or an object of class \code{XiMpLe.node} (whose \code{id}
+ will be extracted and used, must be a
+ \code{<varselector>} node).}
\item{required}{Logical, whether the selection of
variables is mandatory or not.}
@@ -52,15 +53,6 @@
user should not be prevented from making valid choices,
and rkward does not always know the type of a variable!}
- \item{src.label}{Logical, determines how to treat
- \code{source}. If \code{TRUE}, the value of \code{source}
- is assumed to be the label rather than the ID of the
- corresponding \code{varselector}. The ID is then
- generated automatically, using the same heuristics as
- \code{\link[rkwarddev:rk.XML.vars]{rk.XML.vars}}. This
- ensures the IDs are identical without needing to know
- them beforehand.}
-
\item{id.name}{Character vector, unique ID for the
varslot. If \code{"auto"}, the ID will be generated
automatically from \code{label}.}
@@ -73,8 +65,13 @@
}
\examples{
\dontrun{
-test.varslot <- rk.XML.varslot("Vars go here", sources=c("selector.id"))
+test.varselector <- rk.XML.varselector("Select some vars")
+test.varslot <- rk.XML.varslot("Vars go here", source=test.varselector)
cat(pasteXMLNode(test.varslot, shine=1))
}
}
+\seealso{
+ \code{\link[rkwarddev:rk.XML.vars]{rk.XML.vars}},
+ \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}}
+}
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.wizard.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.wizard.Rd (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.wizard.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -0,0 +1,34 @@
+\name{rk.XML.wizard}
+\alias{rk.XML.wizard}
+\title{Create XML wizard section for RKWard plugins}
+\usage{
+ rk.XML.wizard(nodes)
+}
+\arguments{
+ \item{nodes}{A (list of) objects of class
+ \code{XiMpLe.node}.}
+}
+\value{
+ A list of objects of class \code{XiMpLe.node}.
+}
+\description{
+ This function will create a wizard section with optional
+ child nodes "browser", "checkbox", "column", "copy",
+ "dropdown", "formula", "frame", "input", "page", "radio",
+ "row", "saveobject", "spinbox", "stretch", "tabbook",
+ "text", "varselector" and "varslot".
+}
+\examples{
+# define a checkbox for the actual dialog
+test.cbox1 <- rk.XML.cbox(label="More than 30 subjects", val="true")
+# define the wizard
+test.text <- rk.XML.text("Did you test more than 30 subjects?")
+test.copy <- rk.XML.copy(id=test.cbox1)
+test.wizard <- rk.XML.wizard(rk.XML.page(list(test.text, test.copy)))
+cat(pasteXMLNode(test.wizard, shine=1))
+}
+\seealso{
+ \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}},
+ \code{\link[rkwarddev:rk.plugin.skeleton]{rk.plugin.skeleton}}
+}
+
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -3,11 +3,11 @@
\title{Create skeleton for RKWard plugins}
\usage{
rk.plugin.skeleton(name, about = NULL, path = tempdir(),
- dialog = list(), wiz.dialog = list(), dial.require = c(),
- overwrite = FALSE, wizard = FALSE, tests = TRUE, lazyLoad
- = TRUE, logic = NULL, JS.prep = NULL, JS.calc = NULL,
- JS.prnt = NULL, create = c("pmap", "xml", "js", "rkh",
- "desc"), edit = FALSE)
+ dialog = NULL, wizard = NULL, logic = NULL, provides =
+ c("logic", "dialog"), dial.require = c(), overwrite =
+ FALSE, tests = TRUE, lazyLoad = TRUE, JS.prep = NULL,
+ JS.calc = NULL, JS.prnt = NULL, create = c("pmap", "xml",
+ "js", "rkh", "desc"), edit = FALSE)
}
\arguments{
\item{name}{Character sting, name of the plugin package.}
@@ -22,24 +22,37 @@
\item{path}{Character sting, path to the main directory
where the skeleton should be created.}
- \item{dialog}{A list of objects of class XiMpLe.node. If
- provided, will be included in the created plugin XML file
- as the dialog.}
+ \item{dialog}{An object of class \code{XiMpLe.node} to be
+ pasted as the \code{<dialog>} section (but only if
+ \code{provides} includes \code{"dialog"} as well). See
+ \code{\link[rkwarddev:rk.XML.dialog]{rk.XML.dialog}} for
+ details.}
- \item{wiz.dialog}{Like \code{dialog}, but will be
- included as the wizard dialog code (and only if
- \code{wizard=TRUE} as well).}
+ \item{wizard}{An object of class \code{XiMpLe.node} to be
+ pasted as the \code{<wizard>} section (but only if
+ \code{provides} includes \code{"wizard"} as well). See
+ \code{\link[rkwarddev:rk.XML.wizard]{rk.XML.wizard}} for
+ details.}
+ \item{logic}{An object of class \code{XiMpLe.node} to be
+ pasted as the \code{<logic>} section (but only if
+ \code{provides} includes \code{"logic"} as well). See
+ \code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}} for
+ details.}
+
+ \item{provides}{Character vector with at least one entry
+ of \code{"logic"}, \code{"dialog"} or \code{"wizard"},
+ defining what the plugin XML provides. If \code{"logic"}
+ is specified, a logic section will be added to the
+ document. If \code{logic=NULL}, must be edited manually
+ and is therefore commented out.}
+
\item{dial.require}{A character vector with names of R
packages that the dialog requires.}
\item{overwrite}{Logical, whether existing files should
be replaced. Defaults to \code{FALSE}.}
- \item{wizard}{Logical, whether a \code{<wizard>} section
- should be added to the \code{<dialog>} section. Defaults
- to \code{FALSE}.}
-
\item{tests}{Logical, whether directories and files for
plugin tests should be created. Defaults to \code{TRUE}.}
@@ -47,10 +60,6 @@
prepared for lazy loading or not. Should be left
\code{TRUE}, unless you have very good reasons not to.}
- \item{logic}{An object of class \code{XiMpLe.node} to be
- pasted as the \code{<logic>} section (see
- \code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}}.}
-
\item{JS.prep}{A character string with JavaScript code to
be included in the \code{preprocess()} function. This
string will be pasted as-is, see
@@ -138,10 +147,8 @@
rk.XML.cbox(label="bar", val="bar2"))
))
test.vars <- rk.XML.vars("select some vars", "vars go here")
-test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
-"Second Tab"), children=list(test.checkboxes, test.vars))
-test.plugin <- rk.XML.plugin("My test", label="Check this out",
-children=test.tabbook)
+test.tabbook <- rk.XML.dialog(rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
+"Second Tab"), children=list(test.checkboxes, test.vars)))
rk.plugin.skeleton("Square the Circle", about=about.info,
dialog=test.tabbook, overwrite=TRUE)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd 2011-09-26 13:04:40 UTC (rev 3838)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd 2011-09-26 13:07:50 UTC (rev 3839)
@@ -8,8 +8,8 @@
}
\details{
\tabular{ll}{ Package: \tab rkwarddev\cr Type: \tab
- Package\cr Version: \tab 0.01-5\cr Date: \tab
- 2011-09-25\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward\cr
+ Package\cr Version: \tab 0.02-0\cr Date: \tab
+ 2011-09-26\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward\cr
Enhances: \tab rkward\cr Encoding: \tab UTF-8\cr License:
\tab GPL (>= 3)\cr LazyLoad: \tab yes\cr URL: \tab
http://rkward.sourceforge.net\cr }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list