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

m-eik at users.sf.net m-eik at users.sf.net
Sun Oct 26 17:39:10 UTC 2014


Revision: 4958
          http://sourceforge.net/p/rkward/code/4958
Author:   m-eik
Date:     2014-10-26 17:39:08 +0000 (Sun, 26 Oct 2014)
Log Message:
-----------
rkwarddev: added support for source_property argument of varslots and valueslots

Modified Paths:
--------------
    trunk/rkward/packages/rkwarddev/ChangeLog
    trunk/rkward/packages/rkwarddev/R/rk.XML.valueslot.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.varslot.R
    trunk/rkward/packages/rkwarddev/man/rk.XML.valueslot.Rd
    trunk/rkward/packages/rkwarddev/man/rk.XML.varslot.Rd

Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog	2014-10-26 00:46:49 UTC (rev 4957)
+++ trunk/rkward/packages/rkwarddev/ChangeLog	2014-10-26 17:39:08 UTC (rev 4958)
@@ -1,6 +1,6 @@
 ChangeLog for package rkwarddev
 
-changes in version 0.06-6 (2014-10-25)
+changes in version 0.06-6 (2014-10-26)
 fixed:
   - rk.XML.optionset() does now allow to re-use objects defined in the same
     function call (i.e., refer to optioncolumns in the logic section)
@@ -9,6 +9,7 @@
 added:
   - all "help" values can now be a list of character strings or XiMpLe nodes,
     to have more control over the markup
+  - added "property" argument to rk.XML.valueslot() and rk.XML.varslot().
 
 changes in version 0.06-5 (2014-10-19)
 fixed:

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.valueslot.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.valueslot.R	2014-10-26 00:46:49 UTC (rev 4957)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.valueslot.R	2014-10-26 17:39:08 UTC (rev 4958)
@@ -20,8 +20,11 @@
 #'
 #' @param label Character string, a text label for the valueslot.
 #' @param source Either a character string (the \code{id} name of the \code{valueselector} to select values
-#'    from), or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used, must be
-#'    a \code{<valueselector>} node).
+#'    from), or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used). If it is not
+#'    a \code{<valueselector>} node, you must also specify a valid property for the node.
+#' @param property Character string, valid property for a XiMpLe node defined by \code{source}. In the XML code, it
+#'    will cause the use of \code{source_property} instead of \code{source}. Only used if \code{source} ist not a
+#'    \code{<valueselector>} node. 
 #' @param required Logical, whether the selection of values is mandatory or not.
 #' @param multi Logical, whether the valueslot holds only one or several objects.
 #' @param min If \code{multi=TRUE} defines how many objects must be selected. Sets \code{multi=TRUE}.
@@ -50,15 +53,8 @@
 #' cat(pasteXML(test.valueslot))
 #' }
 
-rk.XML.valueslot <- function(label, source, required=FALSE, multi=FALSE, min=1, any=1, max=0,
+rk.XML.valueslot <- function(label, source, property=NULL, required=FALSE, multi=FALSE, min=1, any=1, max=0,
   id.name="auto", help=NULL, component=rk.get.comp()){
-  if(is.XiMpLe.node(source)){
-    source.name <- slot(source, "name")
-    if(!identical(source.name, "valueselector")){
-      stop(simpleError(paste0("'source' must be a <valueselector> node! You provided: <", source.name, ">")))
-    } else {}
-  } else {}
-
   if(identical(id.name, "auto")){
     value.slot.attr <- list(id=auto.ids(label, prefix=ID.prefix("valueslot", length=4)))
   } else if(!is.null(id.name)){
@@ -67,7 +63,18 @@
   
   value.slot.attr[["label"]] <- label
 
-  value.slot.attr[["source"]] <- check.ID(source)
+  if(is.XiMpLe.node(source)){
+    source.name <- slot(source, "name")
+    if(identical(source.name, "varselector")){
+      var.slot.attr[["source"]] <- check.ID(source)
+    } else {
+      if(is.null(property)){
+        stop(simpleError(paste0("'source' must either be a <varselector> node or come with an appropripate 'property' value!")))
+      } else if(modif.validity(source, modifier=property)){
+        var.slot.attr[["source_property"]] <- paste(check.ID(source), property, sep=".")
+      } else {}
+    }
+  } else {}
 
   if(isTRUE(required)){
     value.slot.attr[["required"]] <- "true"

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.varslot.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.varslot.R	2014-10-26 00:46:49 UTC (rev 4957)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.varslot.R	2014-10-26 17:39:08 UTC (rev 4958)
@@ -20,8 +20,11 @@
 #'
 #' @param label Character string, a text label for the varslot.
 #' @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).
+#'    from), or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used). If it is not
+#'    a \code{<valueselector>} node, you must also specify a valid property for the node.
+#' @param property Character string, valid property for a XiMpLe node defined by \code{source}. In the XML code, it
+#'    will cause the use of \code{source_property} instead of \code{source}. Only used if \code{source} ist not a
+#'    \code{<valueselector>} 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. Sets \code{multi=TRUE}.
@@ -60,15 +63,8 @@
 #' cat(pasteXML(test.varslot))
 #' }
 
-rk.XML.varslot <- function(label, source, required=FALSE, multi=FALSE, min=1, any=1, max=0,
+rk.XML.varslot <- function(label, source, property=NULL, required=FALSE, multi=FALSE, min=1, any=1, max=0,
   dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, id.name="auto", help=NULL, component=rk.get.comp()){
-  if(is.XiMpLe.node(source)){
-    source.name <- slot(source, "name")
-    if(!identical(source.name, "varselector")){
-      stop(simpleError(paste0("'source' must be a <varselector> node! You provided: <", source.name, ">")))
-    } 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)){
@@ -77,7 +73,18 @@
   
   var.slot.attr[["label"]] <- label
 
-  var.slot.attr[["source"]] <- check.ID(source)
+  if(is.XiMpLe.node(source)){
+    source.name <- slot(source, "name")
+    if(identical(source.name, "varselector")){
+      var.slot.attr[["source"]] <- check.ID(source)
+    } else {
+      if(is.null(property)){
+        stop(simpleError(paste0("'source' must either be a <varselector> node or come with an appropripate 'property' value!")))
+      } else if(modif.validity(source, modifier=property)){
+        var.slot.attr[["source_property"]] <- paste(check.ID(source), property, sep=".")
+      } else {}
+    }
+  } else {}
 
   if(!is.null(classes)){
     var.slot.attr[["classes"]] <- paste(classes, collapse=" ")

Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.valueslot.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.valueslot.Rd	2014-10-26 00:46:49 UTC (rev 4957)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.valueslot.Rd	2014-10-26 17:39:08 UTC (rev 4958)
@@ -3,17 +3,21 @@
 \alias{rk.XML.valueslot}
 \title{Create a XML node "valueslot" for RKWard plugins}
 \usage{
-rk.XML.valueslot(label, source, required = FALSE, multi = FALSE, min = 1,
-  any = 1, max = 0, id.name = "auto", help = NULL,
-  component = rk.get.comp())
+rk.XML.valueslot(label, source, property = NULL, required = FALSE,
+  multi = FALSE, min = 1, any = 1, max = 0, id.name = "auto",
+  help = NULL, component = rk.get.comp())
 }
 \arguments{
 \item{label}{Character string, a text label for the valueslot.}
 
 \item{source}{Either a character string (the \code{id} name of the \code{valueselector} to select values
-from), or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used, must be
-a \code{<valueselector>} node).}
+from), or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used). If it is not
+a \code{<valueselector>} node, you must also specify a valid property for the node.}
 
+\item{property}{Character string, valid property for a XiMpLe node defined by \code{source}. In the XML code, it
+will cause the use of \code{source_property} instead of \code{source}. Only used if \code{source} ist not a
+\code{<valueselector>} node.}
+
 \item{required}{Logical, whether the selection of values is mandatory or not.}
 
 \item{multi}{Logical, whether the valueslot holds only one or several objects.}

Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.varslot.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.varslot.Rd	2014-10-26 00:46:49 UTC (rev 4957)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.varslot.Rd	2014-10-26 17:39:08 UTC (rev 4958)
@@ -3,18 +3,22 @@
 \alias{rk.XML.varslot}
 \title{Create a XML node "varslot" for RKWard plugins}
 \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, id.name = "auto", help = NULL,
-  component = rk.get.comp())
+rk.XML.varslot(label, source, property = NULL, required = FALSE,
+  multi = FALSE, min = 1, any = 1, max = 0, dim = 0, min.len = 0,
+  max.len = NULL, classes = NULL, types = NULL, id.name = "auto",
+  help = NULL, component = rk.get.comp())
 }
 \arguments{
 \item{label}{Character string, a text label for the varslot.}
 
 \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).}
+from), or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used). If it is not
+a \code{<valueselector>} node, you must also specify a valid property for the node.}
 
+\item{property}{Character string, valid property for a XiMpLe node defined by \code{source}. In the XML code, it
+will cause the use of \code{source_property} instead of \code{source}. Only used if \code{source} ist not a
+\code{<valueselector>} node.}
+
 \item{required}{Logical, whether the selection of variables is mandatory or not.}
 
 \item{multi}{Logical, whether the varslot holds only one or several objects.}





More information about the rkward-tracker mailing list