mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-20 06:00:44 +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.Map;
|
||||
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;
|
||||
|
||||
|
||||
@ -40,6 +41,7 @@ public class QWidgetMetaData implements QWidgetMetaDataInterface
|
||||
protected String name;
|
||||
protected String icon;
|
||||
protected String label;
|
||||
protected String tooltip;
|
||||
protected String type;
|
||||
protected String minHeight;
|
||||
protected String footerHTML;
|
||||
@ -55,6 +57,8 @@ public class QWidgetMetaData implements QWidgetMetaDataInterface
|
||||
private boolean showReloadButton = true;
|
||||
private boolean showExportButton = true;
|
||||
|
||||
protected Map<String, QIcon> icons;
|
||||
|
||||
protected Map<String, Serializable> defaultValues = new LinkedHashMap<>();
|
||||
|
||||
|
||||
@ -594,4 +598,81 @@ public class QWidgetMetaData implements QWidgetMetaDataInterface
|
||||
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
|
||||
*******************************************************************************/
|
||||
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
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class QuickSightChartMetaData extends QWidgetMetaData implements QWidgetMetaDataInterface
|
||||
public class QuickSightChartMetaData extends QWidgetMetaData
|
||||
{
|
||||
private String accessKey;
|
||||
private String secretKey;
|
||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.model.metadata.frontend;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
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.QWidgetMetaDataInterface;
|
||||
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 label;
|
||||
private final String tooltip;
|
||||
private final String type;
|
||||
private final String icon;
|
||||
private final Integer gridColumns;
|
||||
@ -54,10 +57,13 @@ public class QFrontendWidgetMetaData
|
||||
private boolean showReloadButton = false;
|
||||
private boolean showExportButton = false;
|
||||
|
||||
protected Map<String, QIcon> icons;
|
||||
|
||||
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.label = widgetMetaData.getLabel();
|
||||
this.tooltip = widgetMetaData.getTooltip();
|
||||
this.type = widgetMetaData.getType();
|
||||
this.icon = widgetMetaData.getIcon();
|
||||
this.gridColumns = widgetMetaData.getGridColumns();
|
||||
@ -82,6 +89,7 @@ public class QFrontendWidgetMetaData
|
||||
{
|
||||
this.showExportButton = qWidgetMetaData.getShowExportButton();
|
||||
this.showReloadButton = qWidgetMetaData.getShowReloadButton();
|
||||
this.icons = qWidgetMetaData.getIcons();
|
||||
}
|
||||
|
||||
hasPermission = PermissionsHelper.hasWidgetPermission(actionInput, name);
|
||||
@ -229,4 +237,26 @@ public class QFrontendWidgetMetaData
|
||||
{
|
||||
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 path;
|
||||
private String color;
|
||||
|
||||
|
||||
|
||||
@ -123,4 +124,36 @@ public class QIcon
|
||||
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