diff options
author | 2020-05-18 15:17:41 +0000 | |
---|---|---|
committer | 2020-05-18 15:17:41 +0000 | |
commit | 45505117ccea62c60cd57df471a757c77749671f (patch) | |
tree | 79feb9ec88278406c70c538c20278bdb45f7f708 /ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view | |
parent | 4c8ce62291707a0cb10d5b599d87e6c7dd6bfd9f (diff) | |
parent | 759e9e75fc0b5978f98f901744c87c0c8d5ef4fd (diff) |
Merge "Raptor backend java API Code(Analytics), UI Code(Overlay) and pages component in os project"
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/HtmlFormatter.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/HtmlFormatter.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/HtmlFormatter.java index ed5276b7..7b5f548b 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/HtmlFormatter.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/HtmlFormatter.java @@ -37,8 +37,11 @@ */ package org.onap.portalsdk.analytics.view; +import org.json.JSONObject; import org.onap.portalsdk.analytics.RaptorObject; +import com.google.gson.JsonObject; + public class HtmlFormatter extends RaptorObject { private boolean bold = false; @@ -173,6 +176,28 @@ public class HtmlFormatter extends RaptorObject { return sb.toString(); } // generateStyleHtml + + public String generateJsonHtmlStyle() { + JSONObject style = new JSONObject(); + if (isBold()) + style.put("font-weight", "bold"); + if (isItalic()) + style.put("font-style", "italic"); + if (isUnderline()) + style.put("text-decoration", "underline"); + if(getBgColor().length()>0) + style.put("background-color", getBgColor()); + if (getFontColor().length() > 0) + style.put("color", getFontColor()); + if (getFontFace().length() > 0) + style.put("font-family", getFontFace()); + if (getFontSize().length() > 0) + style.put("font-size", getFontSize() + "px"); + if (getAlignment().length() > 0) + style.put("text-align",getAlignment()); + return style.toString(); + } + public String generateStyleForZK() { StringBuffer sb = new StringBuffer(); @@ -197,9 +222,9 @@ public class HtmlFormatter extends RaptorObject { } // generateStyleHtml public String formatValue(String value) { - String style = generateStyleHtml(); + String style = generateJsonHtmlStyle(); if (style.length() > 0) - return "<font" + style + ">" + value + "</font>"; + return style; else return value; } // formatValue |