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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Fri Sep 30 10:35:20 UTC 2011


Revision: 3868
          http://rkward.svn.sourceforge.net/rkward/?rev=3868&view=rev
Author:   m-eik
Date:     2011-09-30 10:35:20 +0000 (Fri, 30 Sep 2011)
Log Message:
-----------
rkwarddev: functions rk.XML.attribute(), rk.XML.component(), rk.XML.components(), rk.XML.context(),  rk.XML.entry(), rk.XML.hierarchy(), rk.XML.menu() and rk.XML.require() work now

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.attribute.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.component.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.components.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.context.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.entry.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.hierarchy.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.menu.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.require.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.snippets.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.attribute.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.component.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.components.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.context.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.entry.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.hierarchy.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.menu.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.require.Rd

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-30 10:35:20 UTC (rev 3868)
@@ -1,5 +1,10 @@
 ChangeLog for package rkwarddev
 
+## 0.02-3 (2011-09-30)
+  - tuned rk.plugin.skeleton() to only skip file writing if they exist
+  - added functions rk.XML.attribute(), rk.XML.component(), rk.XML.components(), rk.XML.context(),
+    rk.XML.entry(), rk.XML.hierarchy(), rk.XML.menu() and rk.XML.require()
+
 ## 0.02-2 (2011-09-29)
   - added "load" and "show" options to rk.plugin.skeleton() to call rk.load.pluginmaps() and the plugin itself
   - added function rk.build.plugin()

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.attribute.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.attribute.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.attribute.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -1,37 +1,41 @@
 #' Create XML "attribute" node for RKWard plugins
 #'
 #' This function will create a attribute node for component sections in .pluginmap files.
-#' 
-#' @note NOT WORKING YET
+#' Only meaningful for import plugins.
 #'
-#' @param label A label.
-#' @param value A value.
-#' @param id.name Character string, a unique ID for this plugin element.
-#'		If \code{"auto"}, an ID will be generated automatically from the tag names and
-#'		IDs of the given nodes.
+#' @param id Either a character string (the \code{id} of the property whose attribute should be set),
+#'		or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used).
+#' @param value Character string, new value for the attribute.
+#' @param label Character string, label associated with the attribute.
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
-#'		\code{\link[rkwarddev:rk.XML.attributes]{rk.XML.attributes}}
-# @examples
-# # define a formula section with varselector and varslots
-# test.formula <- rk.XML.vars("Variables", "Fixed", formula.dependent="Dependent")
-# # define the attribute
-# test.attribute <- rk.XML.attribute(test.formula)
-# cat(pasteXMLNode(test.attribute))
+#'		\code{\link[rkwarddev:rk.XML.components]{rk.XML.components}}
+#' @examples
+#' # define a formula section with varselector and varslots
+#' test.checkbox <- rk.XML.cbox(label="foo", value="foo1", chk=TRUE)
+#' # re-set the attribute
+#' test.attribute <- rk.XML.attribute(test.checkbox, value="bar2", label="bar")
+#' cat(pasteXMLNode(test.attribute))
 
-rk.XML.attribute <- function(label, value, id.name="auto"){
-	if(identical(id.name, "auto")){
-		# try autogenerating some id
-		id.name <- auto.ids(node.soup(nodes), prefix=ID.prefix("attribute"), chars=10)
-	} else if(is.null(id.name)){
-		stop(simpleError("Components need an ID!"))
+rk.XML.attribute <- function(id, value=NULL, label=NULL){
+	# let's see if we need to extract IDs first
+	attr.list <- list(id=check.ID(id))
+
+	if(all(is.null(value), is.null(label))){
+		stop(simpleError("You must at least specity either one of 'value' or 'label'!"))
 	} else {}
+	
+	if(!is.null(value)){
+		attr.list[["value"]] <- value
+	} else {}
+	if(!is.null(label)){
+		attr.list[["label"]] <- label
+	} else {}
 
 	node <- new("XiMpLe.node",
 			name="attribute",
-			attributes=list(id=id.name),
-			children=child.list(nodes)
+			attributes=attr.list
 		)
 
 	return(node)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.component.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.component.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.component.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -1,39 +1,43 @@
 #' Create XML "component" node for RKWard plugins
 #'
-#' This function will create a component node for components sections.
+#' This function will create a component node for components sections of .pluginmap files.
 #' 
-#' @note NOT WORKING YET
-#'
-#' @param label A label.
-#' @param file A file name.
+#' @param label Character string, a label for the component.
+#' @param file Character string, file name of a plugin XML file defining the GUI.
 #' @param id.name Character string, a unique ID for this plugin element.
-#'		If \code{"auto"}, an ID will be generated automatically from the tag names and
-#'		IDs of the given nodes.
+#'		If \code{"auto"}, an ID will be generated automatically from the label.
 #' @param type Character string, type of component. As of now, only "standard" is supported. The option is
 #'		just implemented for completeness.
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
 #'		\code{\link[rkwarddev:rk.XML.components]{rk.XML.components}}
-# @examples
-# # define a formula section with varselector and varslots
-# test.formula <- rk.XML.vars("Variables", "Fixed", formula.dependent="Dependent")
-# # define the component
-# test.component <- rk.XML.component(test.formula)
-# cat(pasteXMLNode(test.component))
+#' @examples
+#' test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+#' cat(pasteXMLNode(test.component))
 
 rk.XML.component <- function(label, file, id.name="auto", type="standard"){
 	if(identical(id.name, "auto")){
 		# try autogenerating some id
-		id.name <- auto.ids(node.soup(nodes), prefix=ID.prefix("component"), chars=10)
+		id.name <- auto.ids(label, prefix=ID.prefix("component"), chars=10)
 	} else if(is.null(id.name)){
 		stop(simpleError("Components need an ID!"))
 	} else {}
+	attr.list <- list(id=check.ID(id.name), label=label)
 
+	# once there are more types supported, this will make much more sense...
+	if(!type %in% c("standard")){
+		stop(simpleError(paste("Invalid type: ", type, sep="")))
+	} else {
+		attr.list[["type"]] <- type
+	}
+	if(!is.null(file)){
+		attr.list[["file"]] <- file
+	} else {}
+
 	node <- new("XiMpLe.node",
 			name="component",
-			attributes=list(id=id.name),
-			children=child.list(nodes)
+			attributes=attr.list
 		)
 
 	return(node)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.components.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.components.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.components.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -1,40 +1,30 @@
 #' Create XML "components" node for RKWard plugins
 #'
-#' This function will create a components node for a .pluginmap file, with optional child nodes "component".
+#' This function will create a components node for a .pluginmap file, with mandatory child nodes "component".
 #'
-#' @note NOT WORKING YET
-#'
 #' @param nodes A (list of) objects of class \code{XiMpLe.node}. They must all have the name "component".
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
 #'		\code{\link[rkwarddev:rk.XML.pluginmap]{rk.XML.pluginmap}}
 #'		\code{\link[rkwarddev:rk.XML.component]{rk.XML.component}}
-# @examples
-# # define a formula section with varselector and varslots
-# test.formula <- rk.XML.vars("Variables", "Fixed", formula.dependent="Dependent")
-# # define the components section
-# test.component <- rk.XML.component(test.formula)
-# test.components <- rk.XML.components(test.component)
-# cat(pasteXMLNode(test.components))
+#' @examples
+#' test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+#' test.components <- rk.XML.components(test.component)
+#' cat(pasteXMLNode(test.components))
 
-rk.XML.components <- function(nodes=NULL){
-	if(!is.null(nodes)){
-		# check the node names and allow only valid ones
-		sapply(child.list(nodes), function(this.node){
-				node.name <- this.node at name
-				if(!identical(node.name, "component")){
-					stop(simpleError(paste("Invalid XML nodes for components section: ", node.name, sep="")))
-				} else {}
-			})
-	} else {
-		nodes <- list()
-	}
+rk.XML.components <- function(nodes){
+	# check the node names and allow only valid ones
+	sapply(child.list(nodes), function(this.node){
+			node.name <- this.node at name
+			if(!identical(node.name, "component")){
+				stop(simpleError(paste("Invalid XML nodes for components section: ", node.name, sep="")))
+			} else {}
+		})
 
 	node <- new("XiMpLe.node",
 			name="components",
-			children=child.list(nodes),
-			value=""
+			children=child.list(nodes)
 		)
 
 	return(node)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.context.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.context.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.context.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -1,24 +1,39 @@
 #' Create XML "context" node for RKWard plugins
 #'
-#' This function will create a context node for .pluginmap files.
+#' This function will create a context node for .pluginmap files,
+#' with mandatory child nodes "menu".
 #' 
-#' @note NOT WORKING YET
-#'
-#' @param id Either "x11" or "import".
+#' @param nodes A (list of) objects of class \code{XiMpLe.node}, must all be "menu".
+#' @param id Character string, either "x11" or "import".
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
-# @examples
-# # define a formula section with varselector and varslots
-# test.formula <- rk.XML.vars("Variables", "Fixed", formula.dependent="Dependent")
-# # define the context
-# test.context <- rk.XML.context(test.formula)
-# cat(pasteXMLNode(test.context))
+#' @examples
+#' test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+#' test.entry <- rk.XML.entry(test.component)
+#' test.menu <- rk.XML.menu("Analysis", nodes=test.entry, id.name="analysis")
+#' test.context <- rk.XML.context(test.menu)
+#' cat(pasteXMLNode(test.context))
 
-rk.XML.context <- function(id="x11"){
+rk.XML.context <- function(nodes, id="x11"){
+	# check the node names and allow only valid ones
+	node.names <- sapply(child.list(nodes), function(this.node){
+			this.node at name
+		})
 
+	if(!id %in% c("x11", "import")){
+		stop(simpleError(paste("Invalid ID: ", id, sep="")))
+	} else {}
+		
+	invalid.sets <- !node.names %in% c("menu")
+	if(any(invalid.sets)){
+		stop(simpleError(paste("Invalid XML nodes for context section: ",
+			paste(node.names[invalid.sets], collapse=", "), sep="")))
+	} else {}
+
 	node <- new("XiMpLe.node",
 			name="context",
-			attributes=list(id=id.name)
+			attributes=list(id=id),
+			children=child.list(nodes)
 		)
 
 	return(node)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.entry.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.entry.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.entry.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -1,34 +1,40 @@
 #' Create XML "entry" node for RKWard plugins
 #'
-#' This function will create a entry node for .pluginmap files.
+#' This function will create a entry node for menu sections in .pluginmap files.
 #' 
-#' @note NOT WORKING YET
-#'
 #' @param component An ID.
-#' @param index An index.
+#' @param index Integer number to influence the level of menu placement.
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
-#'		\code{\link[rkwarddev:rk.XML.entrys]{rk.XML.entrys}}
-# @examples
-# # define a formula section with varselector and varslots
-# test.formula <- rk.XML.vars("Variables", "Fixed", formula.dependent="Dependent")
-# # define the entry
-# test.entry <- rk.XML.entry(test.formula)
-# cat(pasteXMLNode(test.entry))
+#'		\code{\link[rkwarddev:rk.XML.menu]{rk.XML.menu}}
+#' @examples
+#' test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+#' test.entry <- rk.XML.entry(test.component)
+#' cat(pasteXMLNode(test.entry))
 
-rk.XML.entry <- function(component, index=1){
-	if(identical(id.name, "auto")){
-		# try autogenerating some id
-		id.name <- auto.ids(node.soup(nodes), prefix=ID.prefix("entry"), chars=10)
-	} else if(is.null(id.name)){
-		stop(simpleError("Components need an ID!"))
+rk.XML.entry <- function(component, index=-1){
+	if(length(component) > 1){
+		stop(simpleError("'component' must be of length 1!"))
 	} else {}
 
+	# check the node names and allow only valid ones
+	if(inherits(component, "XiMpLe.node")){
+		node.name <- component at name
+		if(!identical(node.name, "component")){
+			stop(simpleError(paste("Invalid XML node for 'entry': ", node.name, sep="")))
+		} else {}
+	} else {}
+
+	attr.list <- list(component=check.ID(component))
+
+	if(!identical(index, -1)){
+		attr.list[["index"]] <- index
+	} else {}
+
 	node <- new("XiMpLe.node",
 			name="entry",
-			attributes=list(id=id.name),
-			children=child.list(nodes)
+			attributes=attr.list
 		)
 
 	return(node)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.hierarchy.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.hierarchy.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.hierarchy.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -1,19 +1,19 @@
 #' Create XML hierarchy section for RKWard plugins
 #'
-#' This function will create a hierarchy section with optional child nodes "menu".
+#' This function will create a hierarchy section for .pluginmap files,
+#' with mandatory child nodes "menu".
 #'
-#' @note NOT WORKING YET
-#'
-#' @param nodes A (list of) objects of class \code{XiMpLe.node}. 
+#' @param nodes A (list of) objects of class \code{XiMpLe.node}, must all be "menu".
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
-# @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.hierarchy <- rk.XML.hierarchy(rk.XML.col(list(test.input, test.cbox1, test.cbox2)))
-# cat(pasteXMLNode(test.hierarchy))
+#' @seealso
+#'		\code{\link[rkwarddev:rk.XML.menu]{rk.XML.menu}}
+#' @examples
+#' test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+#' test.entry <- rk.XML.entry(test.component)
+#' test.menu <- rk.XML.menu("Analysis", nodes=test.entry, id.name="analysis")
+#' test.hierarchy <- rk.XML.hierarchy(test.menu)
+#' cat(pasteXMLNode(test.hierarchy))
 
 rk.XML.hierarchy <- function(nodes){
 	# check the node names and allow only valid ones
@@ -23,7 +23,8 @@
 
 	invalid.sets <- !node.names %in% c("menu")
 	if(any(invalid.sets)){
-		stop(simpleError(paste("Invalid XML nodes for hierarchy section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
+		stop(simpleError(paste("Invalid XML nodes for hierarchy section: ",
+			paste(node.names[invalid.sets], collapse=", "), sep="")))
 	} else {}
 
 	node <- new("XiMpLe.node",

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.menu.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.menu.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.menu.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -1,36 +1,51 @@
 #' Create XML "menu" node for RKWard plugins
 #'
 #' This function will create a menu node for entry sections.
+#' Use same \code{id} values to place entries in the same menu.
 #' 
-#' @note NOT WORKING YET
-#'
-#' @param label A label.
-#' @param index An index.
+#' @param label Character string, a label for the menu.
+#' @param nodes A (list of) objects of class \code{XiMpLe.node}, must be either
+#'		"menu" or "entry".
+#' @param index Integer number to influence the level of menu placement.
 #' @param id.name Character string, a unique ID for this plugin element.
-#'		If \code{"auto"}, an ID will be generated automatically from the tag names and
-#'		IDs of the given nodes.
+#'		If \code{"auto"}, an ID will be generated automatically from the label.
+#'		Used to place the menu in the global menu hierarchy.
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
 #' @seealso
 #'		\code{\link[rkwarddev:rk.XML.menus]{rk.XML.menus}}
-# @examples
-# # define a formula section with varselector and varslots
-# test.formula <- rk.XML.vars("Variables", "Fixed", formula.dependent="Dependent")
-# # define the menu
-# test.menu <- rk.XML.menu(test.formula)
-# cat(pasteXMLNode(test.menu))
+#' @examples
+#' test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+#' test.entry <- rk.XML.entry(test.component)
+#' test.menu <- rk.XML.menu("Analysis", nodes=test.entry, id.name="analysis")
+#' cat(pasteXMLNode(test.menu))
 
-rk.XML.menu <- function(label, index=1, id.name="auto"){
+rk.XML.menu <- function(label, nodes, index=-1, id.name="auto"){
+	# check the node names and allow only valid ones
+	sapply(child.list(nodes), function(this.node){
+			stopifnot(inherits(this.node, "XiMpLe.node"))
+			node.name <- this.node at name
+			if(!node.name %in% c("entry", "menu")){
+				stop(simpleError(paste("Invalid XML nodes for menu section: ", node.name, sep="")))
+			} else {}
+		})
+
 	if(identical(id.name, "auto")){
 		# try autogenerating some id
-		id.name <- auto.ids(node.soup(nodes), prefix=ID.prefix("menu"), chars=10)
+		id.name <- auto.ids(label, prefix=ID.prefix("menu"), chars=10)
 	} else if(is.null(id.name)){
-		stop(simpleError("Components need an ID!"))
+		stop(simpleError("Menu needs an ID!"))
 	} else {}
 
+	attr.list <- list(id=id.name, label=label)
+
+	if(!identical(index, -1)){
+		attr.list[["index"]] <- index
+	} else {}
+
 	node <- new("XiMpLe.node",
 			name="menu",
-			attributes=list(id=id.name),
+			attributes=attr.list,
 			children=child.list(nodes)
 		)
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.require.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.require.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.require.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -2,19 +2,17 @@
 #'
 #' This function will create a require node for .pluginmap files.
 #' 
-#' @note NOT WORKING YET
-#'
-#' @param file A file name.
+#' @param file Character string, file name of another .pluginmap file to be included.
 #' @return A list of objects of class \code{XiMpLe.node}.
 #' @export
-# @examples
-# # define a formula section with varselector and varslots
-# test.formula <- rk.XML.vars("Variables", "Fixed", formula.dependent="Dependent")
-# # define the require
-# test.require <- rk.XML.require(test.formula)
-# cat(pasteXMLNode(test.require))
+#' @examples
+#' test.require <- rk.XML.require("another.pluginmap")
+#' cat(pasteXMLNode(test.require))
 
 rk.XML.require <- function(file){
+	if(length(file) > 1 | !is.character(file)){
+		stop(simpleError("'file' must be a character string!"))
+	} else {}
 
 	node <- new("XiMpLe.node",
 			name="require",

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.snippets.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.snippets.R	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.snippets.R	2011-09-30 10:35:20 UTC (rev 3868)
@@ -20,6 +20,7 @@
 	if(!is.null(nodes)){
 		# check the node names and allow only valid ones
 		sapply(child.list(nodes), function(this.node){
+				stopifnot(inherits(this.node, "XiMpLe.node"))
 				node.name <- this.node at name
 				if(!identical(node.name, "snippet")){
 					stop(simpleError(paste("Invalid XML nodes for snippets section: ", node.name, sep="")))

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.attribute.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.attribute.Rd	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.attribute.Rd	2011-09-30 10:35:20 UTC (rev 3868)
@@ -2,29 +2,36 @@
 \alias{rk.XML.attribute}
 \title{Create XML "attribute" node for RKWard plugins}
 \usage{
-  rk.XML.attribute(label, value, id.name = "auto")
+  rk.XML.attribute(id, value = NULL, label = NULL)
 }
 \arguments{
-  \item{label}{A label.}
+  \item{id}{Either a character string (the \code{id} of the
+  property whose attribute should be set), or an object of
+  class \code{XiMpLe.node} (whose \code{id} will be
+  extracted and used).}
 
-  \item{value}{A value.}
+  \item{value}{Character string, new value for the
+  attribute.}
 
-  \item{id.name}{Character string, a unique ID for this
-  plugin element. If \code{"auto"}, an ID will be generated
-  automatically from the tag names and IDs of the given
-  nodes.}
+  \item{label}{Character string, label associated with the
+  attribute.}
 }
 \value{
   A list of objects of class \code{XiMpLe.node}.
 }
 \description{
   This function will create a attribute node for component
-  sections in .pluginmap files.
+  sections in .pluginmap files. Only meaningful for import
+  plugins.
 }
-\note{
-  NOT WORKING YET
+\examples{
+# define a formula section with varselector and varslots
+test.checkbox <- rk.XML.cbox(label="foo", value="foo1", chk=TRUE)
+# re-set the attribute
+test.attribute <- rk.XML.attribute(test.checkbox, value="bar2", label="bar")
+cat(pasteXMLNode(test.attribute))
 }
 \seealso{
-  \code{\link[rkwarddev:rk.XML.attributes]{rk.XML.attributes}}
+  \code{\link[rkwarddev:rk.XML.components]{rk.XML.components}}
 }
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.component.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.component.Rd	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.component.Rd	2011-09-30 10:35:20 UTC (rev 3868)
@@ -6,14 +6,15 @@
   "standard")
 }
 \arguments{
-  \item{label}{A label.}
+  \item{label}{Character string, a label for the
+  component.}
 
-  \item{file}{A file name.}
+  \item{file}{Character string, file name of a plugin XML
+  file defining the GUI.}
 
   \item{id.name}{Character string, a unique ID for this
   plugin element. If \code{"auto"}, an ID will be generated
-  automatically from the tag names and IDs of the given
-  nodes.}
+  automatically from the label.}
 
   \item{type}{Character string, type of component. As of
   now, only "standard" is supported. The option is just
@@ -24,10 +25,11 @@
 }
 \description{
   This function will create a component node for components
-  sections.
+  sections of .pluginmap files.
 }
-\note{
-  NOT WORKING YET
+\examples{
+test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+cat(pasteXMLNode(test.component))
 }
 \seealso{
   \code{\link[rkwarddev:rk.XML.components]{rk.XML.components}}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.components.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.components.Rd	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.components.Rd	2011-09-30 10:35:20 UTC (rev 3868)
@@ -2,7 +2,7 @@
 \alias{rk.XML.components}
 \title{Create XML "components" node for RKWard plugins}
 \usage{
-  rk.XML.components(nodes = NULL)
+  rk.XML.components(nodes)
 }
 \arguments{
   \item{nodes}{A (list of) objects of class
@@ -14,10 +14,12 @@
 }
 \description{
   This function will create a components node for a
-  .pluginmap file, with optional child nodes "component".
+  .pluginmap file, with mandatory child nodes "component".
 }
-\note{
-  NOT WORKING YET
+\examples{
+test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+test.components <- rk.XML.components(test.component)
+cat(pasteXMLNode(test.components))
 }
 \seealso{
   \code{\link[rkwarddev:rk.XML.pluginmap]{rk.XML.pluginmap}}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.context.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.context.Rd	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.context.Rd	2011-09-30 10:35:20 UTC (rev 3868)
@@ -2,19 +2,26 @@
 \alias{rk.XML.context}
 \title{Create XML "context" node for RKWard plugins}
 \usage{
-  rk.XML.context(id = "x11")
+  rk.XML.context(nodes, id = "x11")
 }
 \arguments{
-  \item{id}{Either "x11" or "import".}
+  \item{nodes}{A (list of) objects of class
+  \code{XiMpLe.node}, must all be "menu".}
+
+  \item{id}{Character string, either "x11" or "import".}
 }
 \value{
   A list of objects of class \code{XiMpLe.node}.
 }
 \description{
   This function will create a context node for .pluginmap
-  files.
+  files, with mandatory child nodes "menu".
 }
-\note{
-  NOT WORKING YET
+\examples{
+test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+test.entry <- rk.XML.entry(test.component)
+test.menu <- rk.XML.menu("Analysis", nodes=test.entry, id.name="analysis")
+test.context <- rk.XML.context(test.menu)
+cat(pasteXMLNode(test.context))
 }
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.entry.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.entry.Rd	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.entry.Rd	2011-09-30 10:35:20 UTC (rev 3868)
@@ -2,24 +2,27 @@
 \alias{rk.XML.entry}
 \title{Create XML "entry" node for RKWard plugins}
 \usage{
-  rk.XML.entry(component, index = 1)
+  rk.XML.entry(component, index = -1)
 }
 \arguments{
   \item{component}{An ID.}
 
-  \item{index}{An index.}
+  \item{index}{Integer number to influence the level of
+  menu placement.}
 }
 \value{
   A list of objects of class \code{XiMpLe.node}.
 }
 \description{
-  This function will create a entry node for .pluginmap
-  files.
+  This function will create a entry node for menu sections
+  in .pluginmap files.
 }
-\note{
-  NOT WORKING YET
+\examples{
+test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+test.entry <- rk.XML.entry(test.component)
+cat(pasteXMLNode(test.entry))
 }
 \seealso{
-  \code{\link[rkwarddev:rk.XML.entrys]{rk.XML.entrys}}
+  \code{\link[rkwarddev:rk.XML.menu]{rk.XML.menu}}
 }
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.hierarchy.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.hierarchy.Rd	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.hierarchy.Rd	2011-09-30 10:35:20 UTC (rev 3868)
@@ -6,16 +6,23 @@
 }
 \arguments{
   \item{nodes}{A (list of) objects of class
-  \code{XiMpLe.node}.}
+  \code{XiMpLe.node}, must all be "menu".}
 }
 \value{
   A list of objects of class \code{XiMpLe.node}.
 }
 \description{
-  This function will create a hierarchy section with
-  optional child nodes "menu".
+  This function will create a hierarchy section for
+  .pluginmap files, with mandatory child nodes "menu".
 }
-\note{
-  NOT WORKING YET
+\examples{
+test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+test.entry <- rk.XML.entry(test.component)
+test.menu <- rk.XML.menu("Analysis", nodes=test.entry, id.name="analysis")
+test.hierarchy <- rk.XML.hierarchy(test.menu)
+cat(pasteXMLNode(test.hierarchy))
 }
+\seealso{
+  \code{\link[rkwarddev:rk.XML.menu]{rk.XML.menu}}
+}
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.menu.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.menu.Rd	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.menu.Rd	2011-09-30 10:35:20 UTC (rev 3868)
@@ -2,26 +2,35 @@
 \alias{rk.XML.menu}
 \title{Create XML "menu" node for RKWard plugins}
 \usage{
-  rk.XML.menu(label, index = 1, id.name = "auto")
+  rk.XML.menu(label, nodes, index = -1, id.name = "auto")
 }
 \arguments{
-  \item{label}{A label.}
+  \item{label}{Character string, a label for the menu.}
 
-  \item{index}{An index.}
+  \item{nodes}{A (list of) objects of class
+  \code{XiMpLe.node}, must be either "menu" or "entry".}
 
+  \item{index}{Integer number to influence the level of
+  menu placement.}
+
   \item{id.name}{Character string, a unique ID for this
   plugin element. If \code{"auto"}, an ID will be generated
-  automatically from the tag names and IDs of the given
-  nodes.}
+  automatically from the label. Used to place the menu in
+  the global menu hierarchy.}
 }
 \value{
   A list of objects of class \code{XiMpLe.node}.
 }
 \description{
   This function will create a menu node for entry sections.
+  Use same \code{id} values to place entries in the same
+  menu.
 }
-\note{
-  NOT WORKING YET
+\examples{
+test.component <- rk.XML.component("My GUI dialog", "plugins/MyGUIdialog.xml")
+test.entry <- rk.XML.entry(test.component)
+test.menu <- rk.XML.menu("Analysis", nodes=test.entry, id.name="analysis")
+cat(pasteXMLNode(test.menu))
 }
 \seealso{
   \code{\link[rkwarddev:rk.XML.menus]{rk.XML.menus}}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.require.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.require.Rd	2011-09-30 08:17:58 UTC (rev 3867)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.require.Rd	2011-09-30 10:35:20 UTC (rev 3868)
@@ -5,7 +5,8 @@
   rk.XML.require(file)
 }
 \arguments{
-  \item{file}{A file name.}
+  \item{file}{Character string, file name of another
+  .pluginmap file to be included.}
 }
 \value{
   A list of objects of class \code{XiMpLe.node}.
@@ -14,7 +15,8 @@
   This function will create a require node for .pluginmap
   files.
 }
-\note{
-  NOT WORKING YET
+\examples{
+test.require <- rk.XML.require("another.pluginmap")
+cat(pasteXMLNode(test.require))
 }
 

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