[rkward-cvs] SF.net SVN: rkward:[3844] trunk/rkward/rkward/rbackend/rpackages/rkwarddev

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Mon Sep 26 18:07:39 UTC 2011


Revision: 3844
          http://rkward.svn.sourceforge.net/rkward/?rev=3844&view=rev
Author:   m-eik
Date:     2011-09-26 18:07:39 +0000 (Mon, 26 Sep 2011)
Log Message:
-----------
rkwarddev: consistency changes

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dropdown.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.frame.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.logic.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.radio.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varselector.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dropdown.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.frame.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.logic.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.radio.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varselector.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R	2011-09-26 18:07:39 UTC (rev 3844)
@@ -1,8 +1,8 @@
 #' Create XML node "checkbox" for RKWard plugins
 #'
 #' @param label Character string, a text label for this plugin element.
-#' @param val Character string, the value to submit if the element is checked.
-#' @param un.val Character string, an optional value for the unchecked option.
+#' @param value Character string, the value to submit if the element is checked.
+#' @param un.value Character string, an optional value for the unchecked option.
 #' @param chk Logical, whether this element should be checked by default.
 #' @param id.name Character string, a unique ID for this plugin element.
 #'		If \code{"auto"}, an ID will be generated automatically from the label.
@@ -11,20 +11,20 @@
 #' @examples
 #' test.checkboxes <- rk.XML.row(rk.XML.col(
 #'   list(
-#'     rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
-#'     rk.XML.cbox(label="bar", val="bar2"))))
+#'     rk.XML.cbox(label="foo", value="foo1", chk=TRUE),
+#'     rk.XML.cbox(label="bar", value="bar2"))))
 #' cat(pasteXMLNode(test.checkboxes, shine=1))
 
-rk.XML.cbox <- function(label, val, un.val=NULL, chk=FALSE, id.name="auto"){
+rk.XML.cbox <- function(label, value, un.value=NULL, chk=FALSE, id.name="auto"){
 	if(identical(id.name, "auto")){
 		id <- auto.ids(label, prefix=ID.prefix("checkbox"))
 	} else {
 		id <- id.name
 	}
 
-	attr.list <- list(id=id, label=label, value=val)
-	if(!is.null(un.val)){
-		attr.list[["unchecked_value"]] <- un.val
+	attr.list <- list(id=id, label=label, value=value)
+	if(!is.null(un.value)){
+		attr.list[["unchecked_value"]] <- un.value
 	} else {}
 	if(isTRUE(chk)){
 		attr.list[["checked"]] <- "true"

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dropdown.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dropdown.R	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dropdown.R	2011-09-26 18:07:39 UTC (rev 3844)
@@ -1,7 +1,7 @@
 #' Create XML node "dropdown" for RKWard plugins
 #'
 #' @param label Character string, a text label for this plugin element.
-#' @param opts A named list with options to choose from. The names of the list elements will become
+#' @param options A named list with options to choose from. The names of the list elements will become
 #'		labels of the options, \code{val} defines the value to submit if the option is checked, and
 #'		\code{chk=TRUE} should be set in the one option which is checked by default.
 #' @param id.name Character string, a unique ID for this plugin element.
@@ -10,18 +10,18 @@
 #' @export
 #' @examples
 #' test.dropdown <- rk.XML.dropdown("mydrop",
-#'   opts=list("First Option"=c(val="val1"),
+#'   options=list("First Option"=c(val="val1"),
 #'   "Second Option"=c(val="val2", chk=TRUE)))
 #' cat(pasteXMLNode(test.dropdown, shine=1))
 
-rk.XML.dropdown <- function(label, opts=list(label=c(val=NULL, chk=FALSE)), id.name="auto"){
-	num.opt <- length(opts)
+rk.XML.dropdown <- function(label, options=list(label=c(val=NULL, chk=FALSE)), id.name="auto"){
+	num.opt <- length(options)
 	dd.options <- sapply(1:num.opt, function(this.num){
-			this.element <- names(opts)[[this.num]]
-			this.value <- opts[[this.num]][["val"]]
+			this.element <- names(options)[[this.num]]
+			this.value <- options[[this.num]][["val"]]
 			attr.list <- list(label=this.element, value=this.value)
-			if("chk" %in% names(opts[[this.num]])){
-				if(isTRUE(as.logical(opts[[this.num]][["chk"]]))){
+			if("chk" %in% names(options[[this.num]])){
+				if(isTRUE(as.logical(options[[this.num]][["chk"]]))){
 					attr.list[["checked"]] <- "true"
 				} else {}
 			} else {}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.frame.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.frame.R	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.frame.R	2011-09-26 18:07:39 UTC (rev 3844)
@@ -9,7 +9,7 @@
 #' @export
 #' @examples
 #' test.dropdown <- rk.XML.dropdown("mydrop",
-#'   opts=list("First Option"=c(val="val1"),
+#'   options=list("First Option"=c(val="val1"),
 #'   "Second Option"=c(val="val2", chk=TRUE)))
 #' cat(pasteXMLNode(rk.XML.frame(test.dropdown, label="Some options"), shine=1))
 

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:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.logic.R	2011-09-26 18:07:39 UTC (rev 3844)
@@ -13,8 +13,8 @@
 #' @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.cbox1 <- rk.XML.cbox(label="Want to type?", value="true")
+#' test.cbox2 <- rk.XML.cbox(label="Are you shure?", value="true")
 #' # now create some logic so that the input field is only enabled when both boxes are checked
 #' test.convert <- rk.XML.convert(c(state=test.cbox1,state=test.cbox2), mode=c(and=""))
 #' test.connect <- rk.XML.connect(governor=test.convert, client=test.input, set="enabled")

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.radio.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.radio.R	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.radio.R	2011-09-26 18:07:39 UTC (rev 3844)
@@ -1,7 +1,7 @@
 #' Create XML node "radio" for RKWard plugins
 #'
 #' @param label Character string, a text label for this plugin element.
-#' @param opts A named list with options to choose from. The names of the list elements will become
+#' @param options A named list with options to choose from. The names of the list elements will become
 #'		labels of the options, \code{val} defines the value to submit if the option is checked, and
 #'		\code{chk=TRUE} should be set in the one option which is checked by default.
 #' @param id.name Character string, a unique ID for this plugin element.
@@ -10,18 +10,18 @@
 #' @export
 #' @examples
 #' test.radio <- rk.XML.radio("Chose one",
-#'   opts=list("First Option"=c(val="val1"),
+#'   options=list("First Option"=c(val="val1"),
 #'   "Second Option"=c(val="val2", chk=TRUE)))
 #' cat(pasteXMLNode(test.radio, shine=1))
 
-rk.XML.radio <- function(label, opts=list(label=c(val=NULL, chk=FALSE)), id.name="auto"){
-	num.opt <- length(opts)
+rk.XML.radio <- function(label, options=list(label=c(val=NULL, chk=FALSE)), id.name="auto"){
+	num.opt <- length(options)
 	rd.options <- sapply(1:num.opt, function(this.num){
-			this.element <- names(opts)[[this.num]]
-			this.value <- opts[[this.num]][["val"]]
+			this.element <- names(options)[[this.num]]
+			this.value <- options[[this.num]][["val"]]
 			attr.list <- list(label=this.element, value=this.value)
-			if("chk" %in% names(opts[[this.num]])){
-				if(isTRUE(as.logical(opts[[this.num]][["chk"]]))){
+			if("chk" %in% names(options[[this.num]])){
+				if(isTRUE(as.logical(options[[this.num]][["chk"]]))){
 					attr.list[["checked"]] <- "true"
 				} else {}
 			} else {}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varselector.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varselector.R	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varselector.R	2011-09-26 18:07:39 UTC (rev 3844)
@@ -1,6 +1,7 @@
 #' Create node "varselector" for RKWard plugins
 #'
 #' @param label Character string, a text label for the variable selection slot.
+#'		Must be set if \code{id.name="auto"}.
 #' @param id.name Character vector, unique ID for this element.
 #' @return An object of class \code{XiMpLe.node}.
 #' @export
@@ -11,7 +12,7 @@
 #' test.varselector <- rk.XML.varselector("Select some vars")
 #' cat(pasteXMLNode(test.varselector, shine=1))
 
-rk.XML.varselector <- function(label, id.name="auto"){
+rk.XML.varselector <- function(label=NULL, 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)))
@@ -19,7 +20,13 @@
 		attr.list <- list(id=id.name)
 	} else {}
 
-	attr.list[["label"]] <- label
+	if(!is.null(label)){
+		attr.list[["label"]] <- label
+	} else {
+		if(identical(id.name, "auto")){
+			stop(simpleError("If id.name=\"auto\", then 'label' must have a value!"))
+		} else {}
+	}
 
 	node <- new("XiMpLe.node",
 		name="varselector",

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:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R	2011-09-26 18:07:39 UTC (rev 3844)
@@ -17,7 +17,7 @@
 #' @param max.len The maximum length, an object needs to have. If \code{NULL}, defaults to the largest
 #'		integer number representable on the system.
 #' @param classes An optional character vector, defining class names to which the selection must be limited.
-#' @param types If you specify one or more variables types here, the varslot will only accept objects of those
+#' @param type If you specify one or more variables types here, the varslot will only accept objects of those
 #'		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!
@@ -36,7 +36,7 @@
 #' }
 
 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, id.name="auto"){
+	dim=0, min.len=0, max.len=NULL, classes=NULL, type=NULL, id.name="auto"){
 	if(inherits(source, "XiMpLe.node")){
 		source.name <- source at name
 		if(!identical(source.name, "varselector")){
@@ -57,9 +57,14 @@
 	if(!is.null(classes)){
 		var.slot.attr[["classes"]] <- paste(classes, collapse=" ")
 	} else {}
-	if(!is.null(types)){
-		valid.types <- types[types %in% c("unknown", "number", "string", "factor", "invalid")]
-		var.slot.attr[["types"]] <- paste(valid.types, collapse=" ")
+	if(!is.null(type)){
+		valid.types <- c("unknown", "numeric", "string", "factor", "invalid")
+		invalid.type <- !type %in% valid.types
+		if(invalid.type){
+			warning(paste("You provided invalid types for varslot, they were ignored: ", paste(type, collapse=", "), sep=""))
+			type <- ""
+		} else {}
+		var.slot.attr[["type"]] <- paste(type, collapse=" ")
 	} else {}
 	if(isTRUE(required)){
 		var.slot.attr[["required"]] <- "true"

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd	2011-09-26 18:07:39 UTC (rev 3844)
@@ -2,18 +2,18 @@
 \alias{rk.XML.cbox}
 \title{Create XML node "checkbox" for RKWard plugins}
 \usage{
-  rk.XML.cbox(label, val, un.val = NULL, chk = FALSE,
+  rk.XML.cbox(label, value, un.value = NULL, chk = FALSE,
   id.name = "auto")
 }
 \arguments{
   \item{label}{Character string, a text label for this
   plugin element.}
 
-  \item{val}{Character string, the value to submit if the
+  \item{value}{Character string, the value to submit if the
   element is checked.}
 
-  \item{un.val}{Character string, an optional value for the
-  unchecked option.}
+  \item{un.value}{Character string, an optional value for
+  the unchecked option.}
 
   \item{chk}{Logical, whether this element should be
   checked by default.}
@@ -31,8 +31,8 @@
 \examples{
 test.checkboxes <- rk.XML.row(rk.XML.col(
 list(
-rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
-rk.XML.cbox(label="bar", val="bar2"))))
+rk.XML.cbox(label="foo", value="foo1", chk=TRUE),
+rk.XML.cbox(label="bar", value="bar2"))))
 cat(pasteXMLNode(test.checkboxes, shine=1))
 }
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dropdown.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dropdown.Rd	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dropdown.Rd	2011-09-26 18:07:39 UTC (rev 3844)
@@ -2,15 +2,15 @@
 \alias{rk.XML.dropdown}
 \title{Create XML node "dropdown" for RKWard plugins}
 \usage{
-  rk.XML.dropdown(label, opts = list(label = c(val = NULL,
-  chk = FALSE)), id.name = "auto")
+  rk.XML.dropdown(label, options = list(label = c(val =
+  NULL, chk = FALSE)), id.name = "auto")
 }
 \arguments{
   \item{label}{Character string, a text label for this
   plugin element.}
 
-  \item{opts}{A named list with options to choose from. The
-  names of the list elements will become labels of the
+  \item{options}{A named list with options to choose from.
+  The names of the list elements will become labels of the
   options, \code{val} defines the value to submit if the
   option is checked, and \code{chk=TRUE} should be set in
   the one option which is checked by default.}
@@ -28,7 +28,7 @@
 }
 \examples{
 test.dropdown <- rk.XML.dropdown("mydrop",
-opts=list("First Option"=c(val="val1"),
+options=list("First Option"=c(val="val1"),
 "Second Option"=c(val="val2", chk=TRUE)))
 cat(pasteXMLNode(test.dropdown, shine=1))
 }

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.frame.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.frame.Rd	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.frame.Rd	2011-09-26 18:07:39 UTC (rev 3844)
@@ -25,7 +25,7 @@
 }
 \examples{
 test.dropdown <- rk.XML.dropdown("mydrop",
-opts=list("First Option"=c(val="val1"),
+options=list("First Option"=c(val="val1"),
 "Second Option"=c(val="val2", chk=TRUE)))
 cat(pasteXMLNode(rk.XML.frame(test.dropdown, label="Some options"), shine=1))
 }

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.logic.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.logic.Rd	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.logic.Rd	2011-09-26 18:07:39 UTC (rev 3844)
@@ -18,8 +18,8 @@
 \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.cbox1 <- rk.XML.cbox(label="Want to type?", value="true")
+test.cbox2 <- rk.XML.cbox(label="Are you shure?", value="true")
 # now create some logic so that the input field is only enabled when both boxes are checked
 test.convert <- rk.XML.convert(c(state=test.cbox1,state=test.cbox2), mode=c(and=""))
 test.connect <- rk.XML.connect(governor=test.convert, client=test.input, set="enabled")

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.radio.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.radio.Rd	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.radio.Rd	2011-09-26 18:07:39 UTC (rev 3844)
@@ -2,15 +2,15 @@
 \alias{rk.XML.radio}
 \title{Create XML node "radio" for RKWard plugins}
 \usage{
-  rk.XML.radio(label, opts = list(label = c(val = NULL, chk
-  = FALSE)), id.name = "auto")
+  rk.XML.radio(label, options = list(label = c(val = NULL,
+  chk = FALSE)), id.name = "auto")
 }
 \arguments{
   \item{label}{Character string, a text label for this
   plugin element.}
 
-  \item{opts}{A named list with options to choose from. The
-  names of the list elements will become labels of the
+  \item{options}{A named list with options to choose from.
+  The names of the list elements will become labels of the
   options, \code{val} defines the value to submit if the
   option is checked, and \code{chk=TRUE} should be set in
   the one option which is checked by default.}
@@ -28,7 +28,7 @@
 }
 \examples{
 test.radio <- rk.XML.radio("Chose one",
-opts=list("First Option"=c(val="val1"),
+options=list("First Option"=c(val="val1"),
 "Second Option"=c(val="val2", chk=TRUE)))
 cat(pasteXMLNode(test.radio, shine=1))
 }

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varselector.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varselector.Rd	2011-09-26 13:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varselector.Rd	2011-09-26 18:07:39 UTC (rev 3844)
@@ -2,11 +2,12 @@
 \alias{rk.XML.varselector}
 \title{Create node "varselector" for RKWard plugins}
 \usage{
-  rk.XML.varselector(label, id.name = "auto")
+  rk.XML.varselector(label = NULL, id.name = "auto")
 }
 \arguments{
   \item{label}{Character string, a text label for the
-  variable selection slot.}
+  variable selection slot. Must be set if
+  \code{id.name="auto"}.}
 
   \item{id.name}{Character vector, unique ID for this
   element.}

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:50:35 UTC (rev 3843)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd	2011-09-26 18:07:39 UTC (rev 3844)
@@ -4,7 +4,7 @@
 \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 =
+  max.len = NULL, classes = NULL, type = NULL, id.name =
   "auto")
 }
 \arguments{
@@ -46,7 +46,7 @@
   \item{classes}{An optional character vector, defining
   class names to which the selection must be limited.}
 
-  \item{types}{If you specify one or more variables types
+  \item{type}{If you specify one or more variables types
   here, the varslot will only accept objects of those
   types. Valid types are "unknown", "number", "string",
   "factor", "invalid". Optional, use with great care, the

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