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

m-eik at users.sf.net m-eik at users.sf.net
Sun Oct 19 13:54:43 UTC 2014


Revision: 4936
          http://sourceforge.net/p/rkward/code/4936
Author:   m-eik
Date:     2014-10-19 13:54:42 +0000 (Sun, 19 Oct 2014)
Log Message:
-----------
rkwarddev: automatic JavaScript generation for optionsets works now. after unsuccessful experiments with envirinments the present solution is not so elegant (variable names are simply replaced by the same name with an added index, using gsub()), but should be robust enough to produce the desired output. it's already at work in the skeleton demo script.

Modified Paths:
--------------
    trunk/rkward/packages/rkwarddev/ChangeLog
    trunk/rkward/packages/rkwarddev/DESCRIPTION
    trunk/rkward/packages/rkwarddev/R/id.R
    trunk/rkward/packages/rkwarddev/R/ite.R
    trunk/rkward/packages/rkwarddev/R/rk-internal.R
    trunk/rkward/packages/rkwarddev/R/rk.JS.optionset.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R
    trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R
    trunk/rkward/packages/rkwarddev/R/show-methods.R
    trunk/rkward/packages/rkwarddev/R/zzz.rk.plot.opts-class.R
    trunk/rkward/packages/rkwarddev/demo/skeleton_dialog.R
    trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
    trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
    trunk/rkward/packages/rkwarddev/inst/rkward/RKWardPluginSkeleton.pluginmap
    trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.js
    trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.rkh
    trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.xml
    trunk/rkward/packages/rkwarddev/man/rk.JS.optionset.Rd
    trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd

Added Paths:
-----------
    trunk/rkward/packages/rkwarddev/R/00_class_01_rk.JS.arr.R
    trunk/rkward/packages/rkwarddev/R/00_class_02_rk.JS.var.R
    trunk/rkward/packages/rkwarddev/R/00_class_03_rk.JS.ite.R
    trunk/rkward/packages/rkwarddev/R/00_class_04_rk.JS.opt.R
    trunk/rkward/packages/rkwarddev/R/00_class_05_rk.JS.oset.R
    trunk/rkward/packages/rkwarddev/R/00_class_06_rk.plug.comp.R

Removed Paths:
-------------
    trunk/rkward/packages/rkwarddev/R/rk.JS.arr-class.R
    trunk/rkward/packages/rkwarddev/R/rk.JS.ite-class.R
    trunk/rkward/packages/rkwarddev/R/rk.JS.opt-class.R
    trunk/rkward/packages/rkwarddev/R/rk.JS.oset-class.R
    trunk/rkward/packages/rkwarddev/R/rk.JS.var-class.R
    trunk/rkward/packages/rkwarddev/R/rk.plug.comp-class.R

Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/ChangeLog	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1,6 +1,6 @@
 ChangeLog for package rkwarddev
 
-changes in version 0.06-5 (2014-10-16)
+changes in version 0.06-5 (2014-10-19)
 fixed:
   - the "show" feature in rk.plugin.skeleton() was broken due to changes in the namespace defaults
   - scanning plugin XML code for JS and help related content didn't work as expected in rk.plugin.component()
@@ -24,6 +24,7 @@
   - updated the plugin skeleton example script; e.g., it now uses the new .rkh file generating features
   - rk.XML.radio() and rk.XML.dropdown() now also accept objects made with rk.XML.option() in their respective
     list of options
+  - renamed all class definition files due to include problems with roxygenize()
 
 changes in version 0.06-4 (2014-09-14)
 added:

Modified: trunk/rkward/packages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/packages/rkwarddev/DESCRIPTION	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/DESCRIPTION	2014-10-19 13:54:42 UTC (rev 4936)
@@ -17,23 +17,26 @@
 Version: 0.06-5
 Date: 2014-10-19
 Collate:
+    '00_class_01_rk.JS.arr.R'
+    '00_class_02_rk.JS.var.R'
+    '00_class_03_rk.JS.ite.R'
+    '00_class_04_rk.JS.opt.R'
+    '00_class_05_rk.JS.oset.R'
+    'rk.rkh.doc.R'
+    'rk.XML.plugin.R'
+    'rk.JS.doc.R'
+    '00_class_06_rk.plug.comp.R'
     'echo.R'
     'i18n.R'
     'id.R'
-    'rk.JS.ite-class.R'
     'ite.R'
     'join.R'
     'qp.R'
     'rk.comment.R'
     'rk-internal.R'
-    'rk.JS.arr-class.R'
     'rk.JS.array.R'
-    'rk.JS.doc.R'
-    'rk.JS.opt-class.R'
     'rk.JS.options.R'
     'rk.JS.optionset.R'
-    'rk.JS.var-class.R'
-    'rk.JS.oset-class.R'
     'rk.JS.saveobj.R'
     'rk.JS.scan.R'
     'rk.JS.vars.R'
@@ -71,7 +74,6 @@
     'rk.XML.optiondisplay.R'
     'rk.XML.optionset.R'
     'rk.XML.page.R'
-    'rk.XML.plugin.R'
     'rk.XML.pluginmap.R'
     'rk.XML.preview.R'
     'rk.XML.radio.R'
@@ -101,8 +103,6 @@
     'rk.paste.JS.R'
     'rk.paste.JS.graph.R'
     'rk.plotOptions.R'
-    'rk.rkh.doc.R'
-    'rk.plug.comp-class.R'
     'rk.plugin.component.R'
     'rk.plugin.skeleton.R'
     'rk.rkh.caption.R'

Copied: trunk/rkward/packages/rkwarddev/R/00_class_01_rk.JS.arr.R (from rev 4935, trunk/rkward/packages/rkwarddev/R/rk.JS.arr-class.R)
===================================================================
--- trunk/rkward/packages/rkwarddev/R/00_class_01_rk.JS.arr.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/00_class_01_rk.JS.arr.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -0,0 +1,43 @@
+# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+
+#' @export
+
+# this simple class is for JavaScript generation,
+# produced by rk.JS.array()
+
+setClass("rk.JS.arr",
+  representation=representation(
+    arr.name="character",
+    opt.name="character",
+    IDs="vector",
+    variables="vector",
+    funct="character",
+    quote="logical",
+    option="character"
+  ),
+  prototype(
+    arr.name=character(),
+    opt.name=character(),
+    IDs=c(),
+    variables=c(),
+    funct="c",
+    quote=FALSE,
+    option=character()
+  )
+)

Copied: trunk/rkward/packages/rkwarddev/R/00_class_02_rk.JS.var.R (from rev 4935, trunk/rkward/packages/rkwarddev/R/rk.JS.var-class.R)
===================================================================
--- trunk/rkward/packages/rkwarddev/R/00_class_02_rk.JS.var.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/00_class_02_rk.JS.var.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -0,0 +1,55 @@
+# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+
+#' @export
+
+# this simple class is for JavaScript generation,
+# produced by rk.JS.vars()
+
+setClass("rk.JS.var",
+  representation=representation(
+    JS.var="character",
+    XML.var="character",
+    prefix="character",
+    modifiers="list",
+    default="logical",
+    join="character",
+    vars="list",
+    getter="character"
+  ),
+  prototype(
+    JS.var=character(),
+    XML.var=character(),
+    prefix=character(),
+    modifiers=list(),
+    default=FALSE,
+    join="",
+    vars=list(),
+    getter="getValue" # for compatibility with earlier releases
+  )
+)
+
+setValidity("rk.JS.var", function(object){
+    # vars in this object must be of the same class
+    sapply(slot(object, "vars"), function(this.var){
+      if(!inherits(this.var, "rk.JS.var")){
+        stop(simpleError("Slot 'vars' can only have a list of elements of class 'rk.JS.var'!"))
+      } else {}
+    })
+  return(TRUE)
+})

Copied: trunk/rkward/packages/rkwarddev/R/00_class_03_rk.JS.ite.R (from rev 4935, trunk/rkward/packages/rkwarddev/R/rk.JS.ite-class.R)
===================================================================
--- trunk/rkward/packages/rkwarddev/R/00_class_03_rk.JS.ite.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/00_class_03_rk.JS.ite.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -0,0 +1,59 @@
+# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+
+#' @export
+
+# this simple class is for JavaScript generation,
+# produced by ite()
+
+setClass("rk.JS.ite",
+  representation=representation(
+    ifJS="character",
+    thenJS="character",
+    thenifJS="list",
+    elseJS="character",
+    elifJS="list"
+  ),
+  prototype(
+    ifJS=character(),
+    thenJS=character(),
+    thenifJS=list(),
+    elseJS=character(),
+    elifJS=list()
+  )
+)
+
+setValidity("rk.JS.ite", function(object){
+    if(length(slot(object, "thenifJS")) > 1){
+      stop(simpleError("Slot 'thenifJS' can only have one list element!"))
+    } else {}
+    if(length(slot(object, "thenifJS")) == 1){
+      if(!inherits(slot(object, "thenifJS")[[1]], "rk.JS.ite")){
+        stop(simpleError("Slot 'thenifJS' can only have one list element of class 'rk.JS.ite'!"))
+      } else {}
+    } else {}
+    if(length(slot(object, "elifJS")) > 1){
+      stop(simpleError("Slot 'elifJS' can only have one list element!"))
+    } else {}
+    if(length(slot(object, "elifJS")) == 1){
+      if(!inherits(slot(object, "elifJS")[[1]], "rk.JS.ite")){
+        stop(simpleError("Slot 'elifJS' can only have one list element of class 'rk.JS.ite'!"))
+      } else {}
+    } else {}
+  return(TRUE)
+})

Copied: trunk/rkward/packages/rkwarddev/R/00_class_04_rk.JS.opt.R (from rev 4935, trunk/rkward/packages/rkwarddev/R/rk.JS.opt-class.R)
===================================================================
--- trunk/rkward/packages/rkwarddev/R/00_class_04_rk.JS.opt.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/00_class_04_rk.JS.opt.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -0,0 +1,50 @@
+# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+
+#' @export
+
+# this simple class is for JavaScript generation,
+# produced by rk.JS.options()
+
+setClass("rk.JS.opt",
+  representation=representation(
+    var.name="character",
+    opt.name="character",
+    collapse="character",
+    ifs="list",
+    array="logical",
+    funct="character"
+  ),
+  prototype(
+    var.name=character(),
+    opt.name=character(),
+    collapse=character(),
+    ifs=list(),
+    array=NULL,
+    funct=character()
+  )
+)
+
+setValidity("rk.JS.opt", function(object){
+  sapply(object at ifs, function(thisIf){
+    if(!inherits(thisIf, "rk.JS.ite")){
+      stop(simpleError("All option rules in rk.JS.opt objects must be of class rk.JS.ite!"))
+    }
+  })
+  return(TRUE)
+})

Copied: trunk/rkward/packages/rkwarddev/R/00_class_05_rk.JS.oset.R (from rev 4935, trunk/rkward/packages/rkwarddev/R/rk.JS.oset-class.R)
===================================================================
--- trunk/rkward/packages/rkwarddev/R/00_class_05_rk.JS.oset.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/00_class_05_rk.JS.oset.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -0,0 +1,52 @@
+# Copyright 2014 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# this simple class is for JavaScript generation,
+# produced by rk.JS.optionset()
+
+#' @include 00_class_02_rk.JS.var.R
+#' @export
+setClass("rk.JS.oset",
+  representation=representation(
+    vars="rk.JS.var",
+    loopvar="character",
+    columns="list",
+    body="list",
+    collapse="character"
+  ),
+  prototype(
+    vars=new("rk.JS.var"),
+    loopvar="i",
+    columns=list(),
+    body=list(),
+    collapse=",\\n\\t"
+  )
+)
+
+#' @include 00_class_02_rk.JS.var.R
+setValidity("rk.JS.oset", function(object){
+    sapply(slot(object, "columns"), function(this.col){
+      if(!inherits(this.col, "XiMpLe.node")){
+        stop(simpleError("Slot 'columns' can only have a list of elements of class 'XiMpLe.node'!"))
+      } else {}
+      if(!identical(XMLName(this.col), "optioncolumn")){
+        stop(simpleError("Slot 'columns' can only have a list of <optioncolumn> nodes!"))
+      } else {}
+    })
+  return(TRUE)
+})

Copied: trunk/rkward/packages/rkwarddev/R/00_class_06_rk.plug.comp.R (from rev 4935, trunk/rkward/packages/rkwarddev/R/rk.plug.comp-class.R)
===================================================================
--- trunk/rkward/packages/rkwarddev/R/00_class_06_rk.plug.comp.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/00_class_06_rk.plug.comp.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -0,0 +1,48 @@
+# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+
+#' @include rk.XML.plugin.R
+#' @include rk.JS.doc.R
+#' @include rk.rkh.doc.R
+#' @export
+
+# this class holds plugin components, i.e. single dialogs, to add to a plugin skeleton
+# produced by rk.plugin.component()
+
+setClass("rk.plug.comp",
+  representation=representation(
+    name="character",
+    create="vector",
+    xml="XiMpLe.doc",
+    js="character",
+    rkh="XiMpLe.doc",
+    hierarchy="list"
+  ),
+  prototype(
+    name=character(),
+    create=c(),
+    xml=new("XiMpLe.doc"),
+    js=character(),
+    rkh=new("XiMpLe.doc"),
+    hierarchy=list()
+  )
+)
+
+# setValidity("rk.plug.comp", function(object){
+#   return(TRUE)
+# })

Modified: trunk/rkward/packages/rkwarddev/R/id.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/id.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/id.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -89,13 +89,6 @@
         } else {
           text.part <- this.part
         }
-        # check for temoprary object to add inices for a for loop, see internal function paste.JS.optionsset()
-        addLoopIndex <- get.rk.env(name="IDLoopIndex", value=NULL)
-        if(!is.null(addLoopIndex)){
-          if(text.part %in% addLoopIndex[["columnIDs"]]){
-            text.part <- paste0(text.part, "[", addLoopIndex[["loopvar"]], "]")
-          } else {}
-        } else {}
         return(text.part)
       }
     })

Modified: trunk/rkward/packages/rkwarddev/R/ite.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/ite.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/ite.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -26,7 +26,7 @@
 #'    You can also give another object of class \code{rk.JS.ite}.
 #' @param elsejs Like \code{thenjs}, 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
+#' @include 00_class_03_rk.JS.ite.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}},

Modified: trunk/rkward/packages/rkwarddev/R/rk-internal.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk-internal.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk-internal.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1149,11 +1149,13 @@
   # check indentation
   main.indent <- indent(level, by=indent.by)
   scnd.indent <- indent(level+1, by=indent.by)
+  thrd.indent <- indent(level+2, by=indent.by)
 
   vars <- slot(object, "vars")
   loopvar <- slot(object, "loopvar")
   columns <- slot(object, "columns")
   body <- slot(object, "body")
+  collapse <- slot(object, "collapse")
 
   if(length(slot(vars, "vars")) > 0 | length(slot(vars, "JS.var")) > 0 ){
     paste.vars <- paste.JS.var(vars, level=level, indent.by=indent.by)
@@ -1162,24 +1164,25 @@
   }
 
   ## the for loop body
-#   for (var i = 0; i < col_a.length; ++i) {
-#         echo ("coolfun (", col_a[i] + ", " + col_b[i] + "," + col_c[i] + ")\n");
-#   }
   for.head <- paste0(main.indent, "for (var ", loopvar, " = 0; ", loopvar, " < ", id(columns[[1]]), ".length; ++", loopvar, "){")
 
-  # place a temporary object in the internal environment to cause id() to add an index to the column IDs
-  set.rk.env(
-    name="IDLoopIndex",
-    value=list(
-      columnIDs=sapply(columns, id),
-      loopvar=loopvar
-    )
+  paste.body <- sapply(body, function(bodyPart){
+      rk.paste.JS(bodyPart, level=level, indent.by=scnd.indent)
+    })
+  # replace the column IDs with indexed ones
+  for (thisCol in sapply(columns, id)){
+    paste.body <- gsub(
+      paste0("([^[:alnum:]]+|^)", thisCol, "([^[:alnum:]]+|$)"),
+      paste0("\\1", thisCol, "[", loopvar, "]\\2"),
+      paste.body, perl=TRUE)
+  }
+
+  for.foot <- paste0(
+    scnd.indent, "if(", loopvar, " + 1 < ", id(columns[[1]]), ".length) {\n",
+    thrd.indent, "echo(\"", collapse, "\");\n",
+    scnd.indent, "}\n",
+    main.indent, "}"
   )
-  paste.body <- rk.paste.JS(body, level=level, indent.by=scnd.indent)
-  # remove teporary object
-  set.rk.env(name="IDLoopIndex", value=NULL)
-
-  for.foot <- paste0(main.indent, "}")
   
   results <- paste(c(paste.vars, for.head, paste.body, for.foot), collapse="\n")
   return(results)

Deleted: trunk/rkward/packages/rkwarddev/R/rk.JS.arr-class.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.arr-class.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.arr-class.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1,43 +0,0 @@
-# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
-#
-# This file is part of the R package rkwarddev.
-#
-# rkwarddev is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# rkwarddev is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
-
-
-#' @export
-
-# this simple class is for JavaScript generation,
-# produced by rk.JS.array()
-
-setClass("rk.JS.arr",
-  representation=representation(
-    arr.name="character",
-    opt.name="character",
-    IDs="vector",
-    variables="vector",
-    funct="character",
-    quote="logical",
-    option="character"
-  ),
-  prototype(
-    arr.name=character(),
-    opt.name=character(),
-    IDs=c(),
-    variables=c(),
-    funct="c",
-    quote=FALSE,
-    option=character()
-  )
-)

Deleted: trunk/rkward/packages/rkwarddev/R/rk.JS.ite-class.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.ite-class.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.ite-class.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1,59 +0,0 @@
-# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
-#
-# This file is part of the R package rkwarddev.
-#
-# rkwarddev is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# rkwarddev is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
-
-
-#' @export
-
-# this simple class is for JavaScript generation,
-# produced by ite()
-
-setClass("rk.JS.ite",
-  representation=representation(
-    ifJS="character",
-    thenJS="character",
-    thenifJS="list",
-    elseJS="character",
-    elifJS="list"
-  ),
-  prototype(
-    ifJS=character(),
-    thenJS=character(),
-    thenifJS=list(),
-    elseJS=character(),
-    elifJS=list()
-  )
-)
-
-setValidity("rk.JS.ite", function(object){
-    if(length(slot(object, "thenifJS")) > 1){
-      stop(simpleError("Slot 'thenifJS' can only have one list element!"))
-    } else {}
-    if(length(slot(object, "thenifJS")) == 1){
-      if(!inherits(slot(object, "thenifJS")[[1]], "rk.JS.ite")){
-        stop(simpleError("Slot 'thenifJS' can only have one list element of class 'rk.JS.ite'!"))
-      } else {}
-    } else {}
-    if(length(slot(object, "elifJS")) > 1){
-      stop(simpleError("Slot 'elifJS' can only have one list element!"))
-    } else {}
-    if(length(slot(object, "elifJS")) == 1){
-      if(!inherits(slot(object, "elifJS")[[1]], "rk.JS.ite")){
-        stop(simpleError("Slot 'elifJS' can only have one list element of class 'rk.JS.ite'!"))
-      } else {}
-    } else {}
-  return(TRUE)
-})

Deleted: trunk/rkward/packages/rkwarddev/R/rk.JS.opt-class.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.opt-class.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.opt-class.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1,50 +0,0 @@
-# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
-#
-# This file is part of the R package rkwarddev.
-#
-# rkwarddev is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# rkwarddev is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
-
-
-#' @export
-
-# this simple class is for JavaScript generation,
-# produced by rk.JS.options()
-
-setClass("rk.JS.opt",
-  representation=representation(
-    var.name="character",
-    opt.name="character",
-    collapse="character",
-    ifs="list",
-    array="logical",
-    funct="character"
-  ),
-  prototype(
-    var.name=character(),
-    opt.name=character(),
-    collapse=character(),
-    ifs=list(),
-    array=NULL,
-    funct=character()
-  )
-)
-
-setValidity("rk.JS.opt", function(object){
-  sapply(object at ifs, function(thisIf){
-    if(!inherits(thisIf, "rk.JS.ite")){
-      stop(simpleError("All option rules in rk.JS.opt objects must be of class rk.JS.ite!"))
-    }
-  })
-  return(TRUE)
-})

Modified: trunk/rkward/packages/rkwarddev/R/rk.JS.optionset.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.optionset.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.optionset.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -27,17 +27,51 @@
 #' @param ... The JavaScript code, optionally including the optioncolumn objects. This will become
 #'    the body of the for loop.
 #' @param loopvar Character, name of the index variable used in the for loop.
+#' @param collapse Character string, how all optioncolumns should be concatenated on the R code level
+#'    Hint: To place each one on a new line with tab indentation, set \code{collapse=",\\n\\t"}.
 #' @param vars Logical, if \code{TRUE} all optioncolumn varaibles will be defined first. This is not
 #'    needed if \code{\link[rkwarddev:rk.JS.scan]{rk.JS.scan}} was already called.
 #' @param guess.getter Logical, if \code{TRUE} try to get a good default getter function for JavaScript
 #'    variable values. Only relevant if \code{vars=TRUE}.
+#' @include 00_class_02_rk.JS.var.R
+#' @include 00_class_05_rk.JS.oset.R
 #' @export
 #' @seealso
 #'    \code{\link[rkwarddev:rk.XML.optionset]{rk.XML.optionset}}, 
 #'    \code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}}
+#' @examples
+#' # this example is taken from the plugin skeleton script
+#' # first set up an optionset object
+#' dep.optionset.packages <- rk.XML.optionset(
+#'   content=rk.XML.frame(rk.XML.stretch(before=list(
+#'     rk.XML.row(
+#'       dep.pckg.name <- rk.XML.input("Package"),
+#'       dep.pckg.min <- rk.XML.input("min"),
+#'       dep.pckg.max <- rk.XML.input("max"),
+#'       dep.pckg.repo <- rk.XML.input("Repository")
+#'     )
+#'   )), label="Depends on R packages"),
+#'   optioncolumn=list(
+#'     dep.optioncol.pckg.name <- rk.XML.optioncolumn(connect=dep.pckg.name, modifier="text"),
+#'     dep.optioncol.pckg.min <- rk.XML.optioncolumn(connect=dep.pckg.min, modifier="text"),
+#'     dep.optioncol.pckg.max <- rk.XML.optioncolumn(connect=dep.pckg.max, modifier="text"),
+#'     dep.optioncol.pckg.repo <- rk.XML.optioncolumn(connect=dep.pckg.repo, modifier="text")
+#'   )
+#' )
+#' 
+#' # now translate it to JavaScript for loop
+# JS.optionset <- rk.JS.optionset(dep.optionset.packages,
+#   echo("c("),
+#   echo("name=\"", dep.optioncol.pckg.name, "\""),
+#   ite(dep.optioncol.pckg.min, echo(", min=\"", dep.optioncol.pckg.min, "\"")),
+#   ite(dep.optioncol.pckg.max, echo(", max=\"", dep.optioncol.pckg.max, "\"")),
+#   ite(dep.optioncol.pckg.repo, echo(", repository=\"", dep.optioncol.pckg.repo, "\"")),
+#   echo(")")
+# )
 
-rk.JS.optionset <- function(optionset, ..., loopvar="i", vars=FALSE, guess.getter=TRUE){
+rk.JS.optionset <- function(optionset, ..., loopvar="i", collapse=",\\n\\t", vars=FALSE, guess.getter=TRUE){
   optioncolumn.nodes <- child.list(XMLScan(optionset, "optioncolumn"))
+  # profit from lazy evaluation, let this be done by paste
   loopbody <- list(...)
 
   if(isTRUE(vars)){
@@ -65,7 +99,8 @@
     vars=JS.vars,
     loopvar=loopvar,
     columns=optioncolumn.nodes,
-    body=loopbody
+    body=loopbody,
+    collapse=collapse
   )
 
   return(JS.osfor)

Deleted: trunk/rkward/packages/rkwarddev/R/rk.JS.oset-class.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.oset-class.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.oset-class.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1,50 +0,0 @@
-# Copyright 2014 Meik Michalke <meik.michalke at hhu.de>
-#
-# This file is part of the R package rkwarddev.
-#
-# rkwarddev is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# rkwarddev is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
-
-
-#' @include rk.JS.var-class.R
-#' @export
-
-# this simple class is for JavaScript generation,
-# produced by rk.JS.optionset()
-
-setClass("rk.JS.oset",
-  representation=representation(
-    vars="rk.JS.var",
-    loopvar="character",
-    columns="list",
-    body="list"
-  ),
-  prototype(
-    vars=new("rk.JS.var"),
-    loopvar="i",
-    columns=list(),
-    body=list()
-  )
-)
-
-setValidity("rk.JS.oset", function(object){
-    sapply(slot(object, "columns"), function(this.col){
-      if(!inherits(this.col, "XiMpLe.node")){
-        stop(simpleError("Slot 'columns' can only have a list of elements of class 'XiMpLe.node'!"))
-      } else {}
-      if(!identical(XMLName(this.col), "optioncolumn")){
-        stop(simpleError("Slot 'columns' can only have a list of <optioncolumn> nodes!"))
-      } else {}
-    })
-  return(TRUE)
-})

Deleted: trunk/rkward/packages/rkwarddev/R/rk.JS.var-class.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.var-class.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.var-class.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1,55 +0,0 @@
-# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
-#
-# This file is part of the R package rkwarddev.
-#
-# rkwarddev is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# rkwarddev is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
-
-
-#' @export
-
-# this simple class is for JavaScript generation,
-# produced by rk.JS.vars()
-
-setClass("rk.JS.var",
-  representation=representation(
-    JS.var="character",
-    XML.var="character",
-    prefix="character",
-    modifiers="list",
-    default="logical",
-    join="character",
-    vars="list",
-    getter="character"
-  ),
-  prototype(
-    JS.var=character(),
-    XML.var=character(),
-    prefix=character(),
-    modifiers=list(),
-    default=FALSE,
-    join="",
-    vars=list(),
-    getter="getValue" # for compatibility with earlier releases
-  )
-)
-
-setValidity("rk.JS.var", function(object){
-    # vars in this object must be of the same class
-    sapply(slot(object, "vars"), function(this.var){
-      if(!inherits(this.var, "rk.JS.var")){
-        stop(simpleError("Slot 'vars' can only have a list of elements of class 'rk.JS.var'!"))
-      } else {}
-    })
-  return(TRUE)
-})

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -21,8 +21,12 @@
 #' Note that if you want to refer to the optioncolumns in your JavaScript code, the \code{id}
 #' you need is a combination of \code{<optionset id>.<optioncolumn id>.<modifier>}. that is,
 #' you must always prefix it with the sets' \code{id}. For JavaScript code generating with
-#' \code{rkwarddev}, you can use the ID that functions like \code{\link[rkwarddev:id]{id}} return,
-#' because the JavaScript variable name will only contain a constant prefix ("ocol") and the column ID.
+#' \code{rkwarddev}, the easiest way to get to results is to use \code{\link[rkwarddev:rk.JS.optionset]{rk.JS.optionset}}.
+#' It will automatically place your code fragments into a for loop and iterate through all available
+#' rows of the set.
+#' 
+#' If this isn't flexible enough for your needs, you can also use the ID that functions like \code{\link[rkwarddev:id]{id}}
+#' return, because the JavaScript variable name will only contain a constant prefix ("ocol") and the column ID.
 #'
 #' @note The \code{<optionset>} node was introduced with RKWard 0.6.1, please set the dependencies
 #'    of your component/plugin accordingly.
@@ -47,6 +51,7 @@
 #' @seealso
 #'    \code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}},
 #'    \code{\link[rkwarddev:rk.XML.optiondisplay]{rk.XML.optiondisplay}},
+#'    \code{\link[rkwarddev:rk.JS.optionset]{rk.JS.optionset}},
 #'    and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
 #' @examples
 #' firstname <- rk.XML.input("Given name(s)")

Modified: trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -43,11 +43,11 @@
 #' @param empty.e For \code{rk.JS.ite} objects only: Logical, if \code{TRUE} will force to add empty \code{else \{\}} brackets when
 #'    there is no \code{else} statement defined, which is considered to enhance code readability by some.
 #' @return A character string.
-#' @include rk.JS.arr-class.R
-#' @include rk.JS.ite-class.R
-#' @include rk.JS.opt-class.R
-#' @include rk.JS.oset-class.R
-#' @include rk.JS.var-class.R
+#' @include 00_class_01_rk.JS.arr.R
+#' @include 00_class_03_rk.JS.ite.R
+#' @include 00_class_04_rk.JS.opt.R
+#' @include 00_class_05_rk.JS.oset.R
+#' @include 00_class_02_rk.JS.var.R
 #' @seealso
 #'    \code{\link[rkwarddev:rk.JS.array]{rk.JS.array}},
 #'    \code{\link[rkwarddev:rk.JS.options]{rk.JS.options}},

Deleted: trunk/rkward/packages/rkwarddev/R/rk.plug.comp-class.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.plug.comp-class.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/rk.plug.comp-class.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1,48 +0,0 @@
-# Copyright 2010-2014 Meik Michalke <meik.michalke at hhu.de>
-#
-# This file is part of the R package rkwarddev.
-#
-# rkwarddev is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# rkwarddev is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
-
-
-#' @include rk.XML.plugin.R
-#' @include rk.JS.doc.R
-#' @include rk.rkh.doc.R
-#' @export
-
-# this class holds plugin components, i.e. single dialogs, to add to a plugin skeleton
-# produced by rk.plugin.component()
-
-setClass("rk.plug.comp",
-  representation=representation(
-    name="character",
-    create="vector",
-    xml="XiMpLe.doc",
-    js="character",
-    rkh="XiMpLe.doc",
-    hierarchy="list"
-  ),
-  prototype(
-    name=character(),
-    create=c(),
-    xml=new("XiMpLe.doc"),
-    js=character(),
-    rkh=new("XiMpLe.doc"),
-    hierarchy=list()
-  )
-)
-
-# setValidity("rk.plug.comp", function(object){
-#   return(TRUE)
-# })

Modified: trunk/rkward/packages/rkwarddev/R/show-methods.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/show-methods.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/show-methods.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -22,11 +22,11 @@
 #' @aliases show,-methods show,rk.JS.ite-method show,rk.JS.arr-method show,rk.JS.opt-method show,rk.JS.oset-method show,rk.JS.var-method
 #' @keywords methods
 #' @import methods
-#' @include rk.JS.arr-class.R
-#' @include rk.JS.ite-class.R
-#' @include rk.JS.opt-class.R
-#' @include rk.JS.oset-class.R
-#' @include rk.JS.var-class.R
+#' @include 00_class_01_rk.JS.arr.R
+#' @include 00_class_02_rk.JS.var.R
+#' @include 00_class_03_rk.JS.ite.R
+#' @include 00_class_04_rk.JS.opt.R
+#' @include 00_class_05_rk.JS.oset.R
 #' @include echo.R
 #' @exportMethod show
 #' @rdname show-methods

Modified: trunk/rkward/packages/rkwarddev/R/zzz.rk.plot.opts-class.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/zzz.rk.plot.opts-class.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/R/zzz.rk.plot.opts-class.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -23,7 +23,7 @@
 # so for the time being, this file is renamed to be parsed at the end
 
 #' @include rk.XML.embed.R
-#' @include rk.JS.var-class.R
+#' @include 00_class_02_rk.JS.var.R
 #' @include rk.JS.vars.R
 #' @export
 

Modified: trunk/rkward/packages/rkwarddev/demo/skeleton_dialog.R
===================================================================
--- trunk/rkward/packages/rkwarddev/demo/skeleton_dialog.R	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/demo/skeleton_dialog.R	2014-10-19 13:54:42 UTC (rev 4936)
@@ -130,20 +130,20 @@
         content=rk.XML.frame(rk.XML.stretch(before=list(
           rk.XML.row(
             dep.pckg.name <- rk.XML.input("Package",
-              help="The names of R packages required to run this plugin.")#,
-#             dep.pckg.min <- rk.XML.input("min",
-#               help="The minimum version number of R packages required to run this plugin."),
-#             dep.pckg.max <- rk.XML.input("max",
-#               help="The maximum version number of R packages required to run this plugin."),
-#             dep.pckg.repo <- rk.XML.input("Repository",
-#               help="The repository to download R packages from required to run this plugin.")
+              help="The names of R packages required to run this plugin."),
+            dep.pckg.min <- rk.XML.input("min",
+              help="The minimum version number of R packages required to run this plugin."),
+            dep.pckg.max <- rk.XML.input("max",
+              help="The maximum version number of R packages required to run this plugin."),
+            dep.pckg.repo <- rk.XML.input("Repository",
+              help="The repository to download R packages from required to run this plugin.")
          )
         )), label="Depends on R packages"),
         optioncolumn=list(
-          dep.optioncol.pckg.name <- rk.XML.optioncolumn(connect=dep.pckg.name, modifier="text")#,
-#           dep.optioncol.pckg.min <- rk.XML.optioncolumn(connect=dep.pckg.min, modifier="text"),
-#           dep.optioncol.pckg.max <- rk.XML.optioncolumn(connect=dep.pckg.max, modifier="text"),
-#           dep.optioncol.pckg.repo <- rk.XML.optioncolumn(connect=dep.pckg.repo, modifier="text")
+          dep.optioncol.pckg.name <- rk.XML.optioncolumn(connect=dep.pckg.name, modifier="text"),
+          dep.optioncol.pckg.min <- rk.XML.optioncolumn(connect=dep.pckg.min, modifier="text"),
+          dep.optioncol.pckg.max <- rk.XML.optioncolumn(connect=dep.pckg.max, modifier="text"),
+          dep.optioncol.pckg.repo <- rk.XML.optioncolumn(connect=dep.pckg.repo, modifier="text")
         )
       )
   ),
@@ -284,7 +284,19 @@
       ite(id(js.opt.about.dep), echo(js.opt.about.dep)),
       ite(id(js.opt.about.dep, " && ", dep.optioncol.pckg.name), echo(",")),
       ite(id(dep.optioncol.pckg.name , "!= \"\""),
-        echo("\n\tpackage=list(\n\t\tc(name=\"", join(dep.optioncol.pckg.name, by="\"),\n\t\tc(name=\""), "\")\n\t)"),
+        rk.paste.JS(
+          echo("\n\tpackage=list(\n\t\t"),
+          rk.JS.optionset(dep.optionset.packages,
+            echo("c("),
+            echo("name=\"", dep.optioncol.pckg.name, "\""),
+            ite(dep.optioncol.pckg.min, echo(", min=\"", dep.optioncol.pckg.min, "\"")),
+            ite(dep.optioncol.pckg.max, echo(", max=\"", dep.optioncol.pckg.max, "\"")),
+            ite(dep.optioncol.pckg.repo, echo(", repository=\"", dep.optioncol.pckg.repo, "\"")),
+            echo(")"),
+            collapse=",\\n\\t\\t"
+          ),
+          echo("\n\t)")
+        )
       ),
       echo("\n)\n\n"),
     level=3)),

Modified: trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/NEWS.Rd	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/inst/NEWS.Rd	2014-10-19 13:54:42 UTC (rev 4936)
@@ -1,7 +1,7 @@
 \name{NEWS}
 \title{News for Package 'rkwarddev'}
 \encoding{UTF-8}
-\section{Changes in rkwarddev version 0.06-5 (2014-10-16)}{
+\section{Changes in rkwarddev version 0.06-5 (2014-10-19)}{
   \subsection{fixed}{
     \itemize{
       \item the \code{"show"} feature in \code{rk.plugin.skeleton()} was broken due to changes in the namespace defaults
@@ -32,6 +32,7 @@
       \item updated the plugin skeleton example script; e.g., it now uses the new .rkh file generating features
       \item \code{rk.XML.radio()} and \code{rk.XML.dropdown()} now also accept objects made with \code{rk.XML.option()} in their respective
         list of options
+      \item renamed all class definition files due to include problems with \code{roxygenize()}
     }
   }
 }

Modified: trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
===================================================================
(Binary files differ)

Modified: trunk/rkward/packages/rkwarddev/inst/rkward/RKWardPluginSkeleton.pluginmap
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/rkward/RKWardPluginSkeleton.pluginmap	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/inst/rkward/RKWardPluginSkeleton.pluginmap	2014-10-19 13:54:42 UTC (rev 4936)
@@ -15,7 +15,7 @@
 		shortinfo="GUI interface to create RKWard plugin skeletons"
 		longinfo="GUI interface to create RKWard plugin skeletons"
 		version="0.06-5"
-		releasedate="2014-10-15"
+		releasedate="2014-10-19"
 		url="http://rkward.sf.net"
 		license="GPL (>= 3)"
 	>

Modified: trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.js
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.js	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.js	2014-10-19 13:54:42 UTC (rev 4936)
@@ -34,7 +34,6 @@
 
 function calculate(){
 	// read in variables from dialog
-	var ocolOclInpPckgtxt = getList("ost_frDRDRPPPP.ocl_inpPckgtxt");
 	var inpPluginnm = getString("inp_Pluginnm");
 	var inpLicense = getString("inp_License");
 	var inpShrtdscr = getString("inp_Shrtdscr");
@@ -61,6 +60,14 @@
 	var inpRKWardmx = getString("inp_RKWardmx");
 	var inpRmin = getString("inp_Rmin");
 	var inpRmax = getString("inp_Rmax");
+	var inpPackage = getString("inp_Package");
+	var inpMin = getString("inp_min");
+	var inpMax = getString("inp_max");
+	var inpRepostry = getString("inp_Repostry");
+	var ocolOclInpPckgtxt = getList("ost_fDRDRPPRRP.ocl_inpPckgtxt");
+	var ocolOclInpmintext = getList("ost_fDRDRPPRRP.ocl_inpmintext");
+	var ocolOclInpmaxtext = getList("ost_fDRDRPPRRP.ocl_inpmaxtext");
+	var ocolOclInpRpstryt = getList("ost_fDRDRPPRRP.ocl_inpRpstryt");
 	var inpSummary = getString("inp_Summary");
 	var inpUsage = getString("inp_Usage");
 	var frmDfndpndnChecked = getBoolean("frm_Dfndpndn.checked");
@@ -274,8 +281,26 @@
 			echo(",");
 		}
 		if(ocolOclInpPckgtxt!= "") {
-			echo("\n\tpackage=list(\n\t\tc(name=\"" + ocolOclInpPckgtxt.join("\"),\n\t\tc(name=\"") + "\")\n\t)");
+			echo("\n\tpackage=list(\n\t\t");
+	for (var i = 0; i < ocolOclInpPckgtxt.length; ++i){
+		echo("c(");
+		echo("name=\"" + ocolOclInpPckgtxt[i] + "\"");
+		if(ocolOclInpmintext[i]) {
+				echo(", min=\"" + ocolOclInpmintext[i] + "\"");
 		}
+		if(ocolOclInpmaxtext[i]) {
+				echo(", max=\"" + ocolOclInpmaxtext[i] + "\"");
+		}
+		if(ocolOclInpRpstryt[i]) {
+				echo(", repository=\"" + ocolOclInpRpstryt[i] + "\"");
+		}
+		echo(")");
+		if(i + 1 < ocolOclInpPckgtxt.length) {
+			echo(",\n\t\t");
+		}
+	}
+	echo("\n\t)");
+		}
 		echo("\n)\n\n");
 	}
 	echo("# name of the main component, relevant for help page content\nrk.set.comp(\"");

Modified: trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.rkh
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.rkh	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.rkh	2014-10-19 13:54:42 UTC (rev 4936)
@@ -109,7 +109,23 @@
 		<setting id="inp_Package">
 			The names of R packages required to run this plugin.
 		</setting>
-		<setting id="ocl_inpPckgtxt" />
+		<setting id="inp_min">
+			The minimum version number of R packages required to run this plugin.
+		</setting>
+		<setting id="inp_max">
+			The maximum version number of R packages required to run this plugin.
+		</setting>
+		<setting id="inp_Repostry">
+			The repository to download R packages from required to run this plugin.
+		</setting>
+		<setting id="ost_fDRDRPPRRP.ocl_inpPckgtxt">
+		</setting>
+		<setting id="ost_fDRDRPPRRP.ocl_inpmintext">
+		</setting>
+		<setting id="ost_fDRDRPPRRP.ocl_inpmaxtext">
+		</setting>
+		<setting id="ost_fDRDRPPRRP.ocl_inpRpstryt">
+		</setting>
 		<caption id="tab_Helppage" />
 		<caption id="frm_Wrthlpfl" />
 		<setting id="inp_Summary">

Modified: trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.xml
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.xml	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/inst/rkward/plugins/CreateRKWardpluginskeleton.xml	2014-10-19 13:54:42 UTC (rev 4936)
@@ -103,18 +103,24 @@
 								<stretch />
 							</frame>
 						</row>
-						<row id="row_oDRDRPPPPD">
-							<optionset id="ost_frDRDRPPPP">
+						<row id="row_oDRDRPPRRP">
+							<optionset id="ost_fDRDRPPRRP">
 								<content>
 									<optiondisplay />
 									<frame label="Depends on R packages" id="frm_DpndsnRp">
-										<row id="row_inptlblPcP">
+										<row id="row_inptlbPPRR">
 											<input label="Package" id="inp_Package" />
+											<input label="min" id="inp_min" />
+											<input label="max" id="inp_max" />
+											<input label="Repository" id="inp_Repostry" />
 										</row>
 										<stretch />
 									</frame>
 								</content>
 								<optioncolumn id="ocl_inpPckgtxt" connect="inp_Package.text" label="Package" />
+								<optioncolumn id="ocl_inpmintext" connect="inp_min.text" label="min" />
+								<optioncolumn id="ocl_inpmaxtext" connect="inp_max.text" label="max" />
+								<optioncolumn id="ocl_inpRpstryt" connect="inp_Repostry.text" label="Repository" />
 							</optionset>
 						</row>
 					</frame>

Modified: trunk/rkward/packages/rkwarddev/man/rk.JS.optionset.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.JS.optionset.Rd	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/man/rk.JS.optionset.Rd	2014-10-19 13:54:42 UTC (rev 4936)
@@ -3,8 +3,8 @@
 \alias{rk.JS.optionset}
 \title{Evaluate optionset objects in plugin JavaScript}
 \usage{
-rk.JS.optionset(optionset, ..., loopvar = "i", vars = FALSE,
-  guess.getter = TRUE)
+rk.JS.optionset(optionset, ..., loopvar = "i", collapse = ",\\\\n\\\\t",
+  vars = FALSE, guess.getter = TRUE)
 }
 \arguments{
 \item{optionset}{A XiMpLe.node object, the full \code{<optionset>} node.}
@@ -15,6 +15,11 @@
 
 \item{loopvar}{Character, name of the index variable used in the for loop.}
 
+\item{collapse}{Character string,
+      how all optioncolumns should be concatenated on the R code level
+Hint: To place each one on a new line with tab indentation, set \code{collapse=",
+     \\n\\t"}.}
+
 \item{vars}{Logical,
       if \code{TRUE} all optioncolumn varaibles will be defined first. This is not
 needed if \code{\link[rkwarddev:rk.JS.scan]{rk.JS.scan}} was already called.}
@@ -31,6 +36,29 @@
 \code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}} to refer to the respective column,
 \code{rk.JS.optionset} will use appropriate variables.
 }
+\examples{
+# this example is taken from the plugin skeleton script
+# first set up an optionset object
+dep.optionset.packages <- rk.XML.optionset(
+  content=rk.XML.frame(rk.XML.stretch(before=list(
+    rk.XML.row(
+      dep.pckg.name <- rk.XML.input("Package"),
+      dep.pckg.min <- rk.XML.input("min"),
+      dep.pckg.max <- rk.XML.input("max"),
+      dep.pckg.repo <- rk.XML.input("Repository")
+    )
+  )), label="Depends on R packages"),
+  optioncolumn=list(
+    dep.optioncol.pckg.name <- rk.XML.optioncolumn(connect=dep.pckg.name,
+      modifier="text"),
+    dep.optioncol.pckg.min <- rk.XML.optioncolumn(connect=dep.pckg.min, modifier="text"),
+    dep.optioncol.pckg.max <- rk.XML.optioncolumn(connect=dep.pckg.max, modifier="text"),
+    dep.optioncol.pckg.repo <- rk.XML.optioncolumn(connect=dep.pckg.repo, modifier="text")
+  )
+)
+
+# now translate it to JavaScript for loop
+}
 \seealso{
 \code{\link[rkwarddev:rk.XML.optionset]{rk.XML.optionset}},
    \code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}}

Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd	2014-10-18 22:23:39 UTC (rev 4935)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd	2014-10-19 13:54:42 UTC (rev 4936)
@@ -46,9 +46,16 @@
 you need is a combination of \code{<optionset id>.<optioncolumn id>.<modifier>}. that is,
 you must always prefix it with the sets' \code{id}. For JavaScript code generating with
 \code{rkwarddev},
-      you can use the ID that functions like \code{\link[rkwarddev:id]{id}} return,
-because the JavaScript variable name will only contain a constant prefix ("ocol") and the column ID.
+      the easiest way to get to results is to use \code{\link[rkwarddev:rk.JS.optionset]{rk.JS.optionset}}.
+It will automatically place your code fragments into a for loop and iterate through all available
+rows of the set.
 }
+\details{
+If this isn't flexible enough for your needs,
+      you can also use the ID that functions like \code{\link[rkwarddev:id]{id}}
+return,
+      because the JavaScript variable name will only contain a constant prefix ("ocol") and the column ID.
+}
 \note{
 The \code{<optionset>} node was introduced with RKWard 0.6.1, please set the dependencies
    of your component/plugin accordingly.
@@ -75,6 +82,7 @@
 \seealso{
 \code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}},
    \code{\link[rkwarddev:rk.XML.optiondisplay]{rk.XML.optiondisplay}},
+   \code{\link[rkwarddev:rk.JS.optionset]{rk.JS.optionset}},
    and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
 }
 





More information about the rkward-tracker mailing list