CE-1887 - update some block attributes as needed for working-version of android mobile scan apps

This commit is contained in:
2024-10-31 11:22:56 -05:00
parent 45439d7596
commit 46e54ed8e3
23 changed files with 1698 additions and 132 deletions

View File

@ -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());
}
/***************************************************************************
**
***************************************************************************/

View File

@ -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);
}
/***************************************************************************
**
***************************************************************************/

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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());
}
}

View File

@ -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<String> 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());
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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());
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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()));
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<String> getPadding()
{
return (this.wrapped.getPadding());
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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());
}
}

View File

@ -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());
}
}

View File

@ -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);

View File

@ -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());
}
}

View File

@ -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()));
}
}

View File

@ -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());