[rkward-cvs] SF.net SVN: rkward-code:[4540] trunk/rkward/packages/rkwarddev

m-eik at users.sf.net m-eik at users.sf.net
Tue Feb 19 18:46:35 UTC 2013


Revision: 4540
          http://sourceforge.net/p/rkward/code/4540
Author:   m-eik
Date:     2013-02-19 18:46:33 +0000 (Tue, 19 Feb 2013)
Log Message:
-----------
rkwarddev: optionset example added, improvements to the signatures of rk.XML.optionset() and rk.XML.optioncolumn()

Modified Paths:
--------------
    trunk/rkward/packages/rkwarddev/DESCRIPTION
    trunk/rkward/packages/rkwarddev/NAMESPACE
    trunk/rkward/packages/rkwarddev/R/rk.XML.optioncolumn.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R
    trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
    trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
    trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
    trunk/rkward/packages/rkwarddev/man/rk.XML.optioncolumn.Rd
    trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd
    trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd

Modified: trunk/rkward/packages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/packages/rkwarddev/DESCRIPTION	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/DESCRIPTION	2013-02-19 18:46:33 UTC (rev 4540)
@@ -15,7 +15,7 @@
 Authors at R: c(person(given="Meik", family="Michalke",
     email="meik.michalke at hhu.de", role=c("aut", "cre")))
 Version: 0.06-2
-Date: 2013-02-18
+Date: 2013-02-19
 Collate:
     'echo.R'
     'id.R'

Modified: trunk/rkward/packages/rkwarddev/NAMESPACE
===================================================================
--- trunk/rkward/packages/rkwarddev/NAMESPACE	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/NAMESPACE	2013-02-19 18:46:33 UTC (rev 4540)
@@ -1,40 +1,13 @@
-exportClasses(rk.JS.arr)
-exportClasses(rk.JS.ite)
-exportClasses(rk.JS.opt)
-exportClasses(rk.JS.var)
-exportClasses(rk.plot.opts)
-exportClasses(rk.plug.comp)
 export(echo)
 export(id)
 export(ite)
-exportMethods(show)
 export(qp)
-export(rk.build.plugin)
-export(rk.comment)
 export(rk.JS.array)
 export(rk.JS.doc)
 export(rk.JS.options)
 export(rk.JS.saveobj)
 export(rk.JS.scan)
 export(rk.JS.vars)
-export(rk.paste.JS)
-export(rk.paste.JS.graph)
-export(rk.plotOptions)
-export(rk.plugin.component)
-export(rk.plugin.skeleton)
-export(rk.rkh.caption)
-export(rk.rkh.doc)
-export(rk.rkh.link)
-export(rk.rkh.related)
-export(rk.rkh.scan)
-export(rk.rkh.section)
-export(rk.rkh.setting)
-export(rk.rkh.settings)
-export(rk.rkh.summary)
-export(rk.rkh.technical)
-export(rk.rkh.title)
-export(rk.rkh.usage)
-export(rk.testsuite.doc)
 export(rk.XML.about)
 export(rk.XML.attribute)
 export(rk.XML.browser)
@@ -88,5 +61,32 @@
 export(rk.XML.varselector)
 export(rk.XML.varslot)
 export(rk.XML.wizard)
+export(rk.build.plugin)
+export(rk.comment)
+export(rk.paste.JS)
+export(rk.paste.JS.graph)
+export(rk.plotOptions)
+export(rk.plugin.component)
+export(rk.plugin.skeleton)
+export(rk.rkh.caption)
+export(rk.rkh.doc)
+export(rk.rkh.link)
+export(rk.rkh.related)
+export(rk.rkh.scan)
+export(rk.rkh.section)
+export(rk.rkh.setting)
+export(rk.rkh.settings)
+export(rk.rkh.summary)
+export(rk.rkh.technical)
+export(rk.rkh.title)
+export(rk.rkh.usage)
+export(rk.testsuite.doc)
 export(tf)
+exportClasses(rk.JS.arr)
+exportClasses(rk.JS.ite)
+exportClasses(rk.JS.opt)
+exportClasses(rk.JS.var)
+exportClasses(rk.plot.opts)
+exportClasses(rk.plug.comp)
+exportMethods(show)
 import(methods)

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.optioncolumn.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.optioncolumn.R	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.optioncolumn.R	2013-02-19 18:46:33 UTC (rev 4540)
@@ -5,7 +5,6 @@
 #' @note The \code{<optionset>} node was introduced with RKWard 0.6.1, please set the dependencies
 #'		of your component/plugin accordingly.
 #'
-#' @param id.name Character string, a unique ID for this plugin element.
 #' @param label Either logical or a character string. If given, the optioncolumn will be displayed in the \code{<optiondisplay>} in a column by that label.
 #'		If set to \code{TRUE} and you provide a XiMpLe node object to \code{connect}, the label will be extracted from that node.
 #' @param external Logical, set to \code{TRUE} if the optioncolumn is controlled from outside the optionset.
@@ -15,6 +14,8 @@
 #'		when the property changes inside the content-area.
 #' @param modifier Character string, the modifier of the property to connect to, will be appended to the \code{id} of \code{connect}.
 #' @param default Character string, only for external columns: The value to assume for this column, if no value is known for an entry. Rarely useful.
+#' @param id.name Character string, a unique ID for this plugin element.
+#'		If \code{"auto"}, an ID will be generated automatically from the \code{connect} object.
 #' @return An object of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
@@ -23,11 +24,27 @@
 #'		and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
 #' @examples
 #' myInput <- rk.XML.input(label="Given name(s)", size="small")
-#' myOptCol <- rk.XML.optioncolumn("os_name", connect=myInput, modifier="text")
-rk.XML.optioncolumn <- function(id.name, label=TRUE, external=FALSE, connect=NULL, modifier=NULL, default=NULL){
+#' myOptCol <- rk.XML.optioncolumn(myInput, modifier="text")
+rk.XML.optioncolumn <- function(connect, modifier=NULL, label=TRUE, external=FALSE, default=NULL, id.name="auto"){
 
-	attr.list <- list(id=id.name)
+	connect.id <- check.ID(connect)
+	if(is.XiMpLe.node(connect) && !is.null(modifier)){
+		# validate modifier
+		if(modif.validity(connect, modifier=modifier)){
+			connect.id <- paste(connect.id, modifier, sep=".")
+		} else {}
+	} else {}
 
+	if(identical(id.name, "auto")){
+		attr.list <- list(
+			id=auto.ids(connect.id, prefix=ID.prefix("ocolumn"), chars=10),
+			connect=as.character(connect.id))
+	} else if(!is.null(id.name)){
+		attr.list <- list(id=id.name, connect=as.character(connect.id))
+	} else {
+		stop(simpleError("'id.name' must have a value!"))
+	}
+
 	if(is.logical(label)){
 		if(isTRUE(label)){
 			if(is.XiMpLe.node(connect)){
@@ -43,19 +60,6 @@
 		attr.list[["external"]] <- "true"
 	} else {}
 
-	if(!is.null(connect)){
-		# let's see if we need to extract IDs first
-		connect.id <- check.ID(connect)
-		# if connect is an XML node, append 
-		if(is.XiMpLe.node(connect) && !is.null(modifier)){
-			# validate get modifier
-			if(modif.validity(connect, modifier=modifier)){
-				connect.id <- paste(connect.id, modifier, sep=".")
-			} else {}
-		} else {}
-		attr.list[["connect"]] <- as.character(connect.id)
-	} else {}
-
 	if(!is.null(default)){
 		attr.list[["default"]] <- default
 	} else {}

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R	2013-02-19 18:46:33 UTC (rev 4540)
@@ -14,9 +14,8 @@
 #' @param keycolumn Character
 #' @param logic A valid \code{<logic>} node.
 #' @param optiondisplay Logical value, can be used to automatically add an \code{<optiondisplay>} node on top
-#'		of the \code{<content>} section, if set to something other than \code{NULL}. Depending on whether it's
-#'		\code{TRUE} or \code{FALSE}, its \code{index} argument will be set to \code{"true"} or
-#'		\code{"false"}, respectively.
+#'		of the \code{<content>} section. Depending on whether it's \code{TRUE} or \code{FALSE}, its \code{index}
+#'		argument will be set to \code{"true"} or \code{"false"}, respectively. Set to \code{NULL} to deactivate.
 #' @param id.name Character string, a unique ID for this plugin element.
 #'		If \code{"auto"}, an ID will be generated automatically from the <content> nodes.
 #' @return An object of class \code{XiMpLe.node}.
@@ -25,11 +24,30 @@
 #'		\code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}},
 #'		\code{\link[rkwarddev:rk.XML.optiondisplay]{rk.XML.optiondisplay}},
 #'		and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
-rk.XML.optionset <- function(content, optioncolumn, min_rows=0, min_rows_if_any=0, max_rows=0, keycolumn=NULL, logic=NULL, optiondisplay=NULL, id.name="auto"){
+#' @examples
+#' firstname <- rk.XML.input("Given name(s)")
+#' lastname <- rk.XML.input("Family name")
+#' genderselect <- rk.XML.radio("Gender", options=list(
+#'   Male = c(val="m"),
+#'   Female = c(val="f")))
+#' rk.XML.optionset(
+#'   content = list(
+#'     rk.XML.row(
+#'       firstname,
+#'       lastname,
+#'       genderselect)),
+#'   optioncolumn = list(
+#'     rk.XML.optioncolumn(firstname, modifier="text"),
+#'     rk.XML.optioncolumn(lastname, modifier="text"),
+#'     rk.XML.optioncolumn(genderselect)
+#'   )
+#' )
+rk.XML.optionset <- function(content, optioncolumn, min_rows=0, min_rows_if_any=0, max_rows=0,
+	keycolumn=NULL, logic=NULL, optiondisplay=TRUE, id.name="auto"){
 
 	if(identical(id.name, "auto")){
 		# try autogenerating some id
-		attr.list <- list(id=auto.ids(node.soup(content), prefix=ID.prefix("optionset"), chars=10))
+		attr.list <- list(id=auto.ids(node.soup(content), prefix=ID.prefix("oset"), chars=10))
 	} else if(is.null(id.name)){
 		attr.list <- list()
 	} else {

Modified: trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R	2013-02-19 18:46:33 UTC (rev 4540)
@@ -4,7 +4,7 @@
 #' Package: \tab rkwarddev\cr
 #' Type: \tab Package\cr
 #' Version: \tab 0.06-2\cr
-#' Date: \tab 2013-02-18\cr
+#' Date: \tab 2013-02-19\cr
 #' Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-18),rkward (>= 0.5.6)\cr
 #' Enhances: \tab rkward\cr
 #' Encoding: \tab UTF-8\cr

Modified: trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/NEWS.Rd	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/inst/NEWS.Rd	2013-02-19 18:46:33 UTC (rev 4540)
@@ -1,7 +1,7 @@
 \name{NEWS}
 \title{News for Package 'rkwarddev'}
 \encoding{UTF-8}
-\section{Changes in rkwarddev version 0.06-2 (2013-02-15)}{
+\section{Changes in rkwarddev version 0.06-2 (2013-02-18)}{
   \subsection{changed}{
     \itemize{
       \item the structure of <about> nodes will change in RKWard 0.6.1, <dependencies> will become
@@ -11,6 +11,11 @@
       \item for consistency, from now on <component> is never an empty node
       \item \code{rk.XML.pluginmap()} will now move <dependencies> from <about> to a top level child node
         of plugin maps, with a warning
+      \item the object class rk.JS.var gained a new slot \code{"getter"} to set a default JS function
+        to query variable values. it defaults to \code{"getValue"} to ensure compatibility with earlier
+        releases. consequently, \code{rk.JS.vars()} and \code{rk.paste.JS()} have a new \code{"getter"} argument to set
+        or overwrite this value. another new argument, \code{"guess.getter"}, can be used to turn on
+        automatic guessing which getter function might be most appropriate.
     }
   }
   \subsection{added}{

Modified: trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
===================================================================
(Binary files differ)

Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.optioncolumn.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.optioncolumn.Rd	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.optioncolumn.Rd	2013-02-19 18:46:33 UTC (rev 4540)
@@ -2,14 +2,11 @@
 \alias{rk.XML.optioncolumn}
 \title{Create XML node "optioncolumn" for RKWard plugins}
 \usage{
-  rk.XML.optioncolumn(id.name, label = TRUE,
-    external = FALSE, connect = NULL, modifier = NULL,
-    default = NULL)
+  rk.XML.optioncolumn(connect, modifier = NULL,
+    label = TRUE, external = FALSE, default = NULL,
+    id.name = "auto")
 }
 \arguments{
-  \item{id.name}{Character string, a unique ID for this
-  plugin element.}
-
   \item{label}{Either logical or a character string. If
   given, the optioncolumn will be displayed in the
   \code{<optiondisplay>} in a column by that label.  If set
@@ -37,6 +34,10 @@
   \item{default}{Character string, only for external
   columns: The value to assume for this column, if no value
   is known for an entry. Rarely useful.}
+
+  \item{id.name}{Character string, a unique ID for this
+  plugin element.  If \code{"auto"}, an ID will be
+  generated automatically from the \code{connect} object.}
 }
 \value{
   An object of class \code{XiMpLe.node}.
@@ -52,7 +53,7 @@
 }
 \examples{
 myInput <- rk.XML.input(label="Given name(s)", size="small")
-myOptCol <- rk.XML.optioncolumn("os_name", connect=myInput, modifier="text")
+myOptCol <- rk.XML.optioncolumn(myInput, modifier="text")
 }
 \seealso{
   \code{\link[rkwarddev:rk.XML.optionset]{rk.XML.optionset}},

Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd	2013-02-19 18:46:33 UTC (rev 4540)
@@ -4,7 +4,7 @@
 \usage{
   rk.XML.optionset(content, optioncolumn, min_rows = 0,
     min_rows_if_any = 0, max_rows = 0, keycolumn = NULL,
-    logic = NULL, optiondisplay = NULL, id.name = "auto")
+    logic = NULL, optiondisplay = TRUE, id.name = "auto")
 }
 \arguments{
   \item{content}{A list of XiMpLe.nodes to be placed inside
@@ -31,11 +31,10 @@
 
   \item{optiondisplay}{Logical value, can be used to
   automatically add an \code{<optiondisplay>} node on top
-  of the \code{<content>} section, if set to something
-  other than \code{NULL}. Depending on whether it's
-  \code{TRUE} or \code{FALSE}, its \code{index} argument
-  will be set to \code{"true"} or \code{"false"},
-  respectively.}
+  of the \code{<content>} section. Depending on whether
+  it's \code{TRUE} or \code{FALSE}, its \code{index}
+  argument will be set to \code{"true"} or \code{"false"},
+  respectively. Set to \code{NULL} to deactivate.}
 
   \item{id.name}{Character string, a unique ID for this
   plugin element.  If \code{"auto"}, an ID will be
@@ -52,6 +51,25 @@
   0.6.1, please set the dependencies of your
   component/plugin accordingly.
 }
+\examples{
+firstname <- rk.XML.input("Given name(s)")
+lastname <- rk.XML.input("Family name")
+genderselect <- rk.XML.radio("Gender", options=list(
+  Male = c(val="m"),
+  Female = c(val="f")))
+rk.XML.optionset(
+  content = list(
+    rk.XML.row(
+      firstname,
+      lastname,
+      genderselect)),
+  optioncolumn = list(
+    rk.XML.optioncolumn(firstname, modifier="text"),
+    rk.XML.optioncolumn(lastname, modifier="text"),
+    rk.XML.optioncolumn(genderselect)
+  )
+)
+}
 \seealso{
   \code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}},
   \code{\link[rkwarddev:rk.XML.optiondisplay]{rk.XML.optiondisplay}},

Modified: trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd	2013-02-18 15:41:31 UTC (rev 4539)
+++ trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd	2013-02-19 18:46:33 UTC (rev 4540)
@@ -9,7 +9,7 @@
 \details{
   \tabular{ll}{ Package: \tab rkwarddev\cr Type: \tab
   Package\cr Version: \tab 0.06-2\cr Date: \tab
-  2013-02-18\cr Depends: \tab R (>= 2.9.0),methods,XiMpLe
+  2013-02-19\cr Depends: \tab R (>= 2.9.0),methods,XiMpLe
   (>= 0.03-18),rkward (>= 0.5.6)\cr Enhances: \tab
   rkward\cr Encoding: \tab UTF-8\cr License: \tab GPL (>=
   3)\cr LazyLoad: \tab yes\cr URL: \tab





More information about the rkward-tracker mailing list