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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Fri Sep 16 15:38:51 UTC 2011


Revision: 3790
          http://rkward.svn.sourceforge.net/rkward/?rev=3790&view=rev
Author:   m-eik
Date:     2011-09-16 15:38:51 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
rkwarddev: added spinbox files...

Added Paths:
-----------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.spinbox.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.spinbox.Rd

Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.spinbox.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.spinbox.R	                        (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.spinbox.R	2011-09-16 15:38:51 UTC (rev 3790)
@@ -0,0 +1,52 @@
+#' Create XML node "spinbox" for RKWard plugins
+#'
+#' @param label Character string, a text label for this plugin element.
+#' @param min Numeric, the lowest value allowed. Defaults to the lowest value technically representable in the spinbox.
+#' @param max Numeric, the largest value allowed. Defaults to the highest value technically representable in the spinbox.
+#' @param initial Numeric, will be used as the initial value.
+#' @param real Logical, whether values should be real or integer numbers.
+#' @param precision Numeric, if \code{real=TRUE} defines the default number of decimal places shown in the spinbox.
+#' @param max.precision Numeric, maximum number of digits that can be meaningfully represented.
+#' @param id.name Character string, a unique ID for this plugin element.
+#'		If \code{"auto"} and a label was provided, an ID will be generated automatically from the label.
+#' @return An object of class \code{XiMpLe.node}.
+#' @export
+#' @examples
+#' test.spinbox <- rk.XML.spinbox("Spin this:")
+#' cat(pasteXMLNode(test.spinbox, shine=1))
+
+
+rk.XML.spinbox <- function(label, min=NULL, max=NULL, initial=0, real=TRUE, precision=2, max.precision=8, id.name="auto"){
+	attr.list <- list(label=label)
+
+	if(identical(id.name, "auto")){
+		attr.list[["id"]] <- list(id=auto.ids(label, prefix=ID.prefix("spinbox")))
+	} else if(!is.null(id.name)){
+		attr.list[["id"]] <- id.name
+	} else {}
+
+	if(is.numeric(initial) & initial != 0){
+		attr.list[["initial"]] <- initial
+	} else {}
+	if(!is.null(min)){
+		attr.list[["min"]] <- min
+	} else {}
+	if(!is.null(max)){
+		attr.list[["max"]] <- max
+	} else {}
+	if(!isTRUE(real)){
+		attr.list[["type"]] <- "integer"
+	} else {}
+	if(is.numeric(precision) & precision != 2){
+		attr.list[["precision"]] <- precision
+	} else {}
+	if(is.numeric(max.precision) & max.precision != 8){
+		attr.list[["max.precision"]] <- max.precision
+	} else {}
+
+	node <- new("XiMpLe.node",
+			name="spinbox",
+			attributes=attr.list)
+
+	return(node)
+}

Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.spinbox.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.spinbox.Rd	                        (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.spinbox.Rd	2011-09-16 15:38:51 UTC (rev 3790)
@@ -0,0 +1,48 @@
+\name{rk.XML.spinbox}
+\alias{rk.XML.spinbox}
+\title{Create XML node "spinbox" for RKWard plugins}
+\usage{
+  rk.XML.spinbox(label, min = NULL, max = NULL, initial =
+  0, real = TRUE, precision = 2, max.precision = 8, id.name
+  = "auto")
+}
+\arguments{
+  \item{label}{Character string, a text label for this
+  plugin element.}
+
+  \item{min}{Numeric, the lowest value allowed. Defaults to
+  the lowest value technically representable in the
+  spinbox.}
+
+  \item{max}{Numeric, the largest value allowed. Defaults
+  to the highest value technically representable in the
+  spinbox.}
+
+  \item{initial}{Numeric, will be used as the initial
+  value.}
+
+  \item{real}{Logical, whether values should be real or
+  integer numbers.}
+
+  \item{precision}{Numeric, if \code{real=TRUE} defines the
+  default number of decimal places shown in the spinbox.}
+
+  \item{max.precision}{Numeric, maximum number of digits
+  that can be meaningfully represented.}
+
+  \item{id.name}{Character string, a unique ID for this
+  plugin element. If \code{"auto"} and a label was
+  provided, an ID will be generated automatically from the
+  label.}
+}
+\value{
+  An object of class \code{XiMpLe.node}.
+}
+\description{
+  Create XML node "spinbox" for RKWard plugins
+}
+\examples{
+test.spinbox <- rk.XML.spinbox("Spin this:")
+cat(pasteXMLNode(test.spinbox, shine=1))
+}
+

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