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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Tue Sep 27 14:09:15 UTC 2011


Revision: 3848
          http://rkward.svn.sourceforge.net/rkward/?rev=3848&view=rev
Author:   m-eik
Date:     2011-09-27 14:09:15 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
rkwarddev: added/altered id and label options in some functions

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
    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.plugin.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.tabbook.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.wizard.R

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-27 11:56:45 UTC (rev 3847)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-27 14:09:15 UTC (rev 3848)
@@ -5,6 +5,7 @@
     unfortunately, this breaks backwards compatibility!
   - added functions rk.XML.varselector(), rk.XML.copy(), rk.XML.dialog(), rk.XML.page() and
     rk.XML.wizard()
+  - added "id.name" and "label" to various functions
   - updated rk.XML.formula()
 
 ## 0.01-5 (2011-09-25)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dialog.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dialog.R	2011-09-27 11:56:45 UTC (rev 3847)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dialog.R	2011-09-27 14:09:15 UTC (rev 3848)
@@ -5,6 +5,7 @@
 #' "spinbox", "stretch", "tabbook", "text", "varselector" and "varslot".
 #'
 #' @param nodes A (list of) objects of class \code{XiMpLe.node}. 
+#' @param label Character string, a text label for this plugin element.
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
@@ -18,7 +19,7 @@
 #' 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){
+rk.XML.dialog <- function(nodes, label=NULL){
 	# check the node names and allow only valid ones
 	node.names <- sapply(child.list(nodes), function(this.node){
 			this.node at name
@@ -33,6 +34,7 @@
 
 	node <- new("XiMpLe.node",
 			name="dialog",
+			attributes=list(label=label),
 			children=child.list(nodes)
 		)
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.page.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.page.R	2011-09-27 11:56:45 UTC (rev 3847)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.page.R	2011-09-27 14:09:15 UTC (rev 3848)
@@ -4,7 +4,8 @@
 #' "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}. 
+#' @param nodes A (list of) objects of class \code{XiMpLe.node}.
+#' @param id.name Character string, a unique ID for this plugin element.
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
@@ -18,7 +19,7 @@
 #' test.wizard <- rk.XML.wizard(rk.XML.page(list(test.text, test.copy)))
 #' cat(pasteXMLNode(test.wizard, shine=1))
 
-rk.XML.page <- function(nodes){
+rk.XML.page <- function(nodes, id.name=NULL){
 	# check the node names and allow only valid ones
 	node.names <- sapply(child.list(nodes), function(this.node){
 			this.node at name
@@ -33,6 +34,7 @@
 
 	node <- new("XiMpLe.node",
 			name="page",
+			attributes=list(id=id.name),
 			children=child.list(nodes)
 		)
 

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-27 11:56:45 UTC (rev 3847)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R	2011-09-27 14:09:15 UTC (rev 3848)
@@ -1,7 +1,6 @@
 #' Create XML document for RKWard plugins
 #'
 #' @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 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.
@@ -15,6 +14,8 @@
 #'		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.
+#' @param label Character string, a text label for the plugin's top level, i.e. the window title of the dialog.
+#'		Will only be used if \code{dialog} or \code{wizard} are \code{NULL}.
 #' @return An object of class \code{XiMpLe.doc}.
 #' @export
 #' @examples
@@ -32,7 +33,7 @@
 #' 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, dialog=NULL, wizard=NULL, logic=NULL, provides=c("logic", "dialog"), help=TRUE, pluginmap=NULL){
+rk.XML.plugin <- function(name, dialog=NULL, wizard=NULL, logic=NULL, provides=c("logic", "dialog"), help=TRUE, pluginmap=NULL, label=NULL){
 	name.orig <- name
 	name <- gsub("[[:space:]]*[^[:alnum:]]*", "", name)
 	if(!identical(name.orig, name)){

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.tabbook.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.tabbook.R	2011-09-27 11:56:45 UTC (rev 3847)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.tabbook.R	2011-09-27 14:09:15 UTC (rev 3848)
@@ -1,6 +1,7 @@
 #' Create XML node "tabbook" for RKWard plugins
 #'
 #' @param label Character string, a text label for this plugin element.
+#'		Must be set if \code{id.name="auto"}.
 #' @param tab.labels Character vector, where each string defines the name of one tab.
 #'		The number of \code{tab.labels} also defines the number of tabs.
 #' @param children An optional list with objects of class \code{XiMpLe.node} (or a list of these objects).
@@ -23,7 +24,13 @@
 #'   "Second Tab"), children=list(test.checkboxes, test.dropdown))
 #' cat(pasteXMLNode(test.tabbook, shine=1))
 
-rk.XML.tabbook <- function(label, tab.labels, children=list(), id.name="auto"){
+rk.XML.tabbook <- function(label=NULL, tab.labels, children=list(), id.name="auto"){
+	if(is.null(label)){
+		if(identical(id.name, "auto")){
+			stop(simpleError("If id.name=\"auto\", then 'label' must have a value!"))
+		} else {}
+	} else {}
+
 	num.tabs <-  length(tab.labels)
 	# check if number of children fits
 	if(length(children) > 0){
@@ -57,11 +64,15 @@
 				value="")
 		})
 
+
 	if(identical(id.name, "auto")){
 		tb.id <- auto.ids(label, prefix=ID.prefix("tabbook", length=4))
 	} else if(!is.null(id.name)){
 		tb.id <- id.name[[1]]
-	} else {}
+	} else {
+		tb.id <- NULL
+	}
+
 	tbk.attr.list <- list(id=tb.id, label=label)
 
 	tabbook <- new("XiMpLe.node",

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.wizard.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.wizard.R	2011-09-27 11:56:45 UTC (rev 3847)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.wizard.R	2011-09-27 14:09:15 UTC (rev 3848)
@@ -4,7 +4,8 @@
 #' "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}. 
+#' @param nodes A (list of) objects of class \code{XiMpLe.node}
+#' @param label Character string, a text label for this plugin element.
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
@@ -19,7 +20,7 @@
 #' test.wizard <- rk.XML.wizard(rk.XML.page(list(test.text, test.copy)))
 #' cat(pasteXMLNode(test.wizard, shine=1))
 
-rk.XML.wizard <- function(nodes){
+rk.XML.wizard <- function(nodes, label=NULL){
 	# check the node names and allow only valid ones
 	node.names <- sapply(child.list(nodes), function(this.node){
 			this.node at name
@@ -34,6 +35,7 @@
 
 	node <- new("XiMpLe.node",
 			name="wizard",
+			attributes=list(label=label),
 			children=child.list(nodes)
 		)
 

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