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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Sat Oct 8 19:20:39 UTC 2011


Revision: 3912
          http://rkward.svn.sourceforge.net/rkward/?rev=3912&view=rev
Author:   m-eik
Date:     2011-10-08 19:20:39 +0000 (Sat, 08 Oct 2011)
Log Message:
-----------
rkwarddev: added demo script which produces a skeleton GUI, and added the GUI as RKWard plugin (next to some fixes)

Modified Paths:
--------------
    trunk/rkward/packages/rkwarddev/ChangeLog
    trunk/rkward/packages/rkwarddev/R/ite.R
    trunk/rkward/packages/rkwarddev/R/rk-internal.R
    trunk/rkward/packages/rkwarddev/R/rk.JS.options.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.browser.R
    trunk/rkward/packages/rkwarddev/man/ite.Rd
    trunk/rkward/packages/rkwarddev/man/rk.JS.options.Rd
    trunk/rkward/packages/rkwarddev/man/rk.XML.browser.Rd

Added Paths:
-----------
    trunk/rkward/packages/rkwarddev/demo/
    trunk/rkward/packages/rkwarddev/demo/00Index
    trunk/rkward/packages/rkwarddev/demo/skeleton_dialog.R
    trunk/rkward/packages/rkwarddev/inst/rkward/
    trunk/rkward/packages/rkwarddev/inst/rkward/RKWardPluginSkeleton.pluginmap
    trunk/rkward/packages/rkwarddev/inst/rkward/plugins/
    trunk/rkward/packages/rkwarddev/inst/rkward/plugins/RKWardPluginSkeleton.js
    trunk/rkward/packages/rkwarddev/inst/rkward/plugins/RKWardPluginSkeleton.xml

Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog	2011-10-08 12:48:53 UTC (rev 3911)
+++ trunk/rkward/packages/rkwarddev/ChangeLog	2011-10-08 19:20:39 UTC (rev 3912)
@@ -5,6 +5,9 @@
   - added option to create arrays with rk.JS.options()
   - enhanced class rk.JS.opt
   - rk.paste.JS() now adds some comments to the generated code
+  - fixed wrong default value for "required" in rk.XML.browser()
+  - added demo script
+  - added skeleton GUI, was generated by the demo script
 
 ## 0.03-0 (2011-10-07)
   - redesigned options for rk.plugin.skeleton() again, to make them more intuitive and flexible

Modified: trunk/rkward/packages/rkwarddev/R/ite.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/ite.R	2011-10-08 12:48:53 UTC (rev 3911)
+++ trunk/rkward/packages/rkwarddev/R/ite.R	2011-10-08 19:20:39 UTC (rev 3912)
@@ -1,13 +1,17 @@
 #' Generate JavaScript if/then/else constructs
 #' 
-#' @param ifjs A character string, to be placed in the brackets if an \code{if()} statement.
-#' @param thenjs A character string, the code to be executed in case the \code{if()} statement is true.
+#' @param ifjs Either a character string to be placed in the brackets if an \code{if()} statement,
+#'		or an object of class \code{XiMpLe.node}. \code{rk.JS.arr} or \code{rk.JS.opt} (whose identifier will be used).
+#' @param thenjs Either a character string, the code to be executed in case the \code{if()} statement is true,
+#'		or an object of class \code{XiMpLe.node}. \code{rk.JS.arr} or \code{rk.JS.opt} (whose identifier will be used).
+#'		The latter is especially useful in combination with \code{\link[rkwarddev:rk.JS.options]{rk.JS.options}}.
 #' @param elsejs A character string, the code to be executed in case the \code{if()} statement is not true.
 #' @return An object of class \code{rk.JS.ite}
 #' @include rk.JS.ite-class.R
 #' @seealso \code{\link[rkwarddev:rk.paste.JS]{rk.paste.JS}},
 #'		\code{\link[rkwarddev:rk.JS.vars]{rk.JS.vars}},
 #'		\code{\link[rkwarddev:rk.JS.array]{rk.JS.array}},
+#'		\code{\link[rkwarddev:rk.JS.options]{rk.JS.options}},
 #'		\code{\link[rkwarddev:echo]{echo}},
 #'		\code{\link[rkwarddev:id]{id}},
 #'		\code{\link[rkwarddev:qp]{qp}},
@@ -32,7 +36,7 @@
 	}
 	result <- new("rk.JS.ite",
 		ifJS=id(ifjs, js=TRUE),
-		thenJS=thenjs,
+		thenJS=id(thenjs, js=TRUE),
 		elseJS=elsejs,
 		elifJS=elifJS
 	)

Modified: trunk/rkward/packages/rkwarddev/R/rk-internal.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk-internal.R	2011-10-08 12:48:53 UTC (rev 3911)
+++ trunk/rkward/packages/rkwarddev/R/rk-internal.R	2011-10-08 19:20:39 UTC (rev 3912)
@@ -425,6 +425,13 @@
 	if(is.null(funct)){
 		funct <- object at funct
 	} else {}
+	if(is.null(funct) | identical(funct, "")){
+		funct.start <- ""
+		funct.end <- ""
+	} else {
+		funct.start <- paste("=", funct, "(", sep="")
+		funct.end <- ")"
+	}
 
 	JS.array <- paste(
 		main.indent, "// define the array ", arr.name, " for values of R option \"", option, "\"\n",
@@ -433,10 +440,13 @@
 		paste(variables, collapse=", "), ");\n",
 		main.indent, "// clean array ", arr.name, " from empty strings\n",
 		main.indent, arr.name, " = ", arr.name, ".filter(String);\n",
-		main.indent, "// set the actual variable ", opt.name, " for R option \"", option, "=", funct, "()\"\n",
+		main.indent, "// set the actual variable ", opt.name,
+		ifelse(identical(option, ""), "", paste(" for R option \"", option, sep="")),
+		ifelse(identical(funct, ""), "\"", paste("=", funct, "()\"", sep="")), "\n",
 		main.indent, "if(", arr.name, ".length > 0) {\n",
-		scnd.indent, "var ", opt.name, " = \", ", option,"=",
-		funct, "(\" + ", arr.name, ".join(\", \") + \")\";\n",
+		scnd.indent, "var ", opt.name, " = \", ",
+		ifelse(identical(option, ""), "", paste(option, "=", sep="")),
+		funct.start, "\" + ", arr.name, ".join(\", \") + \"",funct.end,"\";\n",
 		main.indent, "} else {\n",
 		scnd.indent, "var ", opt.name, " = \"\";\n",
 		main.indent, "}\n",
@@ -489,15 +499,24 @@
 	if(is.null(funct)){
 		funct <- object at funct
 	} else {}
+	if(is.null(funct) | identical(funct, "")){
+		funct.start <- ""
+		funct.end <- ""
+	} else {
+		funct.start <- paste(funct, "(", sep="")
+		funct.end <- ")"
+	}
 
 	# a function to add the object stuff to ite objects
 	add.opts <- function(this.ite, collapse, array){
-		# remove quotes, we'll add them ourselves where needed
-		to.add <-  gsub("(.*)(\")$", "\\1", gsub("(^\")(.*)", "\\2", this.ite at thenJS, perl=TRUE), perl=TRUE)
+#		# remove quotes, we'll add them ourselves where needed
+#		to.add <-  gsub("(.*)(\")$", "\\1", gsub("(^\")(.*)", "\\2", this.ite at thenJS, perl=TRUE), perl=TRUE)
 		if(isTRUE(array)){
-			this.ite at thenJS <- paste(arr.name, ".push(\"", to.add,"\");", sep="")
+#			this.ite at thenJS <- paste(arr.name, ".push(\"", to.add,"\");", sep="")
+			this.ite at thenJS <- paste(arr.name, ".push(", this.ite at thenJS,");", sep="")
 		} else {
-			this.ite at thenJS <- paste(variable, " += \"", collapse, to.add,"\";", sep="")
+#			this.ite at thenJS <- paste(variable, " += \"", collapse, to.add,"\";", sep="")
+			this.ite at thenJS <- paste(variable, " += ", collapse, this.ite at thenJS,";", sep="")
 		}
 		if(length(this.ite at elifJS) == 1){
 			this.ite at elifJS <- list(add.opts(this.ite at elifJS[[1]]))
@@ -534,8 +553,9 @@
 				main.indent, arr.name, " = ", arr.name, ".filter(String);\n",
 				main.indent, "// set the actual variable ", variable, " with all values for R option \"", option, "\"\n",
 				main.indent, "if(", arr.name, ".length > 0) {\n",
-				scnd.indent, "var ", variable, " = \", ", option,"=",
-				funct, "(\" + ", arr.name, ".join(\", \") + \")\";\n",
+				scnd.indent, "var ", variable, " = \"", collapse,
+				ifelse(identical(option, ""), "", paste(option, "=", sep="")),
+				funct.start, "\" + ", arr.name, ".join(\", \") + \"",funct.end,"\";\n",
 				main.indent, "} else {\n",
 				scnd.indent, "var ", variable, " = \"\";\n",
 				main.indent, "}\n",

Modified: trunk/rkward/packages/rkwarddev/R/rk.JS.options.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.options.R	2011-10-08 12:48:53 UTC (rev 3911)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.options.R	2011-10-08 19:20:39 UTC (rev 3912)
@@ -2,13 +2,16 @@
 #' 
 #' @param var Character string, name of the JavaScript variable to use in the script code.
 #' @param ... A list of objects of class \code{rk.JS.ite} (see \code{\link[rkwarddev:ite]{ite}}).
-#'		Use the \code{thenjs} element only to define the value to add to the option
+#'		Use the \code{thenjs} element to define only the value to add to the option, without commas
 #'		(e.g., \code{"paired=TRUE"} or \code{qp("conf.level=\"", conflevel, "\"")}.
-#' @param collapse Character string, how all options should be concatenated on the R code level.
+#' @param collapse Character string, how all options should be concatenated on the R code level
+#'		(if \code{array=FALSE}), or how \code{option} should be added to the generated R code. Hint:
+#'		To place each option in a new line with tab indentation, set \code{collapse=",\\n\\t"}.
 #' @param option A character string, naming, e.g., an option of an R function which should be
 #'		constructed from several variables. Only used if \code{array=TRUE}.
 #' @param funct Character string, name of the R function to be called to combine the options,
-#'		e.g. "list" for \code{list()}, or "c" for \code{c()}. Only used if \code{array=TRUE}.
+#'		e.g. "list" for \code{list()}, or "c" for \code{c()}. Set to \code{NULL} to drop.
+#'		Only used if \code{array=TRUE}.
 #' @param array Logical, if \code{TRUE} will generate the options as an array, otherwise in one
 #'		concatenated character string (probably only useful for mandatory options).
 #' @return An object of class \code{rk.JS.opt}, use \code{\link[rkwarddev:rk.paste.JS]{rk.paste.JS}}
@@ -27,12 +30,15 @@
 #'   ite(checkB, "fast=TRUE")
 #' )
 
-rk.JS.options <- function(var, ..., collapse=", ", option=NULL, funct="c", array=TRUE){
+rk.JS.options <- function(var, ..., collapse=", ", option=NULL, funct=NULL, array=TRUE){
 	all.opts <- list(...)
 
 	if(is.null(option)){
 		option <- ""
 	} else {}
+	if(is.null(funct)){
+		funct <- ""
+	} else {}
 
 	result <- new("rk.JS.opt",
 		var.name=var,

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.browser.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.browser.R	2011-10-08 12:48:53 UTC (rev 3911)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.browser.R	2011-10-08 19:20:39 UTC (rev 3912)
@@ -17,7 +17,7 @@
 #' cat(pasteXMLNode(test.browser))
 
 
-rk.XML.browser <- function(label, type="file", initial=NULL, urls=FALSE, filter=NULL, required=FALSE, id.name="auto"){
+rk.XML.browser <- function(label, type="file", initial=NULL, urls=FALSE, filter=NULL, required=TRUE, id.name="auto"){
 	attr.list <- list(label=label)
 
 	if(length(type) == 1 & type %in% c("dir", "file", "savefile")){
@@ -40,8 +40,8 @@
 	if(!is.null(filter)){
 		attr.list[["filter"]] <- paste(filter, collapse=" ")
 	} else {}
-	if(isTRUE(required)){
-		attr.list[["required"]] <- "true"
+	if(!isTRUE(required)){
+		attr.list[["required"]] <- "false"
 	} else {}
 
 	node <- new("XiMpLe.node",

Added: trunk/rkward/packages/rkwarddev/demo/00Index
===================================================================
--- trunk/rkward/packages/rkwarddev/demo/00Index	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/demo/00Index	2011-10-08 19:20:39 UTC (rev 3912)
@@ -0,0 +1,2 @@
+skeleton_dialog.R
+

Added: trunk/rkward/packages/rkwarddev/demo/skeleton_dialog.R
===================================================================
--- trunk/rkward/packages/rkwarddev/demo/skeleton_dialog.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/demo/skeleton_dialog.R	2011-10-08 19:20:39 UTC (rev 3912)
@@ -0,0 +1,204 @@
+## create dialog to build a plugin skeleton
+require(rkwarddev)
+
+local({
+about.info <- rk.XML.about(
+	name="Plugin Skeleton",
+	author=c(
+		person(given="Meik", family="Michalke",
+			email="meik.michalke at hhu.de", role=c("aut","cre"))),
+	about=list(desc="GUI interface to create RKWard plugin skeletons",
+		version="0.03-1", url="http://rkward.sf.net"),
+	dependencies=list(rkward.min="0.5.7")
+	)
+
+# tab1: information on the thing
+about.plugin <- rk.XML.frame(list(
+	rk.XML.row(list(
+		pl.name <- rk.XML.input("Plugin name", required=TRUE, size="small"),
+		pl.license <- rk.XML.input("License", initial="GPL (>= 3)", required=TRUE))),
+	rk.XML.row(pl.desc <- rk.XML.input("Short description", required=TRUE)),
+	rk.XML.row(list(
+		pl.version <- rk.XML.input("Version number", initial="0.01-0", required=TRUE),
+		pl.date <- rk.XML.input("Release date (empty for today)"))),
+	rk.XML.row(list(
+		pl.homepage <- rk.XML.input("Homepage"),
+		pl.category<- rk.XML.input("Category")))), label="About the plugin")
+about.contact <- rk.XML.frame(
+	rk.XML.row(list(
+		rk.XML.col(rk.XML.stretch(before=list(
+			aut.given <- rk.XML.input("Given name", required=TRUE),
+			aut.family <- rk.XML.input("Family name", required=TRUE),
+			aut.email <- rk.XML.input("E-mail", required=TRUE)))),
+		rk.XML.col(rk.XML.frame(rk.XML.stretch(before=list(
+			aut.auth <- rk.XML.cbox("Author", "aut", chk=TRUE),
+			aut.maint <- rk.XML.cbox("Maintainer", "cre", chk=TRUE))), label="Author roles")))),
+			label="Plugin author")
+
+tab1.about <- rk.XML.col(list(
+	about.plugin,
+	about.contact))
+
+# tab2: create options
+crt.opts <- rk.XML.frame(list(
+		rk.XML.row(pl.dir <- rk.XML.browser("Directory to save to (empty for $TEMPDIR)", type="dir", required=FALSE)),
+		rk.XML.row(list(
+			rk.XML.col(rk.XML.stretch(before=list(
+				pl.overw <- rk.XML.cbox("Overwrite existing files", "true", chk=FALSE),
+				pl.wiz <- rk.XML.cbox("Add wizard section", "true", chk=FALSE),
+				pl.tests <- rk.XML.cbox("Include plugin tests", "true", chk=TRUE)))),
+			rk.XML.col(rk.XML.stretch(before=list(
+				pl.edit <- rk.XML.cbox("Open files for editing", "true", chk=TRUE),
+				pl.add <- rk.XML.cbox("Add plugin to RKWard configuration", "true", chk=TRUE),
+				pl.show <- rk.XML.cbox("Show the plugin", "true", chk=FALSE)
+			)))
+		)),
+		rk.XML.row(pl.hier <- rk.XML.dropdown("Place in top menu", options=list(
+					"Test (created if needed)"=c(val="test", chk=TRUE),
+					"File"=c(val="file"),
+					"Edit"=c(val="edit"),
+					"View"=c(val="view"),
+					"Workspace"=c(val="workspace"),
+					"Run"=c(val="run"),
+					"Data"=c(val="data"),
+					"Analysis"=c(val="analysis"),
+					"Plots"=c(val="plots"),
+					"Distributions"=c(val="distributions"),
+					"Windows"=c(val="windows"),
+					"Settings"=c(val="settings"),
+					"Help"=c(val="help")
+		)))
+	))
+dep.opts <- rk.XML.frame(list(
+	rk.XML.row(dep.checkbox <- rk.XML.cbox("Define dependencies", "true", chk=FALSE)),
+	rk.XML.row(list(
+	dep.frame.RKWard <- rk.XML.frame(rk.XML.stretch(before=list(
+			dep.rkmin <- rk.XML.input("RKWard min", size="small"),
+			dep.rkmax <- rk.XML.input("RKWard max", size="small"))), label="Depends on RKWard version"),
+	dep.frame.R <- rk.XML.frame(rk.XML.stretch(before=list(
+			dep.rmin <- rk.XML.input("R min", size="small"),
+			dep.rmax <- rk.XML.input("R max", size="small"))), label="Depends on R version")))#,
+# 	rk.XML.row(dep.frame.packages <- rk.XML.frame(rk.XML.stretch(before=list(
+# 			rk.XML.text("Separate package names by space:"),
+# 			dep.pckg <- rk.XML.input("Packages"))), label="Depends on R packages"))
+	), label="Dependencies")
+tab2.create <- rk.XML.col(list(
+	crt.opts, dep.opts
+	))
+
+# tab3: varslot to select the actual content
+children.text <- rk.XML.text("If you already created XML content for the plugin, select the main dialog object here (probably a tabbook?)")
+children.var <- rk.XML.row(list(
+	children.varselector <- rk.XML.varselector(label="Plugin content"),
+	rk.XML.col(list(
+		cont.dial <- rk.XML.varslot("Select an object of class XiMpLe.node", source=children.varselector, classes="XiMpLe.node"),
+		rk.XML.frame(rk.XML.stretch(before=list(
+			js.prep <- rk.XML.varslot("preprocess()", source=children.varselector),
+			js.calc <- rk.XML.varslot("calculate()", source=children.varselector),
+			js.prnt <- rk.XML.varslot("printout()", source=children.varselector)))))
+	)))
+tab3.children <- rk.XML.col(list(rk.XML.row(children.text), rk.XML.row(children.var)))
+
+## glue all of the above together in one tabbook
+# sklt.tabbook <- rk.XML.dialog(rk.XML.tabbook("Plugin Skeleton",
+# 	tab.labels=c("About the plugin", "Create options", "XML content"),
+# 	children=list(tab1.about, tab2.create, tab3.children)), label="RKWard Plugin Skeleton")
+sklt.tabbook <- rk.XML.dialog(rk.XML.tabbook("Plugin Skeleton",
+	tab.labels=c("About the plugin", "Create options"),
+	children=list(tab1.about, tab2.create)), label="RKWard Plugin Skeleton")
+
+## some logic
+logic.section <- rk.XML.logic(nodes=list(
+		rk.XML.connect(governor=dep.checkbox, client=dep.frame.RKWard, set="enabled"),
+		rk.XML.connect(governor=dep.checkbox, client=dep.frame.R, set="enabled")#,
+# 		rk.XML.connect(governor=dep.checkbox, client=dep.frame.packages, set="enabled")
+	))
+
+## JS code generation
+# author section
+js.opt.about.author.role <- rk.JS.options("optAuthorRole",
+	ite(aut.auth, qp("\"",aut.auth,"\"")),
+	ite(aut.maint, qp("\"",aut.maint,"\"")),
+	funct="c", option="role", collapse="")
+js.opt.about.author <- rk.JS.options("optAuthor",
+	ite(aut.given, qp("given=\"",aut.given,"\"")),
+	ite(aut.family, qp("family=\"",aut.family,"\"")),
+	ite(aut.email, qp("email=\"",aut.email,"\"")),
+	ite(js.opt.about.author.role, js.opt.about.author.role),
+	funct="person", option="author", collapse=",\\n\\t")
+# about section
+js.opt.about.about <- rk.JS.options("optAbout",
+	ite(pl.desc, qp("desc=\"",pl.desc,"\"")),
+	ite(pl.version, qp("version=\"",pl.version,"\"")),
+	ite(pl.date, qp("date=\"",pl.date,"\"")),
+	ite(pl.homepage, qp("url=\"",pl.homepage,"\"")),
+	ite(pl.license, qp("license=\"",pl.license,"\"")),
+	ite(pl.category, qp("category=\"",pl.category,"\"")),
+	funct="list", option="about", collapse=",\\n\\t")
+# dependencies section
+js.opt.about.dep <- rk.JS.options("optDependencies",
+	ite(id(dep.checkbox, " && ", dep.rkmin), qp("rkward.min=\"",dep.rkmin,"\"")),
+	ite(id(dep.checkbox, " && ", dep.rkmax), qp("rkward.max=\"",dep.rkmax,"\"")),
+	ite(id(dep.checkbox, " && ", dep.rmin), qp("R.min=\"",dep.rmin,"\"")),
+	ite(id(dep.checkbox, " && ", dep.rmax), qp("R.max=\"",dep.rmax,"\"")),
+	funct="list", option="dependencies", collapse=",\\n\\t")
+
+# 	"package"
+# 		"name"
+# 		"min"
+# 		"max"
+# 		"repository"
+
+# 	"pluginmap"
+# 		"name"
+# 		"url"
+js.opt.skel.pluginmap <- rk.JS.options("optPluginmap",
+	ite(id(pl.hier, "!= \"test\""), qp("hierarchy=\"", pl.hier, "\"")),
+	funct="list", option="pluginmap", collapse="")
+js.opt.skeleton <- rk.JS.options("optSkeleton",
+	ite(pl.name, qp("\n\tname=\"", pl.name, "\"")),
+	ite(pl.dir, qp("\n\tpath=\"", pl.dir, "\"")),
+	ite(pl.wiz, qp("\n\tprovides=c(\"logic\", \"dialog\", \"wizard\")")),
+	ite(js.opt.skel.pluginmap, qp("\n\t", js.opt.skel.pluginmap)),
+	ite(pl.overw, qp("\n\toverwrite=TRUE")),
+	ite(pl.tests, qp("\n\ttests=TRUE")),
+	ite(pl.edit, qp("\n\tedit=TRUE")),
+	ite(pl.add, qp("\n\tload=TRUE")),
+	ite(pl.show, qp("\n\tshow=TRUE")),
+	collapse="")
+
+JS.calculate <- rk.paste.JS(
+	js.opt.about.author.role,
+	js.opt.about.author,
+	js.opt.about.about,
+	js.opt.about.dep,
+	js.opt.skel.pluginmap,
+	js.opt.skeleton,
+	echo("about.plugin <- rk.XML.about("),
+		ite(pl.name, echo("\n\tname=\"", pl.name, "\"")),
+		echo(js.opt.about.author),
+		echo(js.opt.about.about),
+		echo(js.opt.about.dep),
+	echo("\n)\n\n"),
+	echo("plugin.dir <- rk.plugin.skeleton(\n\tabout=about.plugin,"),
+		echo(js.opt.skeleton),
+	echo("\n)\n\n"),
+	level=2)
+
+## the main call
+#plugin.dir <<- rk.plugin.skeleton("RKWard Plugin Skeleton",
+rk.plugin.skeleton("RKWard Plugin Skeleton",
+	about=about.info,
+	xml=list(
+		dialog=sklt.tabbook,
+		logic=logic.section),
+	js=list(
+		require="rkwarddev",
+		calculate=JS.calculate),
+#	pluginmap=list(hierarchy="file"),
+#	overwrite=TRUE,
+	create=c("pmap","xml","js","desc"),
+	tests=FALSE,
+	show=TRUE,
+	edit=TRUE)
+})

Added: trunk/rkward/packages/rkwarddev/inst/rkward/RKWardPluginSkeleton.pluginmap
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/rkward/RKWardPluginSkeleton.pluginmap	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/inst/rkward/RKWardPluginSkeleton.pluginmap	2011-10-08 19:20:39 UTC (rev 3912)
@@ -0,0 +1,71 @@
+<!DOCTYPE rkpluginmap >
+<document 
+	namespace="rkward"
+	id="RKWardPluginSkeleton_rkward"
+>
+	<about 
+		name="Plugin Skeleton"
+		shortinfo="GUI interface to create RKWard plugin skeletons"
+		version="0.03-1"
+		releasedate="2011-10-08"
+		url="http://rkward.sf.net"
+		license="GPL (>= 3)"
+	>
+		<author 
+			given="Meik"
+			family="Michalke"
+			email="meik.michalke at hhu.de"
+			role="aut, cre"
+		 />
+		<dependencies 
+			rkward_min_version="0.5.7"
+		>
+			<!-- 
+				<package 
+					name="CHANGE_ME_OR_DELETE_ME"
+					min_version="CHANGE_ME_OR_DELETE_ME"
+					max_version="CHANGE_ME_OR_DELETE_ME"
+					repository="CHANGE_ME_OR_DELETE_ME"
+				 /> 
+			-->
+			<!-- 
+				If this plugin depends on other pluginmaps, edit this part to your needs:
+
+				<pluginmap 
+					name="CHANGE_ME_OR_DELETE_ME"
+					url="CHANGE_ME_OR_DELETE_ME"
+				 /> 
+			-->
+		</dependencies>
+	</about>
+	<!-- 
+		<require file="path/file.pluginmap" /> 
+	-->
+	<components>
+		<component 
+			id="cmp_RKWrdPlgnSkltnRKWrdPlgnSk"
+			label="RKWardPluginSkeleton"
+			type="standard"
+			file="plugins/RKWardPluginSkeleton.xml"
+		 />
+	</components>
+	<hierarchy>
+		<menu 
+			id="file"
+			label="File"
+		>
+			<menu 
+				id="men_RKWPSRKWPSRK"
+				label="RKWard Plugin Skeleton"
+			>
+				<entry component="cmp_RKWrdPlgnSkltnRKWrdPlgnSk" />
+			</menu>
+		</menu>
+	</hierarchy>
+	<!-- 
+		<context id="x11"></context> 
+	-->
+	<!-- 
+		<context id="import"></context> 
+	-->
+</document>

Added: trunk/rkward/packages/rkwarddev/inst/rkward/plugins/RKWardPluginSkeleton.js
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/rkward/plugins/RKWardPluginSkeleton.js	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/inst/rkward/plugins/RKWardPluginSkeleton.js	2011-10-08 19:20:39 UTC (rev 3912)
@@ -0,0 +1,198 @@
+function preprocess(){
+	// add requirements etc. here.
+	echo("require(rkwarddev)\n");
+
+}
+
+function calculate(){
+	// read in variables from dialog
+
+	var inpPluginnm = getValue("inp_Pluginnm");
+	var inpLicense = getValue("inp_License");
+	var inpShrtdscr = getValue("inp_Shrtdscr");
+	var inpVrsnnmbr = getValue("inp_Vrsnnmbr");
+	var inpRlsdtmpt = getValue("inp_Rlsdtmpt");
+	var inpHomepage = getValue("inp_Homepage");
+	var inpCategory = getValue("inp_Category");
+	var inpGivennam = getValue("inp_Givennam");
+	var inpFamilynm = getValue("inp_Familynm");
+	var inpEmail = getValue("inp_Email");
+	var chcAuthor = getValue("chc_Author");
+	var chcMaintanr = getValue("chc_Maintanr");
+	var brwDTEMPDIR = getValue("brw_DTEMPDIR");
+	var chcOvrwrtxs = getValue("chc_Ovrwrtxs");
+	var chcAddwzrds = getValue("chc_Addwzrds");
+	var chcIncldplg = getValue("chc_Incldplg");
+	var chcOpnflsfr = getValue("chc_Opnflsfr");
+	var chcAddplRKW = getValue("chc_AddplRKW");
+	var chcShwthplg = getValue("chc_Shwthplg");
+	var drpPlcntpmn = getValue("drp_Plcntpmn");
+	var chcDfndpndn = getValue("chc_Dfndpndn");
+	var inpRKWardmn = getValue("inp_RKWardmn");
+	var inpRKWardmx = getValue("inp_RKWardmx");
+	var inpRmin = getValue("inp_Rmin");
+	var inpRmax = getValue("inp_Rmax");
+
+	// put the R code to be evaluated here.
+	// define the array arrOptAuthorRole for values of R option "role"
+	var arrOptAuthorRole = new Array();
+		if(chcAuthor) {
+			arrOptAuthorRole.push("\"" + chcAuthor + "\"");
+		} else {}
+		if(chcMaintanr) {
+			arrOptAuthorRole.push("\"" + chcMaintanr + "\"");
+		} else {}
+	// clean array arrOptAuthorRole from empty strings
+	arrOptAuthorRole = arrOptAuthorRole.filter(String);
+	// set the actual variable optAuthorRole with all values for R option "role"
+	if(arrOptAuthorRole.length > 0) {
+		var optAuthorRole = "role=c(" + arrOptAuthorRole.join(", ") + ")";
+	} else {
+		var optAuthorRole = "";
+	}
+
+	// define the array arrOptAuthor for values of R option "author"
+	var arrOptAuthor = new Array();
+		if(inpGivennam) {
+			arrOptAuthor.push("given=\"" + inpGivennam + "\"");
+		} else {}
+		if(inpFamilynm) {
+			arrOptAuthor.push("family=\"" + inpFamilynm + "\"");
+		} else {}
+		if(inpEmail) {
+			arrOptAuthor.push("email=\"" + inpEmail + "\"");
+		} else {}
+		if(optAuthorRole) {
+			arrOptAuthor.push(optAuthorRole);
+		} else {}
+	// clean array arrOptAuthor from empty strings
+	arrOptAuthor = arrOptAuthor.filter(String);
+	// set the actual variable optAuthor with all values for R option "author"
+	if(arrOptAuthor.length > 0) {
+		var optAuthor = ",\n\tauthor=person(" + arrOptAuthor.join(", ") + ")";
+	} else {
+		var optAuthor = "";
+	}
+
+	// define the array arrOptAbout for values of R option "about"
+	var arrOptAbout = new Array();
+		if(inpShrtdscr) {
+			arrOptAbout.push("desc=\"" + inpShrtdscr + "\"");
+		} else {}
+		if(inpVrsnnmbr) {
+			arrOptAbout.push("version=\"" + inpVrsnnmbr + "\"");
+		} else {}
+		if(inpRlsdtmpt) {
+			arrOptAbout.push("date=\"" + inpRlsdtmpt + "\"");
+		} else {}
+		if(inpHomepage) {
+			arrOptAbout.push("url=\"" + inpHomepage + "\"");
+		} else {}
+		if(inpLicense) {
+			arrOptAbout.push("license=\"" + inpLicense + "\"");
+		} else {}
+		if(inpCategory) {
+			arrOptAbout.push("category=\"" + inpCategory + "\"");
+		} else {}
+	// clean array arrOptAbout from empty strings
+	arrOptAbout = arrOptAbout.filter(String);
+	// set the actual variable optAbout with all values for R option "about"
+	if(arrOptAbout.length > 0) {
+		var optAbout = ",\n\tabout=list(" + arrOptAbout.join(", ") + ")";
+	} else {
+		var optAbout = "";
+	}
+
+	// define the array arrOptDependencies for values of R option "dependencies"
+	var arrOptDependencies = new Array();
+		if(chcDfndpndn && inpRKWardmn) {
+			arrOptDependencies.push("rkward.min=\"" + inpRKWardmn + "\"");
+		} else {}
+		if(chcDfndpndn && inpRKWardmx) {
+			arrOptDependencies.push("rkward.max=\"" + inpRKWardmx + "\"");
+		} else {}
+		if(chcDfndpndn && inpRmin) {
+			arrOptDependencies.push("R.min=\"" + inpRmin + "\"");
+		} else {}
+		if(chcDfndpndn && inpRmax) {
+			arrOptDependencies.push("R.max=\"" + inpRmax + "\"");
+		} else {}
+	// clean array arrOptDependencies from empty strings
+	arrOptDependencies = arrOptDependencies.filter(String);
+	// set the actual variable optDependencies with all values for R option "dependencies"
+	if(arrOptDependencies.length > 0) {
+		var optDependencies = ",\n\tdependencies=list(" + arrOptDependencies.join(", ") + ")";
+	} else {
+		var optDependencies = "";
+	}
+
+	// define the array arrOptPluginmap for values of R option "pluginmap"
+	var arrOptPluginmap = new Array();
+		if(drpPlcntpmn!= "test") {
+			arrOptPluginmap.push("hierarchy=\"" + drpPlcntpmn + "\"");
+		} else {}
+	// clean array arrOptPluginmap from empty strings
+	arrOptPluginmap = arrOptPluginmap.filter(String);
+	// set the actual variable optPluginmap with all values for R option "pluginmap"
+	if(arrOptPluginmap.length > 0) {
+		var optPluginmap = "pluginmap=list(" + arrOptPluginmap.join(", ") + ")";
+	} else {
+		var optPluginmap = "";
+	}
+
+	// define the array arrOptSkeleton for values of R option ""
+	var arrOptSkeleton = new Array();
+		if(inpPluginnm) {
+			arrOptSkeleton.push("\n\tname=\"" + inpPluginnm + "\"");
+		} else {}
+		if(brwDTEMPDIR) {
+			arrOptSkeleton.push("\n\tpath=\"" + brwDTEMPDIR + "\"");
+		} else {}
+		if(chcAddwzrds) {
+			arrOptSkeleton.push("\n\tprovides=c(\"logic\", \"dialog\", \"wizard\")");
+		} else {}
+		if(optPluginmap) {
+			arrOptSkeleton.push("\n\t" + optPluginmap);
+		} else {}
+		if(chcOvrwrtxs) {
+			arrOptSkeleton.push("\n\toverwrite=TRUE");
+		} else {}
+		if(chcIncldplg) {
+			arrOptSkeleton.push("\n\ttests=TRUE");
+		} else {}
+		if(chcOpnflsfr) {
+			arrOptSkeleton.push("\n\tedit=TRUE");
+		} else {}
+		if(chcAddplRKW) {
+			arrOptSkeleton.push("\n\tload=TRUE");
+		} else {}
+		if(chcShwthplg) {
+			arrOptSkeleton.push("\n\tshow=TRUE");
+		} else {}
+	// clean array arrOptSkeleton from empty strings
+	arrOptSkeleton = arrOptSkeleton.filter(String);
+	// set the actual variable optSkeleton with all values for R option ""
+	if(arrOptSkeleton.length > 0) {
+		var optSkeleton = "" + arrOptSkeleton.join(", ") + "";
+	} else {
+		var optSkeleton = "";
+	}
+
+	echo("about.plugin <- rk.XML.about(");
+	if(inpPluginnm) {
+		echo("\n\tname=\"" + inpPluginnm + "\"");
+	} else {}
+	echo(optAuthor);
+	echo(optAbout);
+	echo(optDependencies);
+	echo("\n)\n\n");
+	echo("plugin.dir <- rk.plugin.skeleton(\n\tabout=about.plugin,");
+	echo(optSkeleton);
+	echo("\n)\n\n");
+}
+
+function printout(){
+	// printout the results
+	echo("rk.header(\"RKWard Plugin Skeleton results\", level=2)\n");
+	echo("rk.print(\"\")\n");
+}
\ No newline at end of file

Added: trunk/rkward/packages/rkwarddev/inst/rkward/plugins/RKWardPluginSkeleton.xml
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/rkward/plugins/RKWardPluginSkeleton.xml	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/inst/rkward/plugins/RKWardPluginSkeleton.xml	2011-10-08 19:20:39 UTC (rev 3912)
@@ -0,0 +1,109 @@
+<!DOCTYPE rkplugin >
+<document>
+	<code file="RKWardPluginSkeleton.js" />
+	<help file="RKWardPluginSkeleton.rkh" />
+	<include file="../RKWardPluginSkeleton.pluginmap" />
+	<logic>
+		<connect governor="chc_Dfndpndn.state" client="frm_DpndsRKW.enabled" />
+		<connect governor="chc_Dfndpndn.state" client="frm_DpndsnRv.enabled" />
+	</logic>
+	<dialog label="RKWard Plugin Skeleton">
+		<tabbook id="tbbk_PlgnSklt" label="Plugin Skeleton">
+			<tab label="About the plugin" id="tbb_Abtthplg">
+				<column>
+					<frame label="About the plugin" id="frm_Abtthplg">
+						<row>
+							<input label="Plugin name" id="inp_Pluginnm" size="small" required="true" />
+							<input label="License" id="inp_License" initial="GPL (>= 3)" required="true" />
+						</row>
+						<row>
+							<input label="Short description" id="inp_Shrtdscr" required="true" />
+						</row>
+						<row>
+							<input label="Version number" id="inp_Vrsnnmbr" initial="0.01-0" required="true" />
+							<input label="Release date (empty for today)" id="inp_Rlsdtmpt" />
+						</row>
+						<row>
+							<input label="Homepage" id="inp_Homepage" />
+							<input label="Category" id="inp_Category" />
+						</row>
+					</frame>
+					<frame label="Plugin author" id="frm_Plugnthr">
+						<row>
+							<column>
+								<input label="Given name" id="inp_Givennam" required="true" />
+								<input label="Family name" id="inp_Familynm" required="true" />
+								<input label="E-mail" id="inp_Email" required="true" />
+								<stretch />
+							</column>
+							<column>
+								<frame label="Author roles" id="frm_Authrrls">
+									<checkbox id="chc_Author" label="Author" value="aut" checked="true" />
+									<checkbox id="chc_Maintanr" label="Maintainer" value="cre" checked="true" />
+									<stretch />
+								</frame>
+							</column>
+						</row>
+					</frame>
+				</column>
+			</tab>
+			<tab label="Create options" id="tbb_Cretptns">
+				<column>
+					<frame>
+						<row>
+							<browser label="Directory to save to (empty for $TEMPDIR)" type="dir" id="brw_DTEMPDIR" required="false" />
+						</row>
+						<row>
+							<column>
+								<checkbox id="chc_Ovrwrtxs" label="Overwrite existing files" value="true" />
+								<checkbox id="chc_Addwzrds" label="Add wizard section" value="true" />
+								<checkbox id="chc_Incldplg" label="Include plugin tests" value="true" checked="true" />
+								<stretch />
+							</column>
+							<column>
+								<checkbox id="chc_Opnflsfr" label="Open files for editing" value="true" checked="true" />
+								<checkbox id="chc_AddplRKW" label="Add plugin to RKWard configuration" value="true" checked="true" />
+								<checkbox id="chc_Shwthplg" label="Show the plugin" value="true" />
+								<stretch />
+							</column>
+						</row>
+						<row>
+							<dropdown id="drp_Plcntpmn" label="Place in top menu">
+								<option label="Test (created if needed)" value="test" checked="true" />
+								<option label="File" value="file" />
+								<option label="Edit" value="edit" />
+								<option label="View" value="view" />
+								<option label="Workspace" value="workspace" />
+								<option label="Run" value="run" />
+								<option label="Data" value="data" />
+								<option label="Analysis" value="analysis" />
+								<option label="Plots" value="plots" />
+								<option label="Distributions" value="distributions" />
+								<option label="Windows" value="windows" />
+								<option label="Settings" value="settings" />
+								<option label="Help" value="help" />
+							</dropdown>
+						</row>
+					</frame>
+					<frame label="Dependencies" id="frm_Depndncs">
+						<row>
+							<checkbox id="chc_Dfndpndn" label="Define dependencies" value="true" />
+						</row>
+						<row>
+							<frame label="Depends on RKWard version" id="frm_DpndsRKW">
+								<input label="RKWard min" id="inp_RKWardmn" size="small" />
+								<input label="RKWard max" id="inp_RKWardmx" size="small" />
+								<stretch />
+							</frame>
+							<frame label="Depends on R version" id="frm_DpndsnRv">
+								<input label="R min" id="inp_Rmin" size="small" />
+								<input label="R max" id="inp_Rmax" size="small" />
+								<stretch />
+							</frame>
+						</row>
+					</frame>
+				</column>
+			</tab>
+		</tabbook>
+	</dialog>
+</document>

Modified: trunk/rkward/packages/rkwarddev/man/ite.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/ite.Rd	2011-10-08 12:48:53 UTC (rev 3911)
+++ trunk/rkward/packages/rkwarddev/man/ite.Rd	2011-10-08 19:20:39 UTC (rev 3912)
@@ -5,11 +5,17 @@
   ite(ifjs, thenjs, elsejs = NULL)
 }
 \arguments{
-  \item{ifjs}{A character string, to be placed in the
-  brackets if an \code{if()} statement.}
+  \item{ifjs}{Either a character string to be placed in the
+  brackets if an \code{if()} statement, or an object of
+  class \code{XiMpLe.node}. \code{rk.JS.arr} or
+  \code{rk.JS.opt} (whose identifier will be used).}
 
-  \item{thenjs}{A character string, the code to be executed
-  in case the \code{if()} statement is true.}
+  \item{thenjs}{Either a character string, the code to be
+  executed in case the \code{if()} statement is true, or an
+  object of class \code{XiMpLe.node}. \code{rk.JS.arr} or
+  \code{rk.JS.opt} (whose identifier will be used). The
+  latter is especially useful in combination with
+  \code{\link[rkwarddev:rk.JS.options]{rk.JS.options}}.}
 
   \item{elsejs}{A character string, the code to be executed
   in case the \code{if()} statement is not true.}
@@ -30,6 +36,7 @@
   \code{\link[rkwarddev:rk.paste.JS]{rk.paste.JS}},
   \code{\link[rkwarddev:rk.JS.vars]{rk.JS.vars}},
   \code{\link[rkwarddev:rk.JS.array]{rk.JS.array}},
+  \code{\link[rkwarddev:rk.JS.options]{rk.JS.options}},
   \code{\link[rkwarddev:echo]{echo}},
   \code{\link[rkwarddev:id]{id}},
   \code{\link[rkwarddev:qp]{qp}}, and the

Modified: trunk/rkward/packages/rkwarddev/man/rk.JS.options.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.JS.options.Rd	2011-10-08 12:48:53 UTC (rev 3911)
+++ trunk/rkward/packages/rkwarddev/man/rk.JS.options.Rd	2011-10-08 19:20:39 UTC (rev 3912)
@@ -3,7 +3,7 @@
 \title{Combine several options in one JavaScript variable}
 \usage{
   rk.JS.options(var, ..., collapse = ", ", option = NULL,
-  funct = "c", array = TRUE)
+  funct = NULL, array = TRUE)
 }
 \arguments{
   \item{var}{Character string, name of the JavaScript
@@ -11,12 +11,16 @@
 
   \item{...}{A list of objects of class \code{rk.JS.ite}
   (see \code{\link[rkwarddev:ite]{ite}}). Use the
-  \code{thenjs} element only to define the value to add to
-  the option (e.g., \code{"paired=TRUE"} or
+  \code{thenjs} element to define only the value to add to
+  the option, without commas (e.g., \code{"paired=TRUE"} or
   \code{qp("conf.level=\"", conflevel, "\"")}.}
 
   \item{collapse}{Character string, how all options should
-  be concatenated on the R code level.}
+  be concatenated on the R code level (if
+  \code{array=FALSE}), or how \code{option} should be added
+  to the generated R code. Hint: To place each option in a
+  new line with tab indentation, set
+  \code{collapse=",\\n\\t"}.}
 
   \item{option}{A character string, naming, e.g., an option
   of an R function which should be constructed from several
@@ -24,8 +28,8 @@
 
   \item{funct}{Character string, name of the R function to
   be called to combine the options, e.g. "list" for
-  \code{list()}, or "c" for \code{c()}. Only used if
-  \code{array=TRUE}.}
+  \code{list()}, or "c" for \code{c()}. Set to \code{NULL}
+  to drop. Only used if \code{array=TRUE}.}
 
   \item{array}{Logical, if \code{TRUE} will generate the
   options as an array, otherwise in one concatenated

Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.browser.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.browser.Rd	2011-10-08 12:48:53 UTC (rev 3911)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.browser.Rd	2011-10-08 19:20:39 UTC (rev 3912)
@@ -3,7 +3,7 @@
 \title{Create XML node "browser" for RKWard plugins}
 \usage{
   rk.XML.browser(label, type = "file", initial = NULL, urls
-  = FALSE, filter = NULL, required = FALSE, id.name =
+  = FALSE, filter = NULL, required = TRUE, id.name =
   "auto")
 }
 \arguments{

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