diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/CompositeWidgetData.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/CompositeWidgetData.java index 5ad9b82a..aa931087 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/CompositeWidgetData.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/CompositeWidgetData.java @@ -40,6 +40,13 @@ public class CompositeWidgetData extends AbstractBlockWidgetData> blocks = new ArrayList<>(); + private ModalMode modalMode; + + public enum ModalMode + { + MODAL + } + private Layout layout; private Map styleOverrides = new HashMap<>(); private String overlayHtml; @@ -54,6 +61,7 @@ public class CompositeWidgetData extends AbstractBlockWidgetData padding; + + private String backgroundColor; + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static class Directional + { + private T top; + private T bottom; + private T left; + private T right; + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public Directional() + { + } + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public Directional(T top, T right, T bottom, T left) + { + this.top = top; + this.right = right; + this.bottom = bottom; + this.left = left; + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional of(T top, T right, T bottom, T left) + { + return (new Directional<>(top, right, bottom, left)); + } + + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional of(T value) + { + return (new Directional<>(value, value, value, value)); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional ofTop(T top) + { + return (new Directional<>(top, null, null, null)); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional ofRight(T right) + { + return (new Directional<>(null, right, null, null)); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional ofBottom(T bottom) + { + return (new Directional<>(null, null, bottom, null)); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional ofLeft(T left) + { + return (new Directional<>(null, null, null, left)); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional ofX(T x) + { + return (new Directional<>(null, x, null, x)); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional ofY(T y) + { + return (new Directional<>(y, null, y, null)); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public static Directional ofXY(T x, T y) + { + return (new Directional<>(y, x, y, x)); + } + + + + /******************************************************************************* + ** Getter for top + ** + *******************************************************************************/ + public T getTop() + { + return top; + } + + + + /******************************************************************************* + ** Setter for top + ** + *******************************************************************************/ + public void setTop(T top) + { + this.top = top; + } + + + + /******************************************************************************* + ** Fluent setter for top + ** + *******************************************************************************/ + public Directional withTop(T top) + { + this.top = top; + return (this); + } + + + + /******************************************************************************* + ** Getter for bottom + ** + *******************************************************************************/ + public T getBottom() + { + return bottom; + } + + + + /******************************************************************************* + ** Setter for bottom + ** + *******************************************************************************/ + public void setBottom(T bottom) + { + this.bottom = bottom; + } + + + + /******************************************************************************* + ** Fluent setter for bottom + ** + *******************************************************************************/ + public Directional withBottom(T bottom) + { + this.bottom = bottom; + return (this); + } + + + + /******************************************************************************* + ** Getter for left + ** + *******************************************************************************/ + public T getLeft() + { + return left; + } + + + + /******************************************************************************* + ** Setter for left + ** + *******************************************************************************/ + public void setLeft(T left) + { + this.left = left; + } + + + + /******************************************************************************* + ** Fluent setter for left + ** + *******************************************************************************/ + public Directional withLeft(T left) + { + this.left = left; + return (this); + } + + + + /******************************************************************************* + ** Getter for right + ** + *******************************************************************************/ + public T getRight() + { + return right; + } + + + + /******************************************************************************* + ** Setter for right + ** + *******************************************************************************/ + public void setRight(T right) + { + this.right = right; + } + + + + /******************************************************************************* + ** Fluent setter for right + ** + *******************************************************************************/ + public Directional withRight(T right) + { + this.right = right; + return (this); + } + + } + + + + /******************************************************************************* + ** Getter for padding + *******************************************************************************/ + public Directional getPadding() + { + return (this.padding); + } + + + + /******************************************************************************* + ** Setter for padding + *******************************************************************************/ + public void setPadding(Directional padding) + { + this.padding = padding; + } + + + + /******************************************************************************* + ** Fluent setter for padding + *******************************************************************************/ + public BaseStyles withPadding(Directional padding) + { + this.padding = padding; + return (this); + } + + + + /******************************************************************************* + ** Getter for backgroundColor + *******************************************************************************/ + public String getBackgroundColor() + { + return (this.backgroundColor); + } + + + + /******************************************************************************* + ** Setter for backgroundColor + *******************************************************************************/ + public void setBackgroundColor(String backgroundColor) + { + this.backgroundColor = backgroundColor; + } + + + + /******************************************************************************* + ** Fluent setter for backgroundColor + *******************************************************************************/ + public BaseStyles withBackgroundColor(String backgroundColor) + { + this.backgroundColor = backgroundColor; + return (this); + } + } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/actionbutton/ActionButtonBlockData.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/button/ButtonBlockData.java similarity index 85% rename from qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/actionbutton/ActionButtonBlockData.java rename to qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/button/ButtonBlockData.java index 90964144..cd043ed0 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/actionbutton/ActionButtonBlockData.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/button/ButtonBlockData.java @@ -19,20 +19,19 @@ * along with this program. If not, see . */ -package com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.actionbutton; +package com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.button; import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.AbstractBlockWidgetData; import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.base.BaseSlots; -import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.base.BaseStyles; /******************************************************************************* ** a button (for a process - not sure yet what this could do in a standalone ** widget?) to submit the process screen to run a specific action (e.g., not just - ** 'next') + ** 'next'), or do other control-ish things *******************************************************************************/ -public class ActionButtonBlockData extends AbstractBlockWidgetData +public class ButtonBlockData extends AbstractBlockWidgetData { /******************************************************************************* @@ -41,7 +40,7 @@ public class ActionButtonBlockData extends AbstractBlockWidgetData. */ -package com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.actionbutton; +package com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.button; -import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.BlockValuesInterface; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.BlockStylesInterface; /******************************************************************************* ** *******************************************************************************/ -public class ActionButtonValues implements BlockValuesInterface +public class ButtonStyles implements BlockStylesInterface { - private String label; - private String actionCode; + private String color; + private String format; - /******************************************************************************* - ** Constructor + /*************************************************************************** ** - *******************************************************************************/ - public ActionButtonValues() + ***************************************************************************/ + public enum StandardColor { + SUCCESS, + WARNING, + ERROR, + INFO, + MUTED } - /******************************************************************************* - ** Constructor + /*************************************************************************** ** - *******************************************************************************/ - public ActionButtonValues(String label, String actionCode) + ***************************************************************************/ + public enum StandardFormat { - setLabel(label); - setActionCode(actionCode); + OUTLINED, + FILLED, + TEXT } /******************************************************************************* - ** Getter for label + ** Getter for color *******************************************************************************/ - public String getLabel() + public String getColor() { - return (this.label); + return (this.color); } /******************************************************************************* - ** Setter for label + ** Setter for color *******************************************************************************/ - public void setLabel(String label) + public void setColor(String color) { - this.label = label; + this.color = color; } /******************************************************************************* - ** Fluent setter for label + ** Fluent setter for color *******************************************************************************/ - public ActionButtonValues withLabel(String label) + public ButtonStyles withColor(String color) { - this.label = label; + this.color = color; return (this); } /******************************************************************************* - ** Getter for actionCode + ** Getter for format *******************************************************************************/ - public String getActionCode() + public String getFormat() { - return (this.actionCode); + return (this.format); } /******************************************************************************* - ** Setter for actionCode + ** Setter for format *******************************************************************************/ - public void setActionCode(String actionCode) + public void setFormat(String format) { - this.actionCode = actionCode; + this.format = format; } /******************************************************************************* - ** Fluent setter for actionCode + ** Fluent setter for format *******************************************************************************/ - public ActionButtonValues withActionCode(String actionCode) + public ButtonStyles withFormat(String format) { - this.actionCode = actionCode; + this.format = format; + return (this); + } + + /******************************************************************************* + ** Setter for format + *******************************************************************************/ + public void setFormat(StandardFormat format) + { + this.format = (format == null ? null : format.name().toLowerCase()); + } + + + + /******************************************************************************* + ** Fluent setter for format + *******************************************************************************/ + public ButtonStyles withFormat(StandardFormat format) + { + setFormat(format); return (this); } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/button/ButtonValues.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/button/ButtonValues.java new file mode 100644 index 00000000..5faff9e4 --- /dev/null +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/button/ButtonValues.java @@ -0,0 +1,218 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2024. 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.blocks.button; + + +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.BlockValuesInterface; +import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon; + + +/******************************************************************************* + ** + *******************************************************************************/ +public class ButtonValues implements BlockValuesInterface +{ + private String label; + private String actionCode; + private String controlCode; + + private QIcon startIcon; + private QIcon endIcon; + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public ButtonValues() + { + } + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public ButtonValues(String label, String actionCode) + { + setLabel(label); + setActionCode(actionCode); + } + + + + /******************************************************************************* + ** Getter for label + *******************************************************************************/ + public String getLabel() + { + return (this.label); + } + + + + /******************************************************************************* + ** Setter for label + *******************************************************************************/ + public void setLabel(String label) + { + this.label = label; + } + + + + /******************************************************************************* + ** Fluent setter for label + *******************************************************************************/ + public ButtonValues withLabel(String label) + { + this.label = label; + return (this); + } + + + + /******************************************************************************* + ** Getter for actionCode + *******************************************************************************/ + public String getActionCode() + { + return (this.actionCode); + } + + + + /******************************************************************************* + ** Setter for actionCode + *******************************************************************************/ + public void setActionCode(String actionCode) + { + this.actionCode = actionCode; + } + + + + /******************************************************************************* + ** Fluent setter for actionCode + *******************************************************************************/ + public ButtonValues withActionCode(String actionCode) + { + this.actionCode = actionCode; + return (this); + } + + + + /******************************************************************************* + ** Getter for startIcon + *******************************************************************************/ + public QIcon getStartIcon() + { + return (this.startIcon); + } + + + + /******************************************************************************* + ** Setter for startIcon + *******************************************************************************/ + public void setStartIcon(QIcon startIcon) + { + this.startIcon = startIcon; + } + + + + /******************************************************************************* + ** Fluent setter for startIcon + *******************************************************************************/ + public ButtonValues withStartIcon(QIcon startIcon) + { + this.startIcon = startIcon; + return (this); + } + + + + /******************************************************************************* + ** Getter for endIcon + *******************************************************************************/ + public QIcon getEndIcon() + { + return (this.endIcon); + } + + + + /******************************************************************************* + ** Setter for endIcon + *******************************************************************************/ + public void setEndIcon(QIcon endIcon) + { + this.endIcon = endIcon; + } + + + + /******************************************************************************* + ** Fluent setter for endIcon + *******************************************************************************/ + public ButtonValues withEndIcon(QIcon endIcon) + { + this.endIcon = endIcon; + return (this); + } + + + + /******************************************************************************* + ** Getter for controlCode + *******************************************************************************/ + public String getControlCode() + { + return (this.controlCode); + } + + + + /******************************************************************************* + ** Setter for controlCode + *******************************************************************************/ + public void setControlCode(String controlCode) + { + this.controlCode = controlCode; + } + + + + /******************************************************************************* + ** Fluent setter for controlCode + *******************************************************************************/ + public ButtonValues withControlCode(String controlCode) + { + this.controlCode = controlCode; + return (this); + } + +} diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/image/ImageStyles.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/image/ImageStyles.java index 9ab944ee..24f252b5 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/image/ImageStyles.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/image/ImageStyles.java @@ -22,51 +22,29 @@ package com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.image; -import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.BlockStylesInterface; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.base.BaseStyles; /******************************************************************************* ** *******************************************************************************/ -public class ImageStyles implements BlockStylesInterface +public class ImageStyles extends BaseStyles { - private String width; - private String height; - private boolean bordered = false; - + private String width; + private String height; /******************************************************************************* - ** Getter for bordered + ** Fluent setter for padding *******************************************************************************/ - public boolean getBordered() + @Override + public ImageStyles withPadding(Directional padding) { - return (this.bordered); - } - - - - /******************************************************************************* - ** Setter for bordered - *******************************************************************************/ - public void setBordered(boolean bordered) - { - this.bordered = bordered; - } - - - - /******************************************************************************* - ** Fluent setter for bordered - *******************************************************************************/ - public ImageStyles withBordered(boolean bordered) - { - this.bordered = bordered; + super.setPadding(padding); return (this); } - /******************************************************************************* ** Getter for width *******************************************************************************/ diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/inputfield/InputFieldValues.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/inputfield/InputFieldValues.java index bacf5355..52a82f60 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/inputfield/InputFieldValues.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/inputfield/InputFieldValues.java @@ -32,8 +32,11 @@ import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData; public class InputFieldValues implements BlockValuesInterface { private QFieldMetaData fieldMetaData; - private Boolean autoFocus; - private Boolean submitOnEnter; + + private Boolean autoFocus; + private Boolean submitOnEnter; + private Boolean hideSoftKeyboard; + private String placeholder; @@ -149,4 +152,66 @@ public class InputFieldValues implements BlockValuesInterface return (this); } + + + /******************************************************************************* + ** Getter for placeholder + *******************************************************************************/ + public String getPlaceholder() + { + return (this.placeholder); + } + + + + /******************************************************************************* + ** Setter for placeholder + *******************************************************************************/ + public void setPlaceholder(String placeholder) + { + this.placeholder = placeholder; + } + + + + /******************************************************************************* + ** Fluent setter for placeholder + *******************************************************************************/ + public InputFieldValues withPlaceholder(String placeholder) + { + this.placeholder = placeholder; + return (this); + } + + + /******************************************************************************* + ** Getter for hideSoftKeyboard + *******************************************************************************/ + public Boolean getHideSoftKeyboard() + { + return (this.hideSoftKeyboard); + } + + + + /******************************************************************************* + ** Setter for hideSoftKeyboard + *******************************************************************************/ + public void setHideSoftKeyboard(Boolean hideSoftKeyboard) + { + this.hideSoftKeyboard = hideSoftKeyboard; + } + + + + /******************************************************************************* + ** Fluent setter for hideSoftKeyboard + *******************************************************************************/ + public InputFieldValues withHideSoftKeyboard(Boolean hideSoftKeyboard) + { + this.hideSoftKeyboard = hideSoftKeyboard; + return (this); + } + + } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/text/TextStyles.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/text/TextStyles.java index 41cadb00..c72e1e25 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/text/TextStyles.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/text/TextStyles.java @@ -30,9 +30,10 @@ import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.BlockStyles *******************************************************************************/ public class TextStyles implements BlockStylesInterface { - private StandardColor standardColor; - - private boolean isAlert; + private String color; + private String format; + private String weight; + private String size; @@ -50,6 +51,81 @@ public class TextStyles implements BlockStylesInterface + /*************************************************************************** + ** + ***************************************************************************/ + public enum StandardFormat + { + DEFAULT, + ALERT, + BANNER + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public enum StandardSize + { + LARGEST, + HEADLINE, + TITLE, + BODY, + SMALLEST + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + public enum StandardWeight + { + EXTRA_LIGHT("extralight"), + THIN("thin"), + MEDIUM("medium"), + SEMI_BOLD("semibold"), + BLACK("black"), + BOLD("bold"), + EXTRA_BOLD("extrabold"), + W100("100"), + W200("200"), + W300("300"), + W400("400"), + W500("500"), + W600("600"), + W700("700"), + W800("800"), + W900("900"); + + private final String value; + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + StandardWeight(String value) + { + this.value = value; + } + + + + /******************************************************************************* + ** Getter for value + ** + *******************************************************************************/ + public String getValue() + { + return value; + } + } + + + /******************************************************************************* ** Constructor ** @@ -65,69 +141,214 @@ public class TextStyles implements BlockStylesInterface ***************************************************************************/ public TextStyles(StandardColor standardColor) { - setStandardColor(standardColor); + setColor(standardColor); } /******************************************************************************* - ** Getter for standardColor + ** Getter for format *******************************************************************************/ - public StandardColor getStandardColor() + public String getFormat() { - return (this.standardColor); + return (this.format); } /******************************************************************************* - ** Setter for standardColor + ** Setter for format *******************************************************************************/ - public void setStandardColor(StandardColor standardColor) + public void setFormat(String format) { - this.standardColor = standardColor; + this.format = format; } /******************************************************************************* - ** Fluent setter for standardColor + ** Fluent setter for format *******************************************************************************/ - public TextStyles withStandardColor(StandardColor standardColor) + public TextStyles withFormat(String format) { - this.standardColor = standardColor; + this.format = format; + return (this); + } + + + + /******************************************************************************* + ** Setter for format + *******************************************************************************/ + public void setFormat(StandardFormat format) + { + this.format = format == null ? null : format.name().toLowerCase(); + } + + + + /******************************************************************************* + ** Fluent setter for format + *******************************************************************************/ + public TextStyles withFormat(StandardFormat format) + { + this.setFormat(format); + return (this); + } + + + + /******************************************************************************* + ** Getter for weight + *******************************************************************************/ + public String getWeight() + { + return (this.weight); + } + + + + /******************************************************************************* + ** Setter for weight + *******************************************************************************/ + public void setWeight(String weight) + { + this.weight = weight; + } + + + + /******************************************************************************* + ** Fluent setter for weight + *******************************************************************************/ + public TextStyles withWeight(String weight) + { + this.weight = weight; + return (this); + } + + + + /******************************************************************************* + ** Setter for weight + *******************************************************************************/ + public void setWeight(StandardWeight weight) + { + setWeight(weight == null ? null : weight.getValue()); + } + + + + /******************************************************************************* + ** Fluent setter for weight + *******************************************************************************/ + public TextStyles withWeight(StandardWeight weight) + { + setWeight(weight); + return (this); + } + + + + /******************************************************************************* + ** Getter for size + *******************************************************************************/ + public String getSize() + { + return (this.size); + } + + + + /******************************************************************************* + ** Setter for size + *******************************************************************************/ + public void setSize(String size) + { + this.size = size; + } + + + + /******************************************************************************* + ** Fluent setter for size + *******************************************************************************/ + public TextStyles withSize(String size) + { + this.size = size; return (this); } /******************************************************************************* - ** Getter for isAlert + ** Setter for size *******************************************************************************/ - public boolean getIsAlert() + public void setSize(StandardSize size) { - return (this.isAlert); + this.size = (size == null ? null : size.name().toLowerCase()); } /******************************************************************************* - ** Setter for isAlert + ** Fluent setter for size *******************************************************************************/ - public void setIsAlert(boolean isAlert) + public TextStyles withSize(StandardSize size) { - this.isAlert = isAlert; - } - - - - /******************************************************************************* - ** Fluent setter for isAlert - *******************************************************************************/ - public TextStyles withIsAlert(boolean isAlert) - { - this.isAlert = isAlert; + setSize(size); return (this); } + + /******************************************************************************* + ** Getter for color + *******************************************************************************/ + public String getColor() + { + return (this.color); + } + + + + /******************************************************************************* + ** Setter for color + *******************************************************************************/ + public void setColor(String color) + { + this.color = color; + } + + + + /******************************************************************************* + ** Fluent setter for color + *******************************************************************************/ + public TextStyles withColor(String color) + { + this.color = color; + return (this); + } + + + + /******************************************************************************* + ** Setter for color + *******************************************************************************/ + public void setColor(StandardColor color) + { + this.color = color == null ? null : color.name(); + } + + + + /******************************************************************************* + ** Fluent setter for color + *******************************************************************************/ + public TextStyles withColor(StandardColor color) + { + setColor(color); + return (this); + } + } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/text/TextValues.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/text/TextValues.java index 3b82f4cb..132933b1 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/text/TextValues.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/dashboard/widgets/blocks/text/TextValues.java @@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.text; import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.BlockValuesInterface; +import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon; /******************************************************************************* @@ -32,6 +33,9 @@ public class TextValues implements BlockValuesInterface { private String text; + private QIcon startIcon; + private QIcon endIcon; + /******************************************************************************* @@ -84,4 +88,66 @@ public class TextValues implements BlockValuesInterface return (this); } + + /******************************************************************************* + ** Getter for startIcon + *******************************************************************************/ + public QIcon getStartIcon() + { + return (this.startIcon); + } + + + + /******************************************************************************* + ** Setter for startIcon + *******************************************************************************/ + public void setStartIcon(QIcon startIcon) + { + this.startIcon = startIcon; + } + + + + /******************************************************************************* + ** Fluent setter for startIcon + *******************************************************************************/ + public TextValues withStartIcon(QIcon startIcon) + { + this.startIcon = startIcon; + return (this); + } + + + + /******************************************************************************* + ** Getter for endIcon + *******************************************************************************/ + public QIcon getEndIcon() + { + return (this.endIcon); + } + + + + /******************************************************************************* + ** Setter for endIcon + *******************************************************************************/ + public void setEndIcon(QIcon endIcon) + { + this.endIcon = endIcon; + } + + + + /******************************************************************************* + ** Fluent setter for endIcon + *******************************************************************************/ + public TextValues withEndIcon(QIcon endIcon) + { + this.endIcon = endIcon; + return (this); + } + + } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/metadata/processes/QFrontendStepMetaData.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/metadata/processes/QFrontendStepMetaData.java index 9de7595a..0c07043e 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/metadata/processes/QFrontendStepMetaData.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/metadata/processes/QFrontendStepMetaData.java @@ -47,6 +47,8 @@ public class QFrontendStepMetaData extends QStepMetaData private List recordListFields; private Map formFieldMap; + private String format; + private List helpContents; @@ -403,4 +405,35 @@ public class QFrontendStepMetaData extends QStepMetaData QInstanceHelpContentManager.removeHelpContentByRoleSetFromList(roles, this.helpContents); } + + /******************************************************************************* + ** Getter for format + *******************************************************************************/ + public String getFormat() + { + return (this.format); + } + + + + /******************************************************************************* + ** Setter for format + *******************************************************************************/ + public void setFormat(String format) + { + this.format = format; + } + + + + /******************************************************************************* + ** Fluent setter for format + *******************************************************************************/ + public QFrontendStepMetaData withFormat(String format) + { + this.format = format; + return (this); + } + + } diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/FrontendStep.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/FrontendStep.java index d8c36433..33a204e4 100644 --- a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/FrontendStep.java +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/FrontendStep.java @@ -84,6 +84,17 @@ public class FrontendStep implements ToSchema + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("An optional indicator of the screen format preferred by the application to be used for this screen. Different frontends may support different formats, and implement them differently.") + public String getFormat() + { + return (this.wrapped.getFormat()); + } + + + /*************************************************************************** ** ***************************************************************************/ diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlock.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlock.java index 0ed526b0..92a70bb6 100644 --- a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlock.java +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlock.java @@ -75,7 +75,7 @@ public class WidgetBlock implements Serializable, ToSchema ***************************************************************************/ public enum BlockType { - ACTION_BUTTON, + BUTTON, AUDIO, BIG_NUMBER, COMPOSITE, @@ -159,6 +159,22 @@ public class WidgetBlock implements Serializable, ToSchema + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("For COMPOSITE type blocks, optional control to make the widget appear modally") + public CompositeWidgetData.ModalMode getModalMode() + { + if(this.wrapped instanceof CompositeWidgetData compositeWidgetData) + { + return (compositeWidgetData.getModalMode()); + } + + return (null); + } + + + /*************************************************************************** ** ***************************************************************************/ diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockAudioValues.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockAudioValues.java new file mode 100644 index 00000000..c88e771a --- /dev/null +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockAudioValues.java @@ -0,0 +1,92 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2024. 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.middleware.javalin.specs.v1.responses.components; + + +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.audio.AudioValues; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExclude; + + +/******************************************************************************* + ** + *******************************************************************************/ +@OpenAPIDescription("Values used for an AUDIO type widget block") +public final class WidgetBlockAudioValues implements WidgetBlockValues +{ + @OpenAPIExclude() + private AudioValues wrapped; + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public WidgetBlockAudioValues(AudioValues textValues) + { + this.wrapped = textValues; + } + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public WidgetBlockAudioValues() + { + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("The path to the audio file on the server") + public String getPath() + { + return (this.wrapped.getPath()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("Control if the file should automatically play when the block is rendered") + public Boolean getAutoPlay() + { + return (this.wrapped.getAutoPlay()); + } + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("Control if on-screen controls should be shown to allow the user to control playback") + public Boolean getShowControls() + { + return (this.wrapped.getShowControls()); + } + +} diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockActionButtonValues.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockBaseStyles.java similarity index 73% rename from qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockActionButtonValues.java rename to qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockBaseStyles.java index 52311cbb..66541a85 100644 --- a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockActionButtonValues.java +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockBaseStyles.java @@ -22,7 +22,7 @@ package com.kingsrook.qqq.middleware.javalin.specs.v1.responses.components; -import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.actionbutton.ActionButtonValues; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.base.BaseStyles; import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription; import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExclude; @@ -30,21 +30,19 @@ import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExc /******************************************************************************* ** *******************************************************************************/ -@OpenAPIDescription("Values used for an ACTION_BUTTON type widget block") -public final class WidgetBlockActionButtonValues implements WidgetBlockValues +public final class WidgetBlockBaseStyles implements WidgetBlockStyles { @OpenAPIExclude() - private ActionButtonValues wrapped; + private BaseStyles wrapped; - /******************************************************************************* - ** Constructor + /*************************************************************************** ** - *******************************************************************************/ - public WidgetBlockActionButtonValues(ActionButtonValues actionButtonValues) + ***************************************************************************/ + public WidgetBlockBaseStyles(BaseStyles baseStyles) { - this.wrapped = actionButtonValues; + this.wrapped = baseStyles; } @@ -53,7 +51,7 @@ public final class WidgetBlockActionButtonValues implements WidgetBlockValues ** Constructor ** *******************************************************************************/ - public WidgetBlockActionButtonValues() + public WidgetBlockBaseStyles() { } @@ -62,21 +60,20 @@ public final class WidgetBlockActionButtonValues implements WidgetBlockValues /*************************************************************************** ** ***************************************************************************/ - @OpenAPIDescription("User-facing label to display in the button") - public String getLabel() + @OpenAPIDescription("Optional padding to apply to the block") + public BaseStyles.Directional getPadding() { - return (this.wrapped.getLabel()); + return (this.wrapped.getPadding()); } - /*************************************************************************** ** ***************************************************************************/ - @OpenAPIDescription("Code used within the app as the value submitted when the button is clicked") - public String getActionCode() + @OpenAPIDescription("A background color to use for the block") + public String getBackgroundColor() { - return (this.wrapped.getActionCode()); + return (this.wrapped.getBackgroundColor()); } } diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockButtonStyles.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockButtonStyles.java new file mode 100644 index 00000000..5f06ea61 --- /dev/null +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockButtonStyles.java @@ -0,0 +1,84 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2024. 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.middleware.javalin.specs.v1.responses.components; + + +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.button.ButtonStyles; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExclude; + + +/******************************************************************************* + ** + *******************************************************************************/ +public final class WidgetBlockButtonStyles implements WidgetBlockStyles +{ + + @OpenAPIExclude() + private ButtonStyles wrapped; + + + + /*************************************************************************** + ** + ***************************************************************************/ + public WidgetBlockButtonStyles(ButtonStyles buttonStyles) + { + this.wrapped = buttonStyles; + } + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public WidgetBlockButtonStyles() + { + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("A Color to use for the button. May be specified as a StandardColor (one of: " + + "SUCCESS, WARNING, ERROR, INFO, MUTED) or an RGB code.") + public String getColor() + { + return (this.wrapped.getColor()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("An optional indicator of the screen format preferred by the application to be used for this block, " + + "such as OUTLINED, FILLED, or TEXT. Different frontends may support different formats, and implement them differently.") + public String getFormat() + { + return (this.wrapped.getFormat()); + } + + +} diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockButtonValues.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockButtonValues.java new file mode 100644 index 00000000..73ff0022 --- /dev/null +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockButtonValues.java @@ -0,0 +1,123 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2024. 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.middleware.javalin.specs.v1.responses.components; + + +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.button.ButtonValues; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExclude; + + +/******************************************************************************* + ** + *******************************************************************************/ +@OpenAPIDescription("Values used for a BUTTON type widget block") +public final class WidgetBlockButtonValues implements WidgetBlockValues +{ + @OpenAPIExclude() + private ButtonValues wrapped; + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public WidgetBlockButtonValues(ButtonValues buttonValues) + { + this.wrapped = buttonValues; + } + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public WidgetBlockButtonValues() + { + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("User-facing label to display in the button") + public String getLabel() + { + return (this.wrapped.getLabel()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("Code used within the app as the value submitted when the button is clicked") + public String getActionCode() + { + return (this.wrapped.getActionCode()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription(""" + Instructions for what should happen in the frontend (e.g., within a screen), when the button is clicked. + + To show a modal composite block, use format: `showModal:${blockId}` (e.g., `showModal:myBlock`) + + To hide a modal composite block, use format: `hideModal:${blockId}` (e.g., `hideModal:myBlock`) + + To toggle visibility of a modal composite block, use format: `toggleModal:${blockId}` (e.g., `toggleModal:myBlock`) + """) + public String getControlCode() + { + return (this.wrapped.getControlCode()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("An optional icon to display before the text in the button") + public Icon getStartIcon() + { + return (this.wrapped.getStartIcon() == null ? null : new Icon(this.wrapped.getStartIcon())); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("An optional icon to display after the text in the button") + public Icon getEndIcon() + { + return (this.wrapped.getEndIcon() == null ? null : new Icon(this.wrapped.getEndIcon())); + } + +} diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockImageStyles.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockImageStyles.java new file mode 100644 index 00000000..c2fc96f2 --- /dev/null +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockImageStyles.java @@ -0,0 +1,92 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2024. 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.middleware.javalin.specs.v1.responses.components; + + +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.base.BaseStyles; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.image.ImageStyles; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExclude; + + +/******************************************************************************* + ** + *******************************************************************************/ +public final class WidgetBlockImageStyles implements WidgetBlockStyles +{ + @OpenAPIExclude() + private ImageStyles wrapped; + + + + /*************************************************************************** + ** + ***************************************************************************/ + public WidgetBlockImageStyles(ImageStyles imageStyles) + { + this.wrapped = imageStyles; + } + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public WidgetBlockImageStyles() + { + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("A request to render the image at a specified width.") + public String getWidth() + { + return (this.wrapped.getWidth()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("A request to render the image at a specified height.") + public String getHeight() + { + return (this.wrapped.getHeight()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("Optional padding to apply to the image") + public BaseStyles.Directional getPadding() + { + return (this.wrapped.getPadding()); + } + +} diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockImageValues.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockImageValues.java new file mode 100644 index 00000000..1665c375 --- /dev/null +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockImageValues.java @@ -0,0 +1,71 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2024. 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.middleware.javalin.specs.v1.responses.components; + + +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.image.ImageValues; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription; +import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExclude; + + +/******************************************************************************* + ** + *******************************************************************************/ +@OpenAPIDescription("Values used for an IMAGE type widget block") +public final class WidgetBlockImageValues implements WidgetBlockValues +{ + @OpenAPIExclude() + private ImageValues wrapped; + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public WidgetBlockImageValues(ImageValues textValues) + { + this.wrapped = textValues; + } + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public WidgetBlockImageValues() + { + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("The path to the image on the server") + public String getPath() + { + return (this.wrapped.getPath()); + } + +} diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockInputFieldValues.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockInputFieldValues.java index 31186e94..76e50df1 100644 --- a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockInputFieldValues.java +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockInputFieldValues.java @@ -90,4 +90,26 @@ public final class WidgetBlockInputFieldValues implements WidgetBlockValues return (this.wrapped.getSubmitOnEnter()); } + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("Indicate if the frontend uses a software/on-screen keyboard, if the application should try to hide it (e.g., upon auto-focus).") + public Boolean getHideSoftKeyboard() + { + return (this.wrapped.getHideSoftKeyboard()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("Optional placeholder text to display in the input box.") + public String getPlaceholder() + { + return (this.wrapped.getPlaceholder()); + } + } diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockStyles.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockStyles.java index 07cdcd42..ac7c0da8 100644 --- a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockStyles.java +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockStyles.java @@ -24,6 +24,9 @@ package com.kingsrook.qqq.middleware.javalin.specs.v1.responses.components; import com.kingsrook.qqq.backend.core.logging.QLogger; import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.BlockStylesInterface; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.base.BaseStyles; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.button.ButtonStyles; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.image.ImageStyles; import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.text.TextStyles; import com.kingsrook.qqq.middleware.javalin.schemabuilder.ToSchema; import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExclude; @@ -33,6 +36,9 @@ import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExc ** *******************************************************************************/ public sealed interface WidgetBlockStyles extends ToSchema permits + WidgetBlockBaseStyles, + WidgetBlockButtonStyles, + WidgetBlockImageStyles, WidgetBlockTextStyles { @OpenAPIExclude @@ -49,10 +55,25 @@ public sealed interface WidgetBlockStyles extends ToSchema permits return (null); } - if(blockStyles instanceof TextStyles s) + if(blockStyles instanceof ButtonStyles s) + { + return (new WidgetBlockButtonStyles(s)); + } + else if(blockStyles instanceof ImageStyles s) + { + return (new WidgetBlockImageStyles(s)); + } + else if(blockStyles instanceof TextStyles s) { return (new WidgetBlockTextStyles(s)); } + ////////////////////////////////////////////////////////////////////////////////////////////// + // note - important for this one to be last, since it's a base class to some of the above!! // + ////////////////////////////////////////////////////////////////////////////////////////////// + else if(blockStyles instanceof BaseStyles s) + { + return (new WidgetBlockBaseStyles(s)); + } LOG.warn("Unrecognized block value type: " + blockStyles.getClass().getName()); return (null); diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockTextStyles.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockTextStyles.java index 3d8c5d78..d8355517 100644 --- a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockTextStyles.java +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockTextStyles.java @@ -45,6 +45,8 @@ public final class WidgetBlockTextStyles implements WidgetBlockStyles this.wrapped = textStyles; } + + /******************************************************************************* ** Constructor ** @@ -54,23 +56,51 @@ public final class WidgetBlockTextStyles implements WidgetBlockStyles } + /*************************************************************************** ** ***************************************************************************/ - @OpenAPIDescription("Indicate if the text should be displayed as an alert (e.g., modal popup)") - public Boolean getIsAlert() + @OpenAPIDescription("A Color to display the text in. May be specified as a StandardColor (one of: " + + "SUCCESS, WARNING, ERROR, INFO, MUTED) or an RGB code.") + public String getColor() { - return (this.wrapped.getIsAlert()); + return (this.wrapped.getColor()); } + /*************************************************************************** ** ***************************************************************************/ - @OpenAPIDescription("A Standard Color to display the text in (e.g., not a hex or RGB code).") - public TextStyles.StandardColor getStandardColor() + @OpenAPIDescription("An optional indicator of the screen format preferred by the application to be used for this block. " + + "Different frontends may support different formats, and implement them differently.") + public String getFormat() { - return (this.wrapped.getStandardColor()); + return (this.wrapped.getFormat()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("An optional indicator of the weight at which the text should be rendered. May be a named value (one of" + + "extralight, thin, medium, black, semibold, bold, extrabold) or a numeric, e.g., 100, 200, ..., 900") + public String getWeight() + { + return (this.wrapped.getWeight()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("An optional indicator of the size at which the text should be rendered. May be a named value (one of" + + "largest, headline, title, body, smallest) or a numeric size - both are up to the frontend to interpret.") + public String getSize() + { + return (this.wrapped.getSize()); } } diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockTextValues.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockTextValues.java index 49977873..eef1c051 100644 --- a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockTextValues.java +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockTextValues.java @@ -68,4 +68,26 @@ public final class WidgetBlockTextValues implements WidgetBlockValues return (this.wrapped.getText()); } + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("An optional icon to display before the text") + public Icon getStartIcon() + { + return (this.wrapped.getStartIcon() == null ? null : new Icon(this.wrapped.getStartIcon())); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @OpenAPIDescription("An optional icon to display after the text") + public Icon getEndIcon() + { + return (this.wrapped.getEndIcon() == null ? null : new Icon(this.wrapped.getEndIcon())); + } + } diff --git a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockValues.java b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockValues.java index bdac09ae..2f17949e 100644 --- a/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockValues.java +++ b/qqq-middleware-javalin/src/main/java/com/kingsrook/qqq/middleware/javalin/specs/v1/responses/components/WidgetBlockValues.java @@ -24,7 +24,9 @@ package com.kingsrook.qqq.middleware.javalin.specs.v1.responses.components; import com.kingsrook.qqq.backend.core.logging.QLogger; import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.BlockValuesInterface; -import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.actionbutton.ActionButtonValues; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.audio.AudioValues; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.button.ButtonValues; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.image.ImageValues; import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.inputfield.InputFieldValues; import com.kingsrook.qqq.backend.core.model.dashboard.widgets.blocks.text.TextValues; import com.kingsrook.qqq.middleware.javalin.schemabuilder.ToSchema; @@ -35,9 +37,11 @@ import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExc ** *******************************************************************************/ public sealed interface WidgetBlockValues extends ToSchema permits - WidgetBlockActionButtonValues, - WidgetBlockTextValues, - WidgetBlockInputFieldValues + WidgetBlockAudioValues, + WidgetBlockButtonValues, + WidgetBlockImageValues, + WidgetBlockInputFieldValues, + WidgetBlockTextValues { @OpenAPIExclude QLogger LOG = QLogger.getLogger(WidgetBlockValues.class); @@ -53,17 +57,25 @@ public sealed interface WidgetBlockValues extends ToSchema permits return (null); } - if(blockValues instanceof TextValues v) + if(blockValues instanceof AudioValues v) { - return (new WidgetBlockTextValues(v)); + return (new WidgetBlockAudioValues(v)); + } + else if(blockValues instanceof ButtonValues v) + { + return (new WidgetBlockButtonValues(v)); + } + else if(blockValues instanceof ImageValues v) + { + return (new WidgetBlockImageValues(v)); } else if(blockValues instanceof InputFieldValues v) { return (new WidgetBlockInputFieldValues(v)); } - else if(blockValues instanceof ActionButtonValues v) + else if(blockValues instanceof TextValues v) { - return (new WidgetBlockActionButtonValues(v)); + return (new WidgetBlockTextValues(v)); } LOG.warn("Unrecognized block value type: " + blockValues.getClass().getName());