mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
SPRINT-16: added new widget types, moved some things to a different package, etc.
This commit is contained in:
@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.actions.dashboard;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.AbstractActionInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
|
||||
|
@ -26,6 +26,7 @@ import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||
import com.kingsrook.qqq.backend.core.actions.customizers.QCodeLoader;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||
|
@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.actions.dashboard;
|
||||
package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
|
||||
|
||||
|
||||
import java.time.ZoneId;
|
||||
@ -37,7 +37,6 @@ import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||
public abstract class AbstractWidgetRenderer
|
||||
{
|
||||
public static final QValueFormatter valueFormatter = new QValueFormatter();
|
||||
public static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd h:mma").withZone(ZoneId.systemDefault());
|
||||
public static final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault());
|
||||
|
||||
|
@ -25,7 +25,6 @@ package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
||||
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
|
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2022. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||
import com.kingsrook.qqq.backend.core.actions.values.SearchPossibleValueSourceAction;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.values.SearchPossibleValueSourceInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.values.SearchPossibleValueSourceOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.ParentWidgetData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.ParentWidgetMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValue;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Generic widget for display a parent widget with children of possible values,
|
||||
** child widgets, and child actions
|
||||
*******************************************************************************/
|
||||
public class ParentWidgetRenderer extends AbstractWidgetRenderer
|
||||
{
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public RenderWidgetOutput render(RenderWidgetInput input) throws QException
|
||||
{
|
||||
ActionHelper.validateSession(input);
|
||||
|
||||
try
|
||||
{
|
||||
ParentWidgetMetaData metaData = (ParentWidgetMetaData) input.getWidgetMetaData();
|
||||
ParentWidgetData widgetData = new ParentWidgetData();
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// handle any PVSs creating dropdown data for the frontend //
|
||||
/////////////////////////////////////////////////////////////
|
||||
List<List<Map<String, String>>> pvsData = new ArrayList<>();
|
||||
List<String> pvsLabels = new ArrayList<>();
|
||||
List<String> pvsNames = new ArrayList<>();
|
||||
for(String possibleValueSourceName : CollectionUtils.nonNullList(metaData.getPossibleValueNameList()))
|
||||
{
|
||||
QTableMetaData tableMetaData = input.getInstance().getTable(input.getInstance().getPossibleValueSource(possibleValueSourceName).getTableName());
|
||||
pvsLabels.add(tableMetaData.getLabel());
|
||||
pvsNames.add(tableMetaData.getName());
|
||||
|
||||
SearchPossibleValueSourceInput pvsInput = new SearchPossibleValueSourceInput(input.getInstance());
|
||||
pvsInput.setSession(input.getSession());
|
||||
pvsInput.setPossibleValueSourceName(possibleValueSourceName);
|
||||
SearchPossibleValueSourceOutput output = new SearchPossibleValueSourceAction().execute(pvsInput);
|
||||
|
||||
List<Map<String, String>> dropdownOptionList = new ArrayList<>();
|
||||
pvsData.add(dropdownOptionList);
|
||||
|
||||
//////////////////////////////////////////
|
||||
// sort results, dedupe, and add to map //
|
||||
//////////////////////////////////////////
|
||||
Set<String> exists = new HashSet<>();
|
||||
output.getResults().removeIf(pvs -> !exists.add(pvs.getLabel()));
|
||||
output.getResults().sort(Comparator.comparing(QPossibleValue::getLabel));
|
||||
for(QPossibleValue<?> possibleValue : output.getResults())
|
||||
{
|
||||
dropdownOptionList.add(Map.of(
|
||||
"id", String.valueOf(possibleValue.getId()),
|
||||
"label", possibleValue.getLabel()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
widgetData.setDropdownNameList(pvsNames);
|
||||
widgetData.setDropdownLabelList(pvsLabels);
|
||||
widgetData.setDropdownDataList(pvsData);
|
||||
widgetData.setChildWidgetNameList(metaData.getChildWidgetNameList());
|
||||
|
||||
return (new RenderWidgetOutput(widgetData));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw (new QException("Error rendering parent widget", e));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2022. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.ProcessWidgetData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Generic widget for displaying a process as a widget
|
||||
*******************************************************************************/
|
||||
public class ProcessWidgetRenderer extends AbstractWidgetRenderer
|
||||
{
|
||||
public static final String WIDGET_PROCESS_NAME = "processName";
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public RenderWidgetOutput render(RenderWidgetInput input) throws QException
|
||||
{
|
||||
ActionHelper.validateSession(input);
|
||||
|
||||
try
|
||||
{
|
||||
ProcessWidgetData data = new ProcessWidgetData();
|
||||
if(input.getWidgetMetaData() instanceof QWidgetMetaData widgetMetaData)
|
||||
{
|
||||
String processName = (String) widgetMetaData.getDefaultValues().get(WIDGET_PROCESS_NAME);
|
||||
QProcessMetaData processMetaData = input.getInstance().getProcess(processName);
|
||||
data.setProcessMetaData(processMetaData);
|
||||
}
|
||||
return (new RenderWidgetOutput(data));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw (new QException("Error rendering process widget", e));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.actions.dashboard;
|
||||
package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
@ -0,0 +1,203 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2022. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.model.dashboard.widgets;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Model containing datastructure expected by frontend stepper widget
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class ParentWidgetData implements QWidget
|
||||
{
|
||||
private List<String> dropdownNameList;
|
||||
private List<String> dropdownLabelList;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// this is a list of lists, the outer list corresponds to each dropdown (parallel list //
|
||||
// with the above dropdownLabelList) - the inner list is the list of actual dropdown //
|
||||
// options //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
private List<List<Map<String, String>>> dropdownDataList;
|
||||
|
||||
private List<String> childWidgetNameList;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetData()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for type
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getType()
|
||||
{
|
||||
return WidgetType.PARENT_WIDGET.getType();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for dropdownLabelList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public List<String> getDropdownLabelList()
|
||||
{
|
||||
return dropdownLabelList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for dropdownLabelList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setDropdownLabelList(List<String> dropdownLabelList)
|
||||
{
|
||||
this.dropdownLabelList = dropdownLabelList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for dropdownLabelList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetData withDropdownLabelList(List<String> dropdownLabelList)
|
||||
{
|
||||
this.dropdownLabelList = dropdownLabelList;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for dropdownNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public List<String> getDropdownNameList()
|
||||
{
|
||||
return dropdownNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for dropdownNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setDropdownNameList(List<String> dropdownNameList)
|
||||
{
|
||||
this.dropdownNameList = dropdownNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for dropdownNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetData withDropdownNameList(List<String> dropdownNameList)
|
||||
{
|
||||
this.dropdownNameList = dropdownNameList;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for dropdownDataList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public List<List<Map<String, String>>> getDropdownDataList()
|
||||
{
|
||||
return dropdownDataList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for dropdownDataList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setDropdownDataList(List<List<Map<String, String>>> dropdownDataList)
|
||||
{
|
||||
this.dropdownDataList = dropdownDataList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for dropdownDataList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetData withDropdownDataList(List<List<Map<String, String>>> dropdownDataList)
|
||||
{
|
||||
this.dropdownDataList = dropdownDataList;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for childWidgetNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public List<String> getChildWidgetNameList()
|
||||
{
|
||||
return childWidgetNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for childWidgetNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setChildWidgetNameList(List<String> childWidgetNameList)
|
||||
{
|
||||
this.childWidgetNameList = childWidgetNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for childWidgetNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetData withChildWidgetNameList(List<String> childWidgetNameList)
|
||||
{
|
||||
this.childWidgetNameList = childWidgetNameList;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2022. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.model.dashboard.widgets;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Model containing datastructure expected by frontend stepper widget
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class ProcessWidgetData implements QWidget
|
||||
{
|
||||
private QProcessMetaData processMetaData;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for processMetaData
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QProcessMetaData getProcessMetaData()
|
||||
{
|
||||
return processMetaData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for type
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getType()
|
||||
{
|
||||
return WidgetType.PROCESS.getType();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for processMetaData
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setProcessMetaData(QProcessMetaData processMetaData)
|
||||
{
|
||||
this.processMetaData = processMetaData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for processMetaData
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ProcessWidgetData withProcessMetaData(QProcessMetaData processMetaData)
|
||||
{
|
||||
this.processMetaData = processMetaData;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
@ -28,15 +28,18 @@ package com.kingsrook.qqq.backend.core.model.dashboard.widgets;
|
||||
public enum WidgetType
|
||||
{
|
||||
CHART("chart"),
|
||||
CHILD_RECORD_LIST("childRecordList"),
|
||||
GENERIC("generic"),
|
||||
HTML("html"),
|
||||
LINE_CHART("lineChart"),
|
||||
LOCATION("location"),
|
||||
MULTI_STATISTICS("multiStatistics"),
|
||||
PARENT_WIDGET("parentWidget"),
|
||||
PROCESS("process"),
|
||||
QUICK_SIGHT_CHART("quickSightChart"),
|
||||
STATISTICS("statistics"),
|
||||
STEPPER("stepper"),
|
||||
TABLE("table"),
|
||||
CHILD_RECORD_LIST("childRecordList");
|
||||
TABLE("table");
|
||||
|
||||
|
||||
private final String type;
|
||||
|
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2022. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.model.metadata.dashboard;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Specific meta data for frontend parent widget
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class ParentWidgetMetaData extends QWidgetMetaData implements QWidgetMetaDataInterface
|
||||
{
|
||||
private String title;
|
||||
private List<String> possibleValueNameList;
|
||||
private List<String> childWidgetNameList;
|
||||
private List<String> childProcessNameList;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for title
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for title
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for title
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetMetaData withTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for possibleValueNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public List<String> getPossibleValueNameList()
|
||||
{
|
||||
return possibleValueNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for possibleValueNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setPossibleValueNameList(List<String> possibleValueNameList)
|
||||
{
|
||||
this.possibleValueNameList = possibleValueNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for possibleValueNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetMetaData withPossibleValueNameList(List<String> possibleValueNameList)
|
||||
{
|
||||
this.possibleValueNameList = possibleValueNameList;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for childWidgetNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public List<String> getChildWidgetNameList()
|
||||
{
|
||||
return childWidgetNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for childWidgetNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setChildWidgetNameList(List<String> childWidgetNameList)
|
||||
{
|
||||
this.childWidgetNameList = childWidgetNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for childWidgetNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetMetaData withChildWidgetNameList(List<String> childWidgetNameList)
|
||||
{
|
||||
this.childWidgetNameList = childWidgetNameList;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for childProcessNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public List<String> getChildProcessNameList()
|
||||
{
|
||||
return childProcessNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for childProcessNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setChildProcessNameList(List<String> childProcessNameList)
|
||||
{
|
||||
this.childProcessNameList = childProcessNameList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for childProcessNameList
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ParentWidgetMetaData withChildProcessNameList(List<String> childProcessNameList)
|
||||
{
|
||||
this.childProcessNameList = childProcessNameList;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
@ -23,7 +23,9 @@ package com.kingsrook.qqq.backend.core.model.metadata.processes;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
|
||||
|
||||
@ -38,6 +40,7 @@ public class QFrontendStepMetaData extends QStepMetaData
|
||||
private List<QFieldMetaData> formFields;
|
||||
private List<QFieldMetaData> viewFields;
|
||||
private List<QFieldMetaData> recordListFields;
|
||||
private Map<String, QFieldMetaData> formFieldMap;
|
||||
|
||||
|
||||
|
||||
@ -101,6 +104,22 @@ public class QFrontendStepMetaData extends QStepMetaData
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for a single formFields by its name
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QFieldMetaData getFormField(String fieldName)
|
||||
{
|
||||
if(formFieldMap != null && formFieldMap.containsKey(fieldName))
|
||||
{
|
||||
return (formFieldMap.get(fieldName));
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for formFields
|
||||
**
|
||||
@ -112,13 +131,43 @@ public class QFrontendStepMetaData extends QStepMetaData
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** adder for formFields
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void addFormField(QFieldMetaData fieldMetaData)
|
||||
{
|
||||
if(fieldMetaData != null)
|
||||
{
|
||||
if(formFieldMap == null)
|
||||
{
|
||||
formFieldMap = new HashMap<>();
|
||||
}
|
||||
if(formFields == null)
|
||||
{
|
||||
formFields = new ArrayList<>();
|
||||
}
|
||||
|
||||
formFieldMap.put(fieldMetaData.getName(), fieldMetaData);
|
||||
formFields.add(fieldMetaData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for formFields
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setFormFields(List<QFieldMetaData> formFields)
|
||||
{
|
||||
this.formFields = formFields;
|
||||
if(formFields != null)
|
||||
{
|
||||
for(QFieldMetaData fieldMetaData : formFields)
|
||||
{
|
||||
addFormField(fieldMetaData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -129,11 +178,7 @@ public class QFrontendStepMetaData extends QStepMetaData
|
||||
*******************************************************************************/
|
||||
public QFrontendStepMetaData withFormField(QFieldMetaData formField)
|
||||
{
|
||||
if(this.formFields == null)
|
||||
{
|
||||
this.formFields = new ArrayList<>();
|
||||
}
|
||||
this.formFields.add(formField);
|
||||
addFormField(formField);
|
||||
return (this);
|
||||
}
|
||||
|
||||
@ -145,7 +190,7 @@ public class QFrontendStepMetaData extends QStepMetaData
|
||||
*******************************************************************************/
|
||||
public QFrontendStepMetaData withFormFields(List<QFieldMetaData> formFields)
|
||||
{
|
||||
this.formFields = formFields;
|
||||
this.setFormFields(formFields);
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.core.actions.dashboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.actions.dashboard;
|
||||
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.QuickSightChartRenderer;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||
|
@ -24,7 +24,7 @@ package com.kingsrook.qqq.backend.javalin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||
|
@ -27,7 +27,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.amazonaws.regions.Regions;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.QuickSightChartRenderer;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.QuickSightChartRenderer;
|
||||
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QValueException;
|
||||
|
@ -24,7 +24,7 @@ package com.kingsrook.sampleapp.dashboard.widgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||
|
Reference in New Issue
Block a user