From 833b1f96438692cc506e2aeec3d79cf8cb4174cf Mon Sep 17 00:00:00 2001 From: Tim Chamberlain Date: Tue, 27 Sep 2022 14:14:36 -0500 Subject: [PATCH] SPRINT-12: added 'multi statitistics' widget --- .../widgets/MultiStatisticsData.java | 470 ++++++++++++++++++ .../core/model/dashboard/widgets/RawHTML.java | 22 +- .../model/dashboard/widgets/TableData.java | 55 +- 3 files changed, 516 insertions(+), 31 deletions(-) create mode 100644 qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/MultiStatisticsData.java diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/MultiStatisticsData.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/MultiStatisticsData.java new file mode 100644 index 00000000..a462a8fd --- /dev/null +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/MultiStatisticsData.java @@ -0,0 +1,470 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2022. Kingsrook, LLC + * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States + * contact@kingsrook.com + * https://github.com/Kingsrook/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.kingsrook.qqq.backend.core.model.dashboard.widgets; + + +import java.util.List; + + +/******************************************************************************* + ** Model containing datastructure expected by frontend bar chart widget + ** + *******************************************************************************/ +public class MultiStatisticsData implements QWidget +{ + private String title; + private List statisticsGroupData; + + + + /******************************************************************************* + ** + *******************************************************************************/ + public MultiStatisticsData() + { + } + + + + /******************************************************************************* + ** + *******************************************************************************/ + public MultiStatisticsData(String title, List statisticsGroupData) + { + this.title = title; + this.statisticsGroupData = statisticsGroupData; + } + + + + /******************************************************************************* + ** Getter for type + ** + *******************************************************************************/ + public String getType() + { + return "multiStatistics"; + } + + + + /******************************************************************************* + ** Getter for title + ** + *******************************************************************************/ + public String getTitle() + { + return title; + } + + + + /******************************************************************************* + ** Setter for title + ** + *******************************************************************************/ + public void setTitle(String title) + { + this.title = title; + } + + + + /******************************************************************************* + ** Fluent setter for title + ** + *******************************************************************************/ + public MultiStatisticsData withTitle(String title) + { + this.title = title; + return (this); + } + + + + /******************************************************************************* + ** Getter for statisticsGroupData + ** + *******************************************************************************/ + public List getStatisticsGroupData() + { + return statisticsGroupData; + } + + + + /******************************************************************************* + ** Setter for statisticsGroupData + ** + *******************************************************************************/ + public void setStatisticsGroupData(List statisticsGroupData) + { + this.statisticsGroupData = statisticsGroupData; + } + + + + /******************************************************************************* + ** Fluent setter for statisticsGroupData + ** + *******************************************************************************/ + public MultiStatisticsData withStatisticsGroupData(List statisticsGroupData) + { + this.statisticsGroupData = statisticsGroupData; + return (this); + } + + + + /******************************************************************************* + ** + *******************************************************************************/ + public static class StatisticsGroupData + { + private String icon; + private String iconColor; + private String header; + private String subheader; + List statisticList; + + + + /******************************************************************************* + ** + *******************************************************************************/ + public StatisticsGroupData() + { + } + + + + /******************************************************************************* + ** + *******************************************************************************/ + public StatisticsGroupData(String icon, String iconColor, String header, String subheader, List statisticList) + { + this.icon = icon; + this.iconColor = iconColor; + this.header = header; + this.subheader = subheader; + this.statisticList = statisticList; + } + + + + /******************************************************************************* + ** Getter for header + ** + *******************************************************************************/ + public String getHeader() + { + return header; + } + + + + /******************************************************************************* + ** Setter for header + ** + *******************************************************************************/ + public void setHeader(String header) + { + this.header = header; + } + + + + /******************************************************************************* + ** Fluent setter for header + ** + *******************************************************************************/ + public StatisticsGroupData withHeader(String header) + { + this.header = header; + return (this); + } + + + + /******************************************************************************* + ** Getter for subheader + ** + *******************************************************************************/ + public String getSubheader() + { + return subheader; + } + + + + /******************************************************************************* + ** Setter for subheader + ** + *******************************************************************************/ + public void setSubheader(String subheader) + { + this.subheader = subheader; + } + + + + /******************************************************************************* + ** Fluent setter for subheader + ** + *******************************************************************************/ + public StatisticsGroupData withSubheader(String subheader) + { + this.subheader = subheader; + return (this); + } + + + + /******************************************************************************* + ** Getter for statisticList + ** + *******************************************************************************/ + public List getStatisticList() + { + return statisticList; + } + + + + /******************************************************************************* + ** Setter for statisticList + ** + *******************************************************************************/ + public void setStatisticList(List statisticList) + { + this.statisticList = statisticList; + } + + + + /******************************************************************************* + ** Fluent setter for statisticList + ** + *******************************************************************************/ + public StatisticsGroupData withStatisticList(List statisticList) + { + this.statisticList = statisticList; + return (this); + } + + + + /******************************************************************************* + ** Getter for icon + ** + *******************************************************************************/ + public String getIcon() + { + return icon; + } + + + + /******************************************************************************* + ** Setter for icon + ** + *******************************************************************************/ + public void setIcon(String icon) + { + this.icon = icon; + } + + + + /******************************************************************************* + ** Fluent setter for icon + ** + *******************************************************************************/ + public StatisticsGroupData withIcon(String icon) + { + this.icon = icon; + return (this); + } + + + + /******************************************************************************* + ** Getter for iconColor + ** + *******************************************************************************/ + public String getIconColor() + { + return iconColor; + } + + + + /******************************************************************************* + ** Setter for iconColor + ** + *******************************************************************************/ + public void setIconColor(String iconColor) + { + this.iconColor = iconColor; + } + + + + /******************************************************************************* + ** Fluent setter for iconColor + ** + *******************************************************************************/ + public StatisticsGroupData withIconColor(String iconColor) + { + this.iconColor = iconColor; + return (this); + } + + + + /******************************************************************************* + ** + *******************************************************************************/ + public static class Statistic + { + private String label; + private Integer value; + private String url; + + + + /******************************************************************************* + ** + *******************************************************************************/ + public Statistic(String label, Integer value, String url) + { + this.label = label; + this.value = value; + this.url = url; + } + + + + /******************************************************************************* + ** Getter for label + ** + *******************************************************************************/ + public String getLabel() + { + return label; + } + + + + /******************************************************************************* + ** Setter for label + ** + *******************************************************************************/ + public void setLabel(String label) + { + this.label = label; + } + + + + /******************************************************************************* + ** Fluent setter for label + ** + *******************************************************************************/ + public Statistic withLabel(String label) + { + this.label = label; + return (this); + } + + + + /******************************************************************************* + ** Getter for value + ** + *******************************************************************************/ + public Integer getValue() + { + return value; + } + + + + /******************************************************************************* + ** Setter for value + ** + *******************************************************************************/ + public void setValue(Integer value) + { + this.value = value; + } + + + + /******************************************************************************* + ** Fluent setter for value + ** + *******************************************************************************/ + public Statistic withValue(Integer value) + { + this.value = value; + return (this); + } + + + + /******************************************************************************* + ** Getter for url + ** + *******************************************************************************/ + public String getUrl() + { + return url; + } + + + + /******************************************************************************* + ** Setter for url + ** + *******************************************************************************/ + public void setUrl(String url) + { + this.url = url; + } + + + + /******************************************************************************* + ** Fluent setter for url + ** + *******************************************************************************/ + public Statistic withUrl(String url) + { + this.url = url; + return (this); + } + + } + + } +} diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/RawHTML.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/RawHTML.java index f78b8bbc..d9500184 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/RawHTML.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/RawHTML.java @@ -53,6 +53,17 @@ public class RawHTML implements QWidget + /******************************************************************************* + ** Getter for type + ** + *******************************************************************************/ + public String getType() + { + return "html"; + } + + + /******************************************************************************* ** Getter for title ** @@ -87,17 +98,6 @@ public class RawHTML implements QWidget - /******************************************************************************* - ** Getter for type - ** - *******************************************************************************/ - public String getType() - { - return "html"; - } - - - /******************************************************************************* ** Getter for html ** diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/TableData.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/TableData.java index 22fe0ad8..aa4fdf3b 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/TableData.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/TableData.java @@ -32,27 +32,8 @@ import java.util.Map; *******************************************************************************/ public class TableData implements QWidget { - /* - const carrierSpendData = { - columns: [ - {Header: "carrier", accessor: "product", width: "55%"}, - {Header: "total YTD", accessor: "value"}, - {Header: "monthly average", accessor: "adsSpent", align: "center"}, - {Header: "service failures", accessor: "refunds", align: "center"}, - ], - - rows: [ - { - product: , - value: $140,925, - adsSpent: $24,531, - refunds: , - }, - ] - } - */ - private String title; + private String noRowsFoundHTML; private List columns; private List> rows; private List> dropdownOptions; @@ -219,6 +200,40 @@ public class TableData implements QWidget + /******************************************************************************* + ** Getter for noRowsFoundHTML + ** + *******************************************************************************/ + public String getNoRowsFoundHTML() + { + return noRowsFoundHTML; + } + + + + /******************************************************************************* + ** Setter for noRowsFoundHTML + ** + *******************************************************************************/ + public void setNoRowsFoundHTML(String noRowsFoundHTML) + { + this.noRowsFoundHTML = noRowsFoundHTML; + } + + + + /******************************************************************************* + ** Fluent setter for noRowsFoundHTML + ** + *******************************************************************************/ + public TableData withNoRowsFoundHTML(String noRowsFoundHTML) + { + this.noRowsFoundHTML = noRowsFoundHTML; + return (this); + } + + + /******************************************************************************* ** *******************************************************************************/