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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Sun Sep 11 16:01:00 UTC 2011


Revision: 3747
          http://rkward.svn.sourceforge.net/rkward/?rev=3747&view=rev
Author:   m-eik
Date:     2011-09-11 16:00:59 +0000 (Sun, 11 Sep 2011)
Log Message:
-----------
rkwarddev: improved some XML functions

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.input.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.text.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-desc-internal.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.cbox.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.input.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.text.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION	2011-09-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION	2011-09-11 16:00:59 UTC (rev 3747)
@@ -13,10 +13,10 @@
 Encoding: UTF-8
 LazyLoad: yes
 URL: http://rkward.sourceforge.net
-Author at R: c(person(given="Meik", family="Michalke",
-    email="meik.michalke at hhu.de"))
+Authors at R: c(person(given="Meik", family="Michalke",
+    email="meik.michalke at hhu.de", role=c("aut", "cre")))
 Version: 0.01-1
-Date: 2011-09-09
+Date: 2011-09-11
 Collate:
     'rk-internal.R'
     'rk.JS.array.R'

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-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R	2011-09-11 16:00:59 UTC (rev 3747)
@@ -2,6 +2,7 @@
 #'
 #' @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 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.
@@ -14,7 +15,7 @@
 #'     rk.XML.cbox(label="bar", val="bar2"))))
 #' cat(pasteXMLNode(test.checkboxes, shine=1))
 
-rk.XML.cbox <- function(label, val, chk=FALSE, id.name="auto"){
+rk.XML.cbox <- function(label, val, un.val=NULL, chk=FALSE, id.name="auto"){
 	if(identical(id.name, "auto")){
 		id <- auto.ids(label, prefix=ID.prefix("checkbox"))
 	} else {
@@ -22,6 +23,9 @@
 	}
 
 	attr.list <- list(id=id, label=label, value=val)
+	if(!is.null(un.val)){
+		attr.list[["unchecked_value"]] <- un.val
+	} else {}
 	if(isTRUE(chk)){
 		attr.list[["checked"]] <- "true"
 	} else {}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.input.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.input.R	2011-09-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.input.R	2011-09-11 16:00:59 UTC (rev 3747)
@@ -1,6 +1,9 @@
 #' Create XML node "input" for RKWard plugins
 #'
 #' @param label Character string, a text label for this plugin element.
+#' @param initial Character string, if not \code{NULL} will be used as thi initial value of the input field.
+#' @param size One value of either "small", "medium" or "large".
+#' @param required Logical, whether an entry is mandatory or not.
 #' @param id.name Character string, a unique ID for this plugin element.
 #'		If \code{"auto"}, an ID will be generated automatically from the label.
 #' @return An object of class \code{XiMpLe.node}.
@@ -9,8 +12,7 @@
 #' test.input <- rk.XML.input("Type some text")
 #' cat(pasteXMLNode(test.input, shine=1))
 
-#<input id="inpCelexRunWd" label="Number of running words" />
-rk.XML.input <- function(label, id.name="auto"){
+rk.XML.input <- function(label, initial=NULL, size="medium", required=FALSE, id.name="auto"){
 	attr.list <- list(label=label)
 
 	if(identical(id.name, "auto")){
@@ -19,6 +21,16 @@
 		attr.list[["id"]] <- id.name
 	} else {}
 
+	if(!is.null(initial)){
+		attr.list[["initial"]] <- initial
+	} else {}
+	if(identical(size, "small") | identical(size, "large")){
+		attr.list[["size"]] <- size
+	} else {}
+	if(isTRUE(required)){
+		attr.list[["required"]] <- "true"
+	} else {}
+
 	node <- new("XiMpLe.node",
 			name="input",
 			attributes=attr.list)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.text.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.text.R	2011-09-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.text.R	2011-09-11 16:00:59 UTC (rev 3747)
@@ -1,5 +1,7 @@
 #' Create XML node "text" for RKWard plugins
 #'
+#' @param text Character string, the text to be displayed.
+#' @param type One value of either "normal", "warning" or "error".
 #' @param id.name Character string, a unique ID for this plugin element.
 #' @return An object of class \code{XiMpLe.node}.
 #' @export
@@ -7,13 +9,17 @@
 #' test.text <- rk.XML.text("Added this text.")
 #' cat(pasteXMLNode(test.text, shine=1))
 
-rk.XML.text <- function(text, id.name=NULL){
+rk.XML.text <- function(text, type="normal", id.name=NULL){
 	if(!is.null(id.name)){
 		attr.list <- list(id=id.name)
 	} else {
 		attr.list <- list()
 	}
 
+	if(identical(type, "warning") | identical(type, "error")){
+		attr.list[["type"]] <- type
+	} else {}
+
 	node <- new("XiMpLe.node",
 			name="text",
 			attributes=attr.list,

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-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R	2011-09-11 16:00:59 UTC (rev 3747)
@@ -4,7 +4,23 @@
 #'
 #' @param label Character string, a text label for the whole frame.
 #' @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.
+#' @param min If \code{multi=TRUE} defines how many objects must be selected.
+#' @param any If \code{multi=TRUE} defines how many objects must be selected at least if any
+#'		are selected at all.
+#' @param max If \code{multi=TRUE} defines how many objects can be selected in total
+#'		(0 means any number).
+#' @param dim The number of dimensions, an object needs to have. If \code{dim=0} any number
+#'		of dimensions is acceptable.
+#' @param min.len The minimum length, an object needs to have.
+#' @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
+#'		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 horiz Logical. If \code{TRUE}, the varslot will be placed next to the selector,
 #'		if \code{FALSE} below it.
 #' @param id.name Character vector, unique IDs for the frame (first entry), the varselector (second entry)
@@ -16,7 +32,8 @@
 #' test.vars <- rk.XML.vars("Select some vars", "Vars go here")
 #' cat(pasteXMLNode(test.vars, shine=1))
 
-rk.XML.vars <- function(label, slot.text=NULL, classes=NULL, horiz=TRUE, id.name="auto"){
+rk.XML.vars <- function(label, slot.text=NULL, required=FALSE, multi=FALSE, min=1, any=1, max=0,
+	dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, horiz=TRUE, id.name="auto"){
 	if(identical(id.name, "auto")){
 		var.sel.attr <- list(id=auto.ids(label, prefix=ID.prefix("varselector", length=3)))
 		var.slot.attr <- list(id=auto.ids(label, prefix=ID.prefix("varslot", length=4)))
@@ -32,12 +49,41 @@
 	if(!is.null(slot.text)){
 		var.slot.attr[["label"]] <- slot.text
 	} else {}
-	
+
 	var.slot.attr[["sources"]] <- var.sel.attr[["id"]]
 	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=" ")
+	} else {}
+	if(isTRUE(required)){
+		var.slot.attr[["required"]] <- "true"
+	} else {}
+	if(isTRUE(multi)){
+		var.slot.attr[["multi"]] <- "true"
+		if(min > 1){
+			var.slot.attr[["min_vars"]] <- min
+		} else {}
+		if(any > 1){
+			var.slot.attr[["min_vars_if_any"]] <- any
+		} else {}
+		if(max > 0){
+			var.slot.attr[["max_vars"]] <- max
+		} else {}
+	} else {}
 
+	if(dim > 0){
+		var.slot.attr[["num_dimensions"]] <- dim
+	} else {}
+	if(min.len > 0){
+		var.slot.attr[["min_length"]] <- min.len
+	} else {}
+	if(!is.null(max.len)){
+		var.slot.attr[["max_length"]] <- max.len
+	} else {}
+
 	v.slot <- new("XiMpLe.node",
 		name="varslot",
 		attributes=var.slot.attr)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-desc-internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-desc-internal.R	2011-09-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-desc-internal.R	2011-09-11 16:00:59 UTC (rev 3747)
@@ -1,10 +1,13 @@
 # package description files
+# this internal object can be used by the package roxyPackage to
+# automatically create/update DESCRIPTION and CITATION files
 pckg.dscrptn <- data.frame(
 		Package="rkwarddev",
 		Type="Package",
 		Title="A collection of tools for RKWard plugin development",
 		Author="m.eik michalke <meik.michalke at hhu.de>",
-		AuthorR="c(person(given=\"Meik\", family=\"Michalke\", email=\"meik.michalke at hhu.de\"))",
+		AuthorsR="c(person(given=\"Meik\", family=\"Michalke\", email=\"meik.michalke at hhu.de\",
+			role=c(\"aut\", \"cre\")))",
 		Maintainer="m.eik michalke <meik.michalke at hhu.de>",
 		Depends="R (>= 2.9.0), XiMpLe",
 		Enhances="rkward",

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R	2011-09-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R	2011-09-11 16:00:59 UTC (rev 3747)
@@ -4,7 +4,7 @@
 #' Package: \tab rkwarddev\cr
 #' Type: \tab Package\cr
 #' Version: \tab 0.01-1\cr
-#' Date: \tab 2011-09-09\cr
+#' Date: \tab 2011-09-11\cr
 #' Depends: \tab R (>= 2.9.0), XiMpLe\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-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION	2011-09-11 16:00:59 UTC (rev 3747)
@@ -1,6 +1,7 @@
 bibentry("Manual",
 		title="rkwarddev: A collection of tools for RKWard plugin development",
-		author=c(person(given="Meik", family="Michalke", email="meik.michalke at hhu.de")),
+		author=c(person(given="Meik", family="Michalke", email="meik.michalke at hhu.de",
+			role=c("aut", "cre"))),
 		year="2011",
 		note="(Version 0.01-1)",
 		url="http://rkward.sourceforge.net",

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-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd	2011-09-11 16:00:59 UTC (rev 3747)
@@ -2,7 +2,8 @@
 \alias{rk.XML.cbox}
 \title{Create XML node "checkbox" for RKWard plugins}
 \usage{
-  rk.XML.cbox(label, val, chk = FALSE, id.name = "auto")
+  rk.XML.cbox(label, val, un.val = NULL, chk = FALSE,
+  id.name = "auto")
 }
 \arguments{
   \item{label}{Character string, a text label for this
@@ -11,6 +12,9 @@
   \item{val}{Character string, the value to submit if the
   element is checked.}
 
+  \item{un.val}{Character string, an optional value for the
+  unchecked option.}
+
   \item{chk}{Logical, whether this element should be
   checked by default.}
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.input.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.input.Rd	2011-09-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.input.Rd	2011-09-11 16:00:59 UTC (rev 3747)
@@ -2,12 +2,22 @@
 \alias{rk.XML.input}
 \title{Create XML node "input" for RKWard plugins}
 \usage{
-  rk.XML.input(label, id.name = "auto")
+  rk.XML.input(label, initial = NULL, size = "medium",
+  required = FALSE, id.name = "auto")
 }
 \arguments{
   \item{label}{Character string, a text label for this
   plugin element.}
 
+  \item{initial}{Character string, if not \code{NULL} will
+  be used as thi initial value of the input field.}
+
+  \item{size}{One value of either "small", "medium" or
+  "large".}
+
+  \item{required}{Logical, whether an entry is mandatory or
+  not.}
+
   \item{id.name}{Character string, a unique ID for this
   plugin element. If \code{"auto"}, an ID will be generated
   automatically from the label.}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.text.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.text.Rd	2011-09-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.text.Rd	2011-09-11 16:00:59 UTC (rev 3747)
@@ -2,9 +2,14 @@
 \alias{rk.XML.text}
 \title{Create XML node "text" for RKWard plugins}
 \usage{
-  rk.XML.text(text, id.name = NULL)
+  rk.XML.text(text, type = "normal", id.name = NULL)
 }
 \arguments{
+  \item{text}{Character string, the text to be displayed.}
+
+  \item{type}{One value of either "normal", "warning" or
+  "error".}
+
   \item{id.name}{Character string, a unique ID for this
   plugin element.}
 }

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-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd	2011-09-11 16:00:59 UTC (rev 3747)
@@ -2,8 +2,10 @@
 \alias{rk.XML.vars}
 \title{Create a variable selector for RKWard plugins}
 \usage{
-  rk.XML.vars(label, slot.text = NULL, classes = NULL,
-  horiz = TRUE, id.name = "auto")
+  rk.XML.vars(label, slot.text = NULL, required = FALSE,
+  multi = FALSE, min = 1, any = 1, max = 0, dim = 0,
+  min.len = 0, max.len = NULL, classes = NULL, types =
+  NULL, horiz = TRUE, id.name = "auto")
 }
 \arguments{
   \item{label}{Character string, a text label for the whole
@@ -12,9 +14,42 @@
   \item{slot.text}{Character string, a text label for the
   variable selection slot.}
 
+  \item{required}{Logical, whether the selection of
+  variables is mandatory or not.}
+
+  \item{multi}{Logical, whether the varslot holds only one
+  or several objects.}
+
+  \item{min}{If \code{multi=TRUE} defines how many objects
+  must be selected.}
+
+  \item{any}{If \code{multi=TRUE} defines how many objects
+  must be selected at least if any are selected at all.}
+
+  \item{max}{If \code{multi=TRUE} defines how many objects
+  can be selected in total (0 means any number).}
+
+  \item{dim}{The number of dimensions, an object needs to
+  have. If \code{dim=0} any number of dimensions is
+  acceptable.}
+
+  \item{min.len}{The minimum length, an object needs to
+  have.}
+
+  \item{max.len}{The maximum length, an object needs to
+  have. If \code{NULL}, defaults to the largest integer
+  number representable on the system.}
+
   \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
+  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!}
+
   \item{horiz}{Logical. If \code{TRUE}, the varslot will be
   placed next to the selector, if \code{FALSE} below it.}
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd	2011-09-11 15:59:43 UTC (rev 3746)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd	2011-09-11 16:00:59 UTC (rev 3747)
@@ -10,7 +10,7 @@
 \details{
   \tabular{ll}{ Package: \tab rkwarddev\cr Type: \tab
   Package\cr Version: \tab 0.01-1\cr Date: \tab
-  2011-09-09\cr Depends: \tab R (>= 2.9.0), XiMpLe\cr
+  2011-09-11\cr Depends: \tab R (>= 2.9.0), XiMpLe\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