From 10a7d766dc14779376f01b79baae3aacbe543bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 12:13:17 +0200 Subject: [PATCH 01/14] Update the documentation --- DESCRIPTION | 2 +- R/bpmnVisualization.R | 39 ++++++++++++++++++++++++++++------ R/funs.R | 6 +++--- man/bpmnVisualization-shiny.Rd | 17 +++++++++------ man/create_overlay.Rd | 2 +- man/display.Rd | 19 +++++++++++++++++ 6 files changed, 67 insertions(+), 18 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9b5a9dc..259bac8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,7 @@ URL: https://github.com/process-analytics/bpmn-visualization-R BugReports: https://github.com/process-analytics/bpmn-visualization-R/issues Encoding: UTF-8 LazyData: true -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.1 Imports: htmlwidgets, rlang, diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index 14752f3..4ff36b5 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -22,6 +22,22 @@ #' @param width The width used to display the widget #' @param height The height used to display the widget #' @param elementId The id of the HTML element to enclose the widget +#' +#' @returns A 'bpmnVisualization' htmlwidget that will intelligently print itself into HTML in a variety of contexts +#' including the R console, within R Markdown documents, and within Shiny output bindings. +#' +#' @examples +#' # Load the BPMN file +#' bpmn_file <- system.file("examples/Email_Voting.bpmn", package = "bpmnVisualization") +#' +#' # Display the BPMN diagram +#' display(bpmn_file) +#' +#' # Display the BPMN diagram with overlays +#' overlays <- list(create_overlay("bpmn_element_id_1", "42"), create_overlay("bpmn_element_id_2", "9")) +#' display(bpmn_file, overlays) +#' +#' @seealso {[create_overlay()]} #' #' @import htmlwidgets #' @import xml2 @@ -49,11 +65,9 @@ display <- function( ) } -#' Shiny bindings for bpmnVisualization -#' -#' Output and render functions for using bpmnVisualization within Shiny -#' applications and interactive Rmd documents. -#' +#' Shiny bindings for bpmnVisualization: +#' Helpers to create output functions for using 'bpmnVisualization' HTML widgets within Shiny applications and interactive Rmd documents. +#' #' @param outputId output variable to read from #' @param width,height Must be a valid CSS unit (like \code{'100\%'}, #' \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a @@ -62,8 +76,10 @@ display <- function( #' @param env The environment in which to evaluate \code{expr}. #' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This #' is useful if you want to save an expression in a variable. +#' +#' @returns An output or render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. #' -#' @name bpmnVisualization-shiny +#' @name bpmnVisualization-shiny-output #' #' @export bpmnVisualizationOutput <- function( @@ -80,7 +96,16 @@ bpmnVisualizationOutput <- function( ) } -#' @rdname bpmnVisualization-shiny +#' Shiny bindings for bpmnVisualization: +#' Helpers to create render functions for using 'bpmnVisualization' HTML widgets within Shiny applications and interactive Rmd documents. +#' +#' @param expr An expression that generates an 'bpmnVisualization' HTML widget (or a promise of an 'bpmnVisualization' HTML widget). +#' @param env The environment in which to evaluate expr. +#' @param quoted Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable. +#' +#' @returns An output or render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +#' +#' @rdname bpmnVisualization-shiny-render #' @export renderBpmnVisualization <- function( expr, diff --git a/R/funs.R b/R/funs.R index 4733647..32808c7 100644 --- a/R/funs.R +++ b/R/funs.R @@ -1,4 +1,4 @@ -#' create_overlay +#' Create an overlay #' #' An overlay can be added to existing elements in the diagram. #' See \code{overlays} argument in \code{\link{bpmnVisualization}} function. @@ -7,7 +7,7 @@ #' @param elementId The bpmn element id to which the overlay will be attached #' @param label HTML element to use as an overlay #' -#' @return An overlay object +#' @returns An overlay object #' #' @export create_overlay <- function(elementId, label) { @@ -21,7 +21,7 @@ create_overlay <- function(elementId, label) { #' Internal fun to build the htmlwidget content #' #' @inheritParams display -#' @return A list +#' @returns A list #' #' @noRd build_bpmnContent <- function( diff --git a/man/bpmnVisualization-shiny.Rd b/man/bpmnVisualization-shiny.Rd index d4046b0..0a07e34 100644 --- a/man/bpmnVisualization-shiny.Rd +++ b/man/bpmnVisualization-shiny.Rd @@ -17,14 +17,19 @@ renderBpmnVisualization(expr, env = parent.frame(), quoted = FALSE) \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a string and have \code{'px'} appended.} -\item{expr}{An expression that generates a bpmnVisualization} +\item{expr}{An expression that generates an 'bpmnVisualization' HTML widget (or a promise of an 'bpmnVisualization' HTML widget).} -\item{env}{The environment in which to evaluate \code{expr}.} +\item{env}{The environment in which to evaluate expr.} -\item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This -is useful if you want to save an expression in a variable.} +\item{quoted}{Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.} +} +\value{ +An output or render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. + +An output or render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. } \description{ -Output and render functions for using bpmnVisualization within Shiny -applications and interactive Rmd documents. +Helpers to create output functions for using 'bpmnVisualization' HTML widgets within Shiny applications and interactive Rmd documents. + +Helpers to create render functions for using 'bpmnVisualization' HTML widgets within Shiny applications and interactive Rmd documents. } diff --git a/man/create_overlay.Rd b/man/create_overlay.Rd index e1af9c2..f24d9d3 100644 --- a/man/create_overlay.Rd +++ b/man/create_overlay.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/bpmnVisualization.R +% Please edit documentation in R/funs.R \name{create_overlay} \alias{create_overlay} \title{create_overlay} diff --git a/man/display.Rd b/man/display.Rd index 9151eeb..2016f7e 100644 --- a/man/display.Rd +++ b/man/display.Rd @@ -24,6 +24,25 @@ Use overlay function to create an overlay object with content and relative posit \item{elementId}{The id of the HTML element to enclose the widget} } +\value{ +A 'bpmnVisualization' htmlwidget that will intelligently print itself into HTML in a variety of contexts + including the R console, within R Markdown documents, and within Shiny output bindings. +} \description{ Display BPMN diagram based on BPMN definition in XML format } +\examples{ +# Load the BPMN file +bpmn_file <- system.file("examples/Email_Voting.bpmn", package = "bpmnVisualization") + +# Display the BPMN diagram +display(bpmn_file) + +# Display the BPMN diagram with overlays +overlays <- list(create_overlay("bpmn_element_id_1", "42"), create_overlay("bpmn_element_id_2", "9")) +display(bpmn_file, overlays) + +} +\seealso{ +{[create_overlay()]} +} From 61108ee9ae719e2d3c99215fa40ca711b33a45ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 12:41:56 +0200 Subject: [PATCH 02/14] Update the documentation --- R/bpmnVisualization.R | 36 ++++++++++++++------------- R/funs.R | 7 +++++- man/bpmnVisualization-shiny-output.Rd | 22 ++++++++++++++++ man/bpmnVisualization-shiny-render.Rd | 22 ++++++++++++++++ man/bpmnVisualization-shiny.Rd | 35 -------------------------- man/create_overlay.Rd | 4 ++- man/display.Rd | 4 +-- 7 files changed, 74 insertions(+), 56 deletions(-) create mode 100644 man/bpmnVisualization-shiny-output.Rd create mode 100644 man/bpmnVisualization-shiny-render.Rd delete mode 100644 man/bpmnVisualization-shiny.Rd diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index 4ff36b5..e4b71d4 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -#' display -#' -#' Display BPMN diagram based on BPMN definition in XML format +#' @title Display BPMN diagram #' +#' @name display +#' @description Display BPMN diagram based on BPMN definition in XML format +#' #' @param bpmnXML A file name or xml document or string in BPMN XML format #' @param overlays An element or a list of elements to be added to the diagram's existing elements. #' Use overlay function to create an overlay object with content and relative position. @@ -37,7 +38,7 @@ #' overlays <- list(create_overlay("bpmn_element_id_1", "42"), create_overlay("bpmn_element_id_2", "9")) #' display(bpmn_file, overlays) #' -#' @seealso {[create_overlay()]} +#' @seealso [bpmnVisualization::create_overlay()] to create an overlay #' #' @import htmlwidgets #' @import xml2 @@ -65,19 +66,17 @@ display <- function( ) } -#' Shiny bindings for bpmnVisualization: -#' Helpers to create output functions for using 'bpmnVisualization' HTML widgets within Shiny applications and interactive Rmd documents. +#' @title Shiny output binding for 'bpmnVisualization' HTML widget +#' +#' @description +#' Helper to create output function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. #' #' @param outputId output variable to read from #' @param width,height Must be a valid CSS unit (like \code{'100\%'}, #' \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a #' string and have \code{'px'} appended. -#' @param expr An expression that generates a bpmnVisualization -#' @param env The environment in which to evaluate \code{expr}. -#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This -#' is useful if you want to save an expression in a variable. #' -#' @returns An output or render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +#' @returns An output function that enables the use of the 'bpmnVisualization' widget within Shiny applications. #' #' @name bpmnVisualization-shiny-output #' @@ -96,14 +95,17 @@ bpmnVisualizationOutput <- function( ) } -#' Shiny bindings for bpmnVisualization: -#' Helpers to create render functions for using 'bpmnVisualization' HTML widgets within Shiny applications and interactive Rmd documents. +#' @title Shiny render binding for 'bpmnVisualization' HTML widget #' -#' @param expr An expression that generates an 'bpmnVisualization' HTML widget (or a promise of an 'bpmnVisualization' HTML widget). -#' @param env The environment in which to evaluate expr. -#' @param quoted Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable. +#' @description +#' Helper to create render function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. #' -#' @returns An output or render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +#' @param expr An expression that generates a 'bpmnVisualization' HTML widget +#' @param env The environment in which to evaluate \code{expr}. +#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This +#' is useful if you want to save an expression in a variable. +#' +#' @returns A render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. #' #' @rdname bpmnVisualization-shiny-render #' @export diff --git a/R/funs.R b/R/funs.R index 32808c7..ffb456a 100644 --- a/R/funs.R +++ b/R/funs.R @@ -1,9 +1,14 @@ -#' Create an overlay +#' @title Create an overlay #' +#' @description #' An overlay can be added to existing elements in the diagram. +#' #' See \code{overlays} argument in \code{\link{bpmnVisualization}} function. +#' #' Use this structure to create correct overlay structure. #' +#' @name create_overlay +#' #' @param elementId The bpmn element id to which the overlay will be attached #' @param label HTML element to use as an overlay #' diff --git a/man/bpmnVisualization-shiny-output.Rd b/man/bpmnVisualization-shiny-output.Rd new file mode 100644 index 0000000..c16f586 --- /dev/null +++ b/man/bpmnVisualization-shiny-output.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bpmnVisualization.R +\name{bpmnVisualization-shiny-output} +\alias{bpmnVisualization-shiny-output} +\alias{bpmnVisualizationOutput} +\title{Shiny output binding for 'bpmnVisualization' HTML widget} +\usage{ +bpmnVisualizationOutput(outputId, width = "100\%", height = "400px") +} +\arguments{ +\item{outputId}{output variable to read from} + +\item{width, height}{Must be a valid CSS unit (like \code{'100\%'}, +\code{'400px'}, \code{'auto'}) or a number, which will be coerced to a +string and have \code{'px'} appended.} +} +\value{ +An output function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +} +\description{ +Helper to create output function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. +} diff --git a/man/bpmnVisualization-shiny-render.Rd b/man/bpmnVisualization-shiny-render.Rd new file mode 100644 index 0000000..e45685a --- /dev/null +++ b/man/bpmnVisualization-shiny-render.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bpmnVisualization.R +\name{renderBpmnVisualization} +\alias{renderBpmnVisualization} +\title{Shiny render binding for 'bpmnVisualization' HTML widget} +\usage{ +renderBpmnVisualization(expr, env = parent.frame(), quoted = FALSE) +} +\arguments{ +\item{expr}{An expression that generates a 'bpmnVisualization' HTML widget} + +\item{env}{The environment in which to evaluate \code{expr}.} + +\item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This +is useful if you want to save an expression in a variable.} +} +\value{ +A render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +} +\description{ +Helper to create render function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. +} diff --git a/man/bpmnVisualization-shiny.Rd b/man/bpmnVisualization-shiny.Rd deleted file mode 100644 index 0a07e34..0000000 --- a/man/bpmnVisualization-shiny.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/bpmnVisualization.R -\name{bpmnVisualization-shiny} -\alias{bpmnVisualization-shiny} -\alias{bpmnVisualizationOutput} -\alias{renderBpmnVisualization} -\title{Shiny bindings for bpmnVisualization} -\usage{ -bpmnVisualizationOutput(outputId, width = "100\%", height = "400px") - -renderBpmnVisualization(expr, env = parent.frame(), quoted = FALSE) -} -\arguments{ -\item{outputId}{output variable to read from} - -\item{width, height}{Must be a valid CSS unit (like \code{'100\%'}, -\code{'400px'}, \code{'auto'}) or a number, which will be coerced to a -string and have \code{'px'} appended.} - -\item{expr}{An expression that generates an 'bpmnVisualization' HTML widget (or a promise of an 'bpmnVisualization' HTML widget).} - -\item{env}{The environment in which to evaluate expr.} - -\item{quoted}{Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.} -} -\value{ -An output or render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. - -An output or render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. -} -\description{ -Helpers to create output functions for using 'bpmnVisualization' HTML widgets within Shiny applications and interactive Rmd documents. - -Helpers to create render functions for using 'bpmnVisualization' HTML widgets within Shiny applications and interactive Rmd documents. -} diff --git a/man/create_overlay.Rd b/man/create_overlay.Rd index f24d9d3..c79340a 100644 --- a/man/create_overlay.Rd +++ b/man/create_overlay.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/funs.R \name{create_overlay} \alias{create_overlay} -\title{create_overlay} +\title{Create an overlay} \usage{ create_overlay(elementId, label) } @@ -16,6 +16,8 @@ An overlay object } \description{ An overlay can be added to existing elements in the diagram. + See \code{overlays} argument in \code{\link{bpmnVisualization}} function. + Use this structure to create correct overlay structure. } diff --git a/man/display.Rd b/man/display.Rd index 2016f7e..8e7ffa2 100644 --- a/man/display.Rd +++ b/man/display.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/bpmnVisualization.R \name{display} \alias{display} -\title{display} +\title{Display BPMN diagram} \usage{ display( bpmnXML, @@ -44,5 +44,5 @@ display(bpmn_file, overlays) } \seealso{ -{[create_overlay()]} +[bpmnVisualization::create_overlay()] to create an overlay } From b0ce3e6dd5516e4412b93d2b4dfa0e6136cd98d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 15:11:02 +0200 Subject: [PATCH 03/14] @seealso link in display function works in html page, but not in studio preview --- R/bpmnVisualization.R | 9 ++++----- R/funs.R | 5 ++--- man/display.Rd | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index e4b71d4..4bf284a 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -38,7 +38,7 @@ #' overlays <- list(create_overlay("bpmn_element_id_1", "42"), create_overlay("bpmn_element_id_2", "9")) #' display(bpmn_file, overlays) #' -#' @seealso [bpmnVisualization::create_overlay()] to create an overlay +#' @seealso \code{\link{create_overlay}} to create an overlay #' #' @import htmlwidgets #' @import xml2 @@ -67,7 +67,8 @@ display <- function( } #' @title Shiny output binding for 'bpmnVisualization' HTML widget -#' +#' +#' @name bpmnVisualization-shiny-output #' @description #' Helper to create output function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. #' @@ -78,8 +79,6 @@ display <- function( #' #' @returns An output function that enables the use of the 'bpmnVisualization' widget within Shiny applications. #' -#' @name bpmnVisualization-shiny-output -#' #' @export bpmnVisualizationOutput <- function( outputId, @@ -97,6 +96,7 @@ bpmnVisualizationOutput <- function( #' @title Shiny render binding for 'bpmnVisualization' HTML widget #' +#' @rdname bpmnVisualization-shiny-render #' @description #' Helper to create render function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. #' @@ -107,7 +107,6 @@ bpmnVisualizationOutput <- function( #' #' @returns A render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. #' -#' @rdname bpmnVisualization-shiny-render #' @export renderBpmnVisualization <- function( expr, diff --git a/R/funs.R b/R/funs.R index ffb456a..46dffc6 100644 --- a/R/funs.R +++ b/R/funs.R @@ -1,13 +1,12 @@ #' @title Create an overlay #' +#' @name create_overlay #' @description #' An overlay can be added to existing elements in the diagram. #' #' See \code{overlays} argument in \code{\link{bpmnVisualization}} function. #' #' Use this structure to create correct overlay structure. -#' -#' @name create_overlay #' #' @param elementId The bpmn element id to which the overlay will be attached #' @param label HTML element to use as an overlay @@ -23,7 +22,7 @@ create_overlay <- function(elementId, label) { ) } -#' Internal fun to build the htmlwidget content +#' @description Internal fun to build the htmlwidget content #' #' @inheritParams display #' @returns A list diff --git a/man/display.Rd b/man/display.Rd index 8e7ffa2..a70daeb 100644 --- a/man/display.Rd +++ b/man/display.Rd @@ -44,5 +44,5 @@ display(bpmn_file, overlays) } \seealso{ -[bpmnVisualization::create_overlay()] to create an overlay +\code{\link{create_overlay}} to create an overlay } From 31492f48cc9b52df863d40997a852a18abc1748f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 16:38:34 +0200 Subject: [PATCH 04/14] Add new bpmn file --- README.md | 1 + inst/examples/Order_Management.bpmn | 189 ++++++++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 inst/examples/Order_Management.bpmn diff --git a/README.md b/README.md index 6e02a7b..2c00c13 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ bpmn_file <- " ...xml_content" They are taken from the [BPMN 2.0 examples non-normative machine readable files](https://www.omg.org/spec/BPMN/2.0). - Email_Voting.bpmn - Nobel_Prize_Process.bpmn +- Order_Management.bpmn - Order_Process_for_Pizza_V4.bpmn - Travel_Booking.bpmn diff --git a/inst/examples/Order_Management.bpmn b/inst/examples/Order_Management.bpmn new file mode 100644 index 0000000..81166b3 --- /dev/null +++ b/inst/examples/Order_Management.bpmn @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 4f8c9b35837bf1745e461e5708513ab4009dc5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 16:39:14 +0200 Subject: [PATCH 05/14] Replace the BPMN file used in the doc example and add overlays --- R/bpmnVisualization.R | 4 ++-- man/display.Rd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index 4bf284a..a20fcd1 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -29,13 +29,13 @@ #' #' @examples #' # Load the BPMN file -#' bpmn_file <- system.file("examples/Email_Voting.bpmn", package = "bpmnVisualization") +#' bpmn_file <- system.file("examples/Order_Management.bpmn", package = "bpmnVisualization") #' #' # Display the BPMN diagram #' display(bpmn_file) #' #' # Display the BPMN diagram with overlays -#' overlays <- list(create_overlay("bpmn_element_id_1", "42"), create_overlay("bpmn_element_id_2", "9")) +#' overlays <- list(create_overlay("start_event_1_1", "42"), create_overlay("sequence_flow_1_1", "42"), create_overlay("task_1_1", "9")) #' display(bpmn_file, overlays) #' #' @seealso \code{\link{create_overlay}} to create an overlay diff --git a/man/display.Rd b/man/display.Rd index a70daeb..8c0a7cd 100644 --- a/man/display.Rd +++ b/man/display.Rd @@ -33,13 +33,13 @@ Display BPMN diagram based on BPMN definition in XML format } \examples{ # Load the BPMN file -bpmn_file <- system.file("examples/Email_Voting.bpmn", package = "bpmnVisualization") +bpmn_file <- system.file("examples/Order_Management.bpmn", package = "bpmnVisualization") # Display the BPMN diagram display(bpmn_file) # Display the BPMN diagram with overlays -overlays <- list(create_overlay("bpmn_element_id_1", "42"), create_overlay("bpmn_element_id_2", "9")) +overlays <- list(create_overlay("start_event_1_1", "42"), create_overlay("sequence_flow_1_1", "42"), create_overlay("task_1_1", "9")) display(bpmn_file, overlays) } From 672813a77cb4e902d1d49682ca229c3e53aa6033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 16:44:24 +0200 Subject: [PATCH 06/14] Fix ids --- inst/examples/Order_Management.bpmn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inst/examples/Order_Management.bpmn b/inst/examples/Order_Management.bpmn index 81166b3..8c748fb 100644 --- a/inst/examples/Order_Management.bpmn +++ b/inst/examples/Order_Management.bpmn @@ -16,7 +16,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -149,7 +149,7 @@ - + From 3041a4a33a6edf8d0b1bf87c38968ee16add8171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 16:52:33 +0200 Subject: [PATCH 07/14] Update coordinates --- inst/examples/Order_Management.bpmn | 227 ++++++++++++++-------------- 1 file changed, 114 insertions(+), 113 deletions(-) diff --git a/inst/examples/Order_Management.bpmn b/inst/examples/Order_Management.bpmn index 8c748fb..fcfbce1 100644 --- a/inst/examples/Order_Management.bpmn +++ b/inst/examples/Order_Management.bpmn @@ -1,189 +1,190 @@ - - + - + xmlns:semantic="http://www.omg.org/spec/BPMN/20100524/MODEL" + targetNamespace="http://www.trisotech.com/definitions/_1275486058980"> + - - - - - + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + - + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + + - - - - + + + - - - - + + + - - - - - + + + + + + - - - - + + + + - - - + + + + - - - + + + + - - - - + + + + - - - - + + + + - - - + + + + - - - - + + + - - + + - - + + - - + + - - + + - - - - + + + + - - - - + + + + - - - + + + - From 6ed32fbeef0bfbc56420c8622d8e033a9821497f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 16:57:52 +0200 Subject: [PATCH 08/14] Auto size the widget in the doc --- R/bpmnVisualization.R | 4 ++-- man/display.Rd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index a20fcd1..5e2714e 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -32,11 +32,11 @@ #' bpmn_file <- system.file("examples/Order_Management.bpmn", package = "bpmnVisualization") #' #' # Display the BPMN diagram -#' display(bpmn_file) +#' display(bpmn_file, width='auto', height='auto') #' #' # Display the BPMN diagram with overlays #' overlays <- list(create_overlay("start_event_1_1", "42"), create_overlay("sequence_flow_1_1", "42"), create_overlay("task_1_1", "9")) -#' display(bpmn_file, overlays) +#' display(bpmn_file, overlays, width='auto', height='auto') #' #' @seealso \code{\link{create_overlay}} to create an overlay #' diff --git a/man/display.Rd b/man/display.Rd index 8c0a7cd..f484124 100644 --- a/man/display.Rd +++ b/man/display.Rd @@ -36,11 +36,11 @@ Display BPMN diagram based on BPMN definition in XML format bpmn_file <- system.file("examples/Order_Management.bpmn", package = "bpmnVisualization") # Display the BPMN diagram -display(bpmn_file) +display(bpmn_file, width='auto', height='auto') # Display the BPMN diagram with overlays overlays <- list(create_overlay("start_event_1_1", "42"), create_overlay("sequence_flow_1_1", "42"), create_overlay("task_1_1", "9")) -display(bpmn_file, overlays) +display(bpmn_file, overlays, width='auto', height='auto') } \seealso{ From 98fe5a6db3777b0a0c93242b7412a59bf7ca2014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 17:09:26 +0200 Subject: [PATCH 09/14] Increase the size of the sequence flows --- inst/examples/Order_Management.bpmn | 82 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/inst/examples/Order_Management.bpmn b/inst/examples/Order_Management.bpmn index fcfbce1..dd127e1 100644 --- a/inst/examples/Order_Management.bpmn +++ b/inst/examples/Order_Management.bpmn @@ -1,8 +1,7 @@ + xmlns:semantic="http://www.omg.org/spec/BPMN/20100524/MODEL" targetNamespace="http://www.trisotech.com/definitions/_1275486058980"> @@ -41,111 +40,108 @@ - + - + - + - + - + - + - + - + - + - + - + - - - + + - - + + - - + + - - + + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - - + + - - + + From 98b22e0c77a94877b57dd5cf6f2e550881a369c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Wed, 26 Oct 2022 17:17:20 +0200 Subject: [PATCH 10/14] Improve the documentation by returning to the line in the example --- R/bpmnVisualization.R | 6 +++++- man/display.Rd | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index 5e2714e..debd8d9 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -35,7 +35,11 @@ #' display(bpmn_file, width='auto', height='auto') #' #' # Display the BPMN diagram with overlays -#' overlays <- list(create_overlay("start_event_1_1", "42"), create_overlay("sequence_flow_1_1", "42"), create_overlay("task_1_1", "9")) +#' overlays <- list( +#' create_overlay("start_event_1_1", "42"), +#' create_overlay("sequence_flow_1_1", "42"), +#' create_overlay("task_1_1", "9") +#' ) #' display(bpmn_file, overlays, width='auto', height='auto') #' #' @seealso \code{\link{create_overlay}} to create an overlay diff --git a/man/display.Rd b/man/display.Rd index f484124..5362e93 100644 --- a/man/display.Rd +++ b/man/display.Rd @@ -39,7 +39,11 @@ bpmn_file <- system.file("examples/Order_Management.bpmn", package = "bpmnVisual display(bpmn_file, width='auto', height='auto') # Display the BPMN diagram with overlays -overlays <- list(create_overlay("start_event_1_1", "42"), create_overlay("sequence_flow_1_1", "42"), create_overlay("task_1_1", "9")) +overlays <- list( + create_overlay("start_event_1_1", "42"), + create_overlay("sequence_flow_1_1", "42"), + create_overlay("task_1_1", "9") +) display(bpmn_file, overlays, width='auto', height='auto') } From 9b22a57bb45c8ad23936ee72bc2fa340cfd532b9 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Wed, 26 Oct 2022 17:22:22 +0200 Subject: [PATCH 11/14] improve api doc for the 'display' function --- R/bpmnVisualization.R | 17 ++++++++++------- man/display.Rd | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index debd8d9..27f7639 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -#' @title Display BPMN diagram +#' @title Display BPMN diagram in an HTML Widget #' #' @name display #' @description Display BPMN diagram based on BPMN definition in XML format @@ -20,11 +20,14 @@ #' @param bpmnXML A file name or xml document or string in BPMN XML format #' @param overlays An element or a list of elements to be added to the diagram's existing elements. #' Use overlay function to create an overlay object with content and relative position. -#' @param width The width used to display the widget -#' @param height The height used to display the widget -#' @param elementId The id of the HTML element to enclose the widget +#' @param width Fixed width for widget (in css units). The default is \code{NULL}, which results in intelligent automatic sizing based on the widget's container. +#' @param height Fixed height for widget (in css units). The default is \code{NULL}, which results in intelligent automatic sizing based on the widget's container. +#' @param elementId The id of the HTML element to enclose the widget. +#' Use an explicit element ID for the widget (rather than an automatically +#' generated one). Useful if you have other JavaScript that needs to explicitly +#' discover and interact with a specific widget instance. #' -#' @returns A 'bpmnVisualization' htmlwidget that will intelligently print itself into HTML in a variety of contexts +#' @returns A \code{bpmnVisualization} Widget that will intelligently print itself into HTML in a variety of contexts #' including the R console, within R Markdown documents, and within Shiny output bindings. #' #' @examples @@ -36,8 +39,8 @@ #' #' # Display the BPMN diagram with overlays #' overlays <- list( -#' create_overlay("start_event_1_1", "42"), -#' create_overlay("sequence_flow_1_1", "42"), +#' create_overlay("start_event_1_1", "42"), +#' create_overlay("sequence_flow_1_1", "42"), #' create_overlay("task_1_1", "9") #' ) #' display(bpmn_file, overlays, width='auto', height='auto') diff --git a/man/display.Rd b/man/display.Rd index 5362e93..ab43ebe 100644 --- a/man/display.Rd +++ b/man/display.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/bpmnVisualization.R \name{display} \alias{display} -\title{Display BPMN diagram} +\title{Display BPMN diagram in an HTML Widget} \usage{ display( bpmnXML, @@ -18,14 +18,17 @@ display( \item{overlays}{An element or a list of elements to be added to the diagram's existing elements. Use overlay function to create an overlay object with content and relative position.} -\item{width}{The width used to display the widget} +\item{width}{Fixed width for widget (in css units). The default is \code{NULL}, which results in intelligent automatic sizing based on the widget's container.} -\item{height}{The height used to display the widget} +\item{height}{Fixed height for widget (in css units). The default is \code{NULL}, which results in intelligent automatic sizing based on the widget's container.} -\item{elementId}{The id of the HTML element to enclose the widget} +\item{elementId}{The id of the HTML element to enclose the widget. +Use an explicit element ID for the widget (rather than an automatically +generated one). Useful if you have other JavaScript that needs to explicitly +discover and interact with a specific widget instance.} } \value{ -A 'bpmnVisualization' htmlwidget that will intelligently print itself into HTML in a variety of contexts +A \code{bpmnVisualization} Widget that will intelligently print itself into HTML in a variety of contexts including the R console, within R Markdown documents, and within Shiny output bindings. } \description{ @@ -40,8 +43,8 @@ display(bpmn_file, width='auto', height='auto') # Display the BPMN diagram with overlays overlays <- list( - create_overlay("start_event_1_1", "42"), - create_overlay("sequence_flow_1_1", "42"), + create_overlay("start_event_1_1", "42"), + create_overlay("sequence_flow_1_1", "42"), create_overlay("task_1_1", "9") ) display(bpmn_file, overlays, width='auto', height='auto') From 484d9226ed22715c79d91045bed01ed1d17d1b68 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Thu, 27 Oct 2022 10:13:17 +0200 Subject: [PATCH 12/14] improve api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Souchet Céline <4921914+csouchet@users.noreply.github.com> --- R/bpmnVisualization.R | 14 +++++++------- R/funs.R | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index 27f7639..847a165 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -27,7 +27,7 @@ #' generated one). Useful if you have other JavaScript that needs to explicitly #' discover and interact with a specific widget instance. #' -#' @returns A \code{bpmnVisualization} Widget that will intelligently print itself into HTML in a variety of contexts +#' @returns A \code{bpmn-visualization} Widget that will intelligently print itself into HTML in a variety of contexts #' including the R console, within R Markdown documents, and within Shiny output bindings. #' #' @examples @@ -77,14 +77,14 @@ display <- function( #' #' @name bpmnVisualization-shiny-output #' @description -#' Helper to create output function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. +#' Helper to create output function for using the \code{bpmn-visualization} HTML widget within Shiny applications and interactive Rmd documents. #' #' @param outputId output variable to read from #' @param width,height Must be a valid CSS unit (like \code{'100\%'}, #' \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a #' string and have \code{'px'} appended. #' -#' @returns An output function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +#' @returns An output function that enables the use of the \code{bpmn-visualization} widget within Shiny applications. #' #' @export bpmnVisualizationOutput <- function( @@ -101,18 +101,18 @@ bpmnVisualizationOutput <- function( ) } -#' @title Shiny render binding for 'bpmnVisualization' HTML widget +#' @title Shiny render binding for the \code{bpmn-visualization} HTML widget #' #' @rdname bpmnVisualization-shiny-render #' @description -#' Helper to create render function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. +#' Helper to create render function for using the \code{bpmn-visualization} HTML widget within Shiny applications and interactive Rmd documents. #' -#' @param expr An expression that generates a 'bpmnVisualization' HTML widget +#' @param expr An expression that generates a \code{bpmn-visualization} HTML widget #' @param env The environment in which to evaluate \code{expr}. #' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This #' is useful if you want to save an expression in a variable. #' -#' @returns A render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +#' @returns A render function that enables the use of the \code{bpmn-visualization} widget within Shiny applications. #' #' @export renderBpmnVisualization <- function( diff --git a/R/funs.R b/R/funs.R index 46dffc6..eef7b07 100644 --- a/R/funs.R +++ b/R/funs.R @@ -4,7 +4,7 @@ #' @description #' An overlay can be added to existing elements in the diagram. #' -#' See \code{overlays} argument in \code{\link{bpmnVisualization}} function. +#' See \code{overlays} argument in the \code{\link{display}} function. #' #' Use this structure to create correct overlay structure. #' From 89cd9fe1fa899a0fc05202143374fe57de83cebd Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Thu, 27 Oct 2022 10:14:56 +0200 Subject: [PATCH 13/14] improve wording in docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Souchet Céline <4921914+csouchet@users.noreply.github.com> --- R/bpmnVisualization.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/bpmnVisualization.R b/R/bpmnVisualization.R index 847a165..b90a96b 100644 --- a/R/bpmnVisualization.R +++ b/R/bpmnVisualization.R @@ -73,7 +73,7 @@ display <- function( ) } -#' @title Shiny output binding for 'bpmnVisualization' HTML widget +#' @title Shiny output binding for the \code{bpmn-visualization} HTML widget #' #' @name bpmnVisualization-shiny-output #' @description From 6ca2916bf4a27401a50195aea4eed1d184520960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Thu, 27 Oct 2022 10:51:59 +0200 Subject: [PATCH 14/14] Generate the new doc --- man/bpmnVisualization-shiny-output.Rd | 6 +++--- man/bpmnVisualization-shiny-render.Rd | 8 ++++---- man/create_overlay.Rd | 2 +- man/display.Rd | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/man/bpmnVisualization-shiny-output.Rd b/man/bpmnVisualization-shiny-output.Rd index c16f586..165a95e 100644 --- a/man/bpmnVisualization-shiny-output.Rd +++ b/man/bpmnVisualization-shiny-output.Rd @@ -3,7 +3,7 @@ \name{bpmnVisualization-shiny-output} \alias{bpmnVisualization-shiny-output} \alias{bpmnVisualizationOutput} -\title{Shiny output binding for 'bpmnVisualization' HTML widget} +\title{Shiny output binding for the \code{bpmn-visualization} HTML widget} \usage{ bpmnVisualizationOutput(outputId, width = "100\%", height = "400px") } @@ -15,8 +15,8 @@ bpmnVisualizationOutput(outputId, width = "100\%", height = "400px") string and have \code{'px'} appended.} } \value{ -An output function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +An output function that enables the use of the \code{bpmn-visualization} widget within Shiny applications. } \description{ -Helper to create output function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. +Helper to create output function for using the \code{bpmn-visualization} HTML widget within Shiny applications and interactive Rmd documents. } diff --git a/man/bpmnVisualization-shiny-render.Rd b/man/bpmnVisualization-shiny-render.Rd index e45685a..b12c77e 100644 --- a/man/bpmnVisualization-shiny-render.Rd +++ b/man/bpmnVisualization-shiny-render.Rd @@ -2,12 +2,12 @@ % Please edit documentation in R/bpmnVisualization.R \name{renderBpmnVisualization} \alias{renderBpmnVisualization} -\title{Shiny render binding for 'bpmnVisualization' HTML widget} +\title{Shiny render binding for the \code{bpmn-visualization} HTML widget} \usage{ renderBpmnVisualization(expr, env = parent.frame(), quoted = FALSE) } \arguments{ -\item{expr}{An expression that generates a 'bpmnVisualization' HTML widget} +\item{expr}{An expression that generates a \code{bpmn-visualization} HTML widget} \item{env}{The environment in which to evaluate \code{expr}.} @@ -15,8 +15,8 @@ renderBpmnVisualization(expr, env = parent.frame(), quoted = FALSE) is useful if you want to save an expression in a variable.} } \value{ -A render function that enables the use of the 'bpmnVisualization' widget within Shiny applications. +A render function that enables the use of the \code{bpmn-visualization} widget within Shiny applications. } \description{ -Helper to create render function for using 'bpmnVisualization' HTML widget within Shiny applications and interactive Rmd documents. +Helper to create render function for using the \code{bpmn-visualization} HTML widget within Shiny applications and interactive Rmd documents. } diff --git a/man/create_overlay.Rd b/man/create_overlay.Rd index c79340a..ec6c45f 100644 --- a/man/create_overlay.Rd +++ b/man/create_overlay.Rd @@ -17,7 +17,7 @@ An overlay object \description{ An overlay can be added to existing elements in the diagram. -See \code{overlays} argument in \code{\link{bpmnVisualization}} function. +See \code{overlays} argument in the \code{\link{display}} function. Use this structure to create correct overlay structure. } diff --git a/man/display.Rd b/man/display.Rd index ab43ebe..88c4d1e 100644 --- a/man/display.Rd +++ b/man/display.Rd @@ -28,7 +28,7 @@ generated one). Useful if you have other JavaScript that needs to explicitly discover and interact with a specific widget instance.} } \value{ -A \code{bpmnVisualization} Widget that will intelligently print itself into HTML in a variety of contexts +A \code{bpmn-visualization} Widget that will intelligently print itself into HTML in a variety of contexts including the R console, within R Markdown documents, and within Shiny output bindings. } \description{