From 2406cfe00db3c719f1dcec2204a0c8d617436512 Mon Sep 17 00:00:00 2001 From: "arsenij.ustjanzew" <arsenij.ustjanzew@mpi-bn.mpg.de> Date: Mon, 17 Feb 2020 17:17:53 +0100 Subject: [PATCH] Getter and setter methods for title, author, datadir and theme for correct access to the slots of the object --- NAMESPACE | 9 ++++++ R/AllGenerics.R | 26 ++++++++++++++++ R/get_set.R | 64 ++++++++++++++++++++++++++++++++++++++++ man/i2dashboard-class.Rd | 24 +++++++++++++++ 4 files changed, 123 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 97d8b5e..4f3d95c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,15 +1,24 @@ # Generated by roxygen2: do not edit by hand export("%>%") +export("interactivity<-") export(add_colormap) export(add_component) export(add_page) export(add_to_sidebar) export(assemble) export(embed_var) +export(get_author) +export(get_datadir) +export(get_theme) +export(get_title) export(i2dashboard) export(interactivity) export(remove_page) +export(set_author) +export(set_datadir) +export(set_theme) +export(set_title) exportClasses(i2dashboard) exportMethods(add_colormap) exportMethods(add_component) diff --git a/R/AllGenerics.R b/R/AllGenerics.R index b875979..ddfd9e4 100644 --- a/R/AllGenerics.R +++ b/R/AllGenerics.R @@ -19,4 +19,30 @@ setGeneric("add_colormap", function(dashboard, ...) standardGeneric("add_colorma #' @export setGeneric("interactivity", function(dashboard) standardGeneric("interactivity")) + +#' @export setGeneric("interactivity<-", function(dashboard, value) standardGeneric("interactivity<-")) + +#' @export +setGeneric("get_title", function(dashboard) standardGeneric("get_title")) + +#' @export +setGeneric("set_title", function(dashboard, value) standardGeneric("set_title")) + +#' @export +setGeneric("get_author", function(dashboard) standardGeneric("get_author")) + +#' @export +setGeneric("set_author", function(dashboard, value) standardGeneric("set_author")) + +#' @export +setGeneric("get_theme", function(dashboard) standardGeneric("get_theme")) + +#' @export +setGeneric("set_theme", function(dashboard, value) standardGeneric("set_theme")) + +#' @export +setGeneric("get_datadir", function(dashboard) standardGeneric("get_datadir")) + +#' @export +setGeneric("set_datadir", function(dashboard, value) standardGeneric("set_datadir")) \ No newline at end of file diff --git a/R/get_set.R b/R/get_set.R index 2a4ab7d..18618e8 100644 --- a/R/get_set.R +++ b/R/get_set.R @@ -13,3 +13,67 @@ setMethod("interactivity<-", "i2dashboard", function(dashboard, value) { dashboard@interactive <- value dashboard }) + +#' Get/set the title of the i2dashboard. +#' +#' @param dashboard A \linkS4class{i2dash::i2dashboard}. +#' @param value The value of the desired property. +#' +#' @name i2dashboard-class +#' @rdname i2dashboard-class +setMethod("get_title", "i2dashboard", function(dashboard) dashboard@title) + +#' @name i2dashboard-class +#' @rdname i2dashboard-class +setMethod("set_title", "i2dashboard", function(dashboard, value) { + dashboard@title <- value + dashboard +}) + +#' Get/set the author of the i2dashboard. +#' +#' @param dashboard A \linkS4class{i2dash::i2dashboard}. +#' @param value The value of the desired property. +#' +#' @name i2dashboard-class +#' @rdname i2dashboard-class +setMethod("get_author", "i2dashboard", function(dashboard) dashboard@author) + +#' @name i2dashboard-class +#' @rdname i2dashboard-class +setMethod("set_author", "i2dashboard", function(dashboard, value) { + dashboard@author <- value + dashboard +}) + +#' Get/set the theme of the i2dashboard. +#' +#' @param dashboard A \linkS4class{i2dash::i2dashboard}. +#' @param value The value of the desired property. +#' +#' @name i2dashboard-class +#' @rdname i2dashboard-class +setMethod("get_theme", "i2dashboard", function(dashboard) dashboard@theme) + +#' @name i2dashboard-class +#' @rdname i2dashboard-class +setMethod("set_theme", "i2dashboard", function(dashboard, value) { + dashboard@theme <- value + dashboard +}) + +#' Get/set the datadir of the i2dashboard. +#' +#' @param dashboard A \linkS4class{i2dash::i2dashboard}. +#' @param value The value of the desired property. +#' +#' @name i2dashboard-class +#' @rdname i2dashboard-class +setMethod("get_datadir", "i2dashboard", function(dashboard) dashboard@datadir) + +#' @name i2dashboard-class +#' @rdname i2dashboard-class +setMethod("set_datadir", "i2dashboard", function(dashboard, value) { + dashboard@datadir <- value + dashboard +}) diff --git a/man/i2dashboard-class.Rd b/man/i2dashboard-class.Rd index bf860c2..5b509bb 100644 --- a/man/i2dashboard-class.Rd +++ b/man/i2dashboard-class.Rd @@ -7,6 +7,22 @@ \S4method{interactivity}{i2dashboard}(dashboard) \S4method{interactivity}{i2dashboard}(dashboard) <- value + +\S4method{get_title}{i2dashboard}(dashboard) + +\S4method{set_title}{i2dashboard}(dashboard, value) + +\S4method{get_author}{i2dashboard}(dashboard) + +\S4method{set_author}{i2dashboard}(dashboard, value) + +\S4method{get_theme}{i2dashboard}(dashboard) + +\S4method{set_theme}{i2dashboard}(dashboard, value) + +\S4method{get_datadir}{i2dashboard}(dashboard) + +\S4method{set_datadir}{i2dashboard}(dashboard, value) } \arguments{ \item{dashboard}{A \linkS4class{i2dash::i2dashboard}.} @@ -15,4 +31,12 @@ } \description{ Get/set the interactivity of the i2dashboard. + +Get/set the title of the i2dashboard. + +Get/set the author of the i2dashboard. + +Get/set the theme of the i2dashboard. + +Get/set the datadir of the i2dashboard. } -- GitLab