mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 21:20:45 +00:00
CE-604 Add map of icons, tooltips, icon colors
This commit is contained in:
@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.permissions.QPermissionRules;
|
import com.kingsrook.qqq.backend.core.model.metadata.permissions.QPermissionRules;
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ public class QWidgetMetaData implements QWidgetMetaDataInterface
|
|||||||
protected String name;
|
protected String name;
|
||||||
protected String icon;
|
protected String icon;
|
||||||
protected String label;
|
protected String label;
|
||||||
|
protected String tooltip;
|
||||||
protected String type;
|
protected String type;
|
||||||
protected String minHeight;
|
protected String minHeight;
|
||||||
protected String footerHTML;
|
protected String footerHTML;
|
||||||
@ -55,6 +57,8 @@ public class QWidgetMetaData implements QWidgetMetaDataInterface
|
|||||||
private boolean showReloadButton = true;
|
private boolean showReloadButton = true;
|
||||||
private boolean showExportButton = true;
|
private boolean showExportButton = true;
|
||||||
|
|
||||||
|
protected Map<String, QIcon> icons;
|
||||||
|
|
||||||
protected Map<String, Serializable> defaultValues = new LinkedHashMap<>();
|
protected Map<String, Serializable> defaultValues = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
@ -594,4 +598,81 @@ public class QWidgetMetaData implements QWidgetMetaDataInterface
|
|||||||
return (this);
|
return (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Getter for icons
|
||||||
|
*******************************************************************************/
|
||||||
|
public Map<String, QIcon> getIcons()
|
||||||
|
{
|
||||||
|
return (this.icons);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Setter for icons
|
||||||
|
*******************************************************************************/
|
||||||
|
public void setIcons(Map<String, QIcon> icons)
|
||||||
|
{
|
||||||
|
this.icons = icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Fluent setter for icons
|
||||||
|
*******************************************************************************/
|
||||||
|
public QWidgetMetaData withIcon(String role, QIcon icon)
|
||||||
|
{
|
||||||
|
if(this.icons == null)
|
||||||
|
{
|
||||||
|
this.icons = new LinkedHashMap<>();
|
||||||
|
}
|
||||||
|
this.icons.put(role, icon);
|
||||||
|
return (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Fluent setter for icons
|
||||||
|
*******************************************************************************/
|
||||||
|
public QWidgetMetaData withIcons(Map<String, QIcon> icons)
|
||||||
|
{
|
||||||
|
this.icons = icons;
|
||||||
|
return (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Getter for tooltip
|
||||||
|
*******************************************************************************/
|
||||||
|
public String getTooltip()
|
||||||
|
{
|
||||||
|
return (this.tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Setter for tooltip
|
||||||
|
*******************************************************************************/
|
||||||
|
public void setTooltip(String tooltip)
|
||||||
|
{
|
||||||
|
this.tooltip = tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Fluent setter for tooltip
|
||||||
|
*******************************************************************************/
|
||||||
|
public QWidgetMetaData withTooltip(String tooltip)
|
||||||
|
{
|
||||||
|
this.tooltip = tooltip;
|
||||||
|
return (this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -216,5 +216,15 @@ public interface QWidgetMetaDataInterface extends MetaDataWithPermissionRules
|
|||||||
** Fluent setter for dropdowns
|
** Fluent setter for dropdowns
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
QWidgetMetaData withDropdown(WidgetDropdownData dropdown);
|
QWidgetMetaData withDropdown(WidgetDropdownData dropdown);
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Getter for tooltip
|
||||||
|
*******************************************************************************/
|
||||||
|
default String getTooltip()
|
||||||
|
{
|
||||||
|
return (null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import java.util.Map;
|
|||||||
** AWS Quicksite specific meta data for frontend dashboard widget
|
** AWS Quicksite specific meta data for frontend dashboard widget
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class QuickSightChartMetaData extends QWidgetMetaData implements QWidgetMetaDataInterface
|
public class QuickSightChartMetaData extends QWidgetMetaData
|
||||||
{
|
{
|
||||||
private String accessKey;
|
private String accessKey;
|
||||||
private String secretKey;
|
private String secretKey;
|
||||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.model.metadata.frontend;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.kingsrook.qqq.backend.core.actions.permissions.PermissionsHelper;
|
import com.kingsrook.qqq.backend.core.actions.permissions.PermissionsHelper;
|
||||||
@ -30,6 +31,7 @@ import com.kingsrook.qqq.backend.core.model.actions.AbstractActionInput;
|
|||||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.WidgetDropdownData;
|
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.WidgetDropdownData;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -42,6 +44,7 @@ public class QFrontendWidgetMetaData
|
|||||||
{
|
{
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String label;
|
private final String label;
|
||||||
|
private final String tooltip;
|
||||||
private final String type;
|
private final String type;
|
||||||
private final String icon;
|
private final String icon;
|
||||||
private final Integer gridColumns;
|
private final Integer gridColumns;
|
||||||
@ -54,10 +57,13 @@ public class QFrontendWidgetMetaData
|
|||||||
private boolean showReloadButton = false;
|
private boolean showReloadButton = false;
|
||||||
private boolean showExportButton = false;
|
private boolean showExportButton = false;
|
||||||
|
|
||||||
|
protected Map<String, QIcon> icons;
|
||||||
|
|
||||||
private final boolean hasPermission;
|
private final boolean hasPermission;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
// do not add setters. take values from the source-object in the constructor!! //
|
// DO add getters for all fields - this tells Jackson to include them in JSON. //
|
||||||
|
// do NOT add setters. take values from the source-object in the constructor!! //
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@ -69,6 +75,7 @@ public class QFrontendWidgetMetaData
|
|||||||
{
|
{
|
||||||
this.name = widgetMetaData.getName();
|
this.name = widgetMetaData.getName();
|
||||||
this.label = widgetMetaData.getLabel();
|
this.label = widgetMetaData.getLabel();
|
||||||
|
this.tooltip = widgetMetaData.getTooltip();
|
||||||
this.type = widgetMetaData.getType();
|
this.type = widgetMetaData.getType();
|
||||||
this.icon = widgetMetaData.getIcon();
|
this.icon = widgetMetaData.getIcon();
|
||||||
this.gridColumns = widgetMetaData.getGridColumns();
|
this.gridColumns = widgetMetaData.getGridColumns();
|
||||||
@ -82,6 +89,7 @@ public class QFrontendWidgetMetaData
|
|||||||
{
|
{
|
||||||
this.showExportButton = qWidgetMetaData.getShowExportButton();
|
this.showExportButton = qWidgetMetaData.getShowExportButton();
|
||||||
this.showReloadButton = qWidgetMetaData.getShowReloadButton();
|
this.showReloadButton = qWidgetMetaData.getShowReloadButton();
|
||||||
|
this.icons = qWidgetMetaData.getIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
hasPermission = PermissionsHelper.hasWidgetPermission(actionInput, name);
|
hasPermission = PermissionsHelper.hasWidgetPermission(actionInput, name);
|
||||||
@ -229,4 +237,26 @@ public class QFrontendWidgetMetaData
|
|||||||
{
|
{
|
||||||
return showExportButton;
|
return showExportButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Getter for icons
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public Map<String, QIcon> getIcons()
|
||||||
|
{
|
||||||
|
return icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Getter for tooltip
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public String getTooltip()
|
||||||
|
{
|
||||||
|
return tooltip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ public class QIcon
|
|||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
private String path;
|
private String path;
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -123,4 +124,36 @@ public class QIcon
|
|||||||
return (this);
|
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 QIcon withColor(String color)
|
||||||
|
{
|
||||||
|
this.color = color;
|
||||||
|
return (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user