diff --git a/README.md b/README.md index a2b4137..c759d34 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,15 @@ Version | Binary | Source | PrimeFaces Version 1.0| [Download](https://oss.sonatype.org/content/repositories/releases/org/chartistjsf/ChartistJSF/1.0/ChartistJSF-1.0.jar) | [Download](https://oss.sonatype.org/content/repositories/releases/org/chartistjsf/ChartistJSF/1.0/ChartistJSF-1.0-sources.jar) | 5.x ##### Maven +PrimeFaces 7.x +```xml + + org.chartistjsf + ChartistJSF + 4.0 + +``` + PrimeFaces 6.x ```xml diff --git a/pom.xml b/pom.xml index cf48185..8443307 100644 --- a/pom.xml +++ b/pom.xml @@ -1,18 +1,22 @@ - - + 4.0.0 org.chartistjsf ChartistJSF jar - 3.0 + 4.0-SNAPSHOT ChartistJSF Highly Customizable Responsive Charts for JSF based on PrimeFaces http://www.chartistjsf.org @@ -84,7 +88,7 @@ org.primefaces primefaces - 6.0 + 7.0 provided @@ -131,7 +135,8 @@ - + org.apache.maven.plugins maven-source-plugin @@ -146,31 +151,30 @@ - + org.apache.maven.plugins maven-javadoc-plugin - 2.10.1 - - 1.8 - true - true - ChartistJSF API documentation - - https://docs.oracle.com/javaee/7/api/ - - + 3.1.0 attach-javadocs jar + + + 8 + + none + - + org.sonatype.plugins nexus-staging-maven-plugin @@ -190,7 +194,8 @@ release - + org.apache.maven.plugins maven-gpg-plugin diff --git a/src/main/java/org/chartistjsf/component/chart/ChartRenderer.java b/src/main/java/org/chartistjsf/component/chart/ChartRenderer.java index e4888e9..795ea42 100644 --- a/src/main/java/org/chartistjsf/component/chart/ChartRenderer.java +++ b/src/main/java/org/chartistjsf/component/chart/ChartRenderer.java @@ -95,8 +95,8 @@ protected void encodeScript(FacesContext context, Chart chart) throws IOExceptio BaseChartistRenderer chartistRenderer = CHART_RENDERERS.get(type); String clientId = chart.getClientId(context); - startScript(writer, clientId); - + writer.startElement("script", chart); + writer.writeAttribute("type", "text/javascript", null); writer.write("$(function(){"); writer.write("ChartistJSF.cw('Chart','" + chart.resolveWidgetVar() + "',{"); writer.write("id:'" + clientId + "'"); @@ -107,7 +107,6 @@ protected void encodeScript(FacesContext context, Chart chart) throws IOExceptio chartistRenderer.render(context, chart); encodeClientBehaviors(context, chart); writer.write("});});"); - - endScript(writer); + writer.endElement("script"); } } diff --git a/src/main/java/org/chartistjsf/component/chart/renderer/BarRenderer.java b/src/main/java/org/chartistjsf/component/chart/renderer/BarRenderer.java index bca078b..d7d61ea 100644 --- a/src/main/java/org/chartistjsf/component/chart/renderer/BarRenderer.java +++ b/src/main/java/org/chartistjsf/component/chart/renderer/BarRenderer.java @@ -13,7 +13,7 @@ import org.chartistjsf.model.chart.AxisType; import org.chartistjsf.model.chart.BarChartModel; import org.chartistjsf.model.chart.ChartSeries; -import org.primefaces.util.ComponentUtils; +import org.primefaces.util.EscapeUtils; public class BarRenderer extends BaseChartistRenderer { @@ -37,7 +37,7 @@ protected void encodeData(FacesContext context, Chart chart) throws IOException Object label = labelsItr.next(); if (label instanceof String) - writer.write("\"" + ComponentUtils.escapeText(label.toString()) + "\""); + writer.write("\"" + EscapeUtils.forJavaScript(label.toString()) + "\""); else writer.write(label.toString()); @@ -51,7 +51,7 @@ protected void encodeData(FacesContext context, Chart chart) throws IOException for (Iterator it = model.getSeries().iterator(); it.hasNext();) { ChartSeries series = it.next(); writer.write("{"); - writer.write("name:\"" + ComponentUtils.escapeText(series.getName()) + "\""); + writer.write("name:\"" + EscapeUtils.forJavaScript(series.getName()) + "\""); writer.write(", data:["); for (Iterator numbersIter = series.getData().iterator(); numbersIter.hasNext();) { Number number = numbersIter.next(); @@ -93,10 +93,10 @@ protected void encodeOptions(FacesContext context, Chart chart) throws IOExcepti } } if (model.getWidth() != null) - writer.write(",width:\"" + ComponentUtils.escapeText(model.getWidth()) + "\""); + writer.write(",width:\"" + EscapeUtils.forJavaScript(model.getWidth()) + "\""); if (model.getHeight() != null) - writer.write(",height:\"" + ComponentUtils.escapeText(model.getHeight()) + "\""); + writer.write(",height:\"" + EscapeUtils.forJavaScript(model.getHeight()) + "\""); writer.write(",seriesBarDistance:" + model.getSeriesBarDistance()); writer.write(",stackBars:" + model.isStackBars()); diff --git a/src/main/java/org/chartistjsf/component/chart/renderer/LineRenderer.java b/src/main/java/org/chartistjsf/component/chart/renderer/LineRenderer.java index 3b789df..f4def00 100644 --- a/src/main/java/org/chartistjsf/component/chart/renderer/LineRenderer.java +++ b/src/main/java/org/chartistjsf/component/chart/renderer/LineRenderer.java @@ -13,7 +13,7 @@ import org.chartistjsf.model.chart.AxisType; import org.chartistjsf.model.chart.ChartSeries; import org.chartistjsf.model.chart.LineChartModel; -import org.primefaces.util.ComponentUtils; +import org.primefaces.util.EscapeUtils; public class LineRenderer extends BaseChartistRenderer { @@ -36,7 +36,7 @@ protected void encodeData(FacesContext context, Chart chart) throws IOException Object label = labelsItr.next(); if (label instanceof String) - writer.write("\"" + ComponentUtils.escapeText(label.toString()) + "\""); + writer.write("\"" + EscapeUtils.forJavaScript(label.toString()) + "\""); else writer.write(label != null ? label.toString() : ""); @@ -50,7 +50,7 @@ protected void encodeData(FacesContext context, Chart chart) throws IOException for (Iterator it = model.getSeries().iterator(); it.hasNext();) { ChartSeries series = it.next(); writer.write("{"); - writer.write("name:\"" + ComponentUtils.escapeText(series.getName()) + "\""); + writer.write("name:\"" + EscapeUtils.forJavaScript(series.getName()) + "\""); writer.write(", data:["); for (Iterator numbersIter = series.getData().iterator(); numbersIter.hasNext();) { Number number = numbersIter.next(); @@ -93,10 +93,10 @@ protected void encodeOptions(FacesContext context, Chart chart) throws IOExcepti } if (model.getWidth() != null) - writer.write(",width:\"" + ComponentUtils.escapeText(model.getWidth()) + "\""); + writer.write(",width:\"" + EscapeUtils.forJavaScript(model.getWidth()) + "\""); if (model.getHeight() != null) - writer.write(",height:\"" + ComponentUtils.escapeText(model.getHeight()) + "\""); + writer.write(",height:\"" + EscapeUtils.forJavaScript(model.getHeight()) + "\""); writer.write(",showLine:" + model.isShowLine()); writer.write(",showPoint:" + model.isShowPoint()); diff --git a/src/main/java/org/chartistjsf/component/chart/renderer/PieRenderer.java b/src/main/java/org/chartistjsf/component/chart/renderer/PieRenderer.java index 085b177..070d80d 100644 --- a/src/main/java/org/chartistjsf/component/chart/renderer/PieRenderer.java +++ b/src/main/java/org/chartistjsf/component/chart/renderer/PieRenderer.java @@ -8,7 +8,7 @@ import org.chartistjsf.component.chart.Chart; import org.chartistjsf.model.chart.PieChartModel; -import org.primefaces.util.ComponentUtils; +import org.primefaces.util.EscapeUtils; public class PieRenderer extends BaseChartistRenderer { @@ -25,7 +25,7 @@ protected void encodeData(FacesContext context, Chart chart) throws IOException Object label = labelsItr.next(); if (label instanceof String) - writer.write("\"" + ComponentUtils.escapeText(label.toString()) + "\""); + writer.write("\"" + EscapeUtils.forJavaScript(label.toString()) + "\""); else writer.write(label !=null?label.toString():""); @@ -69,10 +69,10 @@ protected void encodeOptions(FacesContext context, Chart chart) throws IOExcepti writer.write(",showLabel:" + model.isShowLabel()); writer.write(",labelOffset:" + model.getLabelOffset()); if (model.getWidth() != null) - writer.write(",width:\"" + ComponentUtils.escapeText(model.getWidth()) + "\""); + writer.write(",width:\"" + EscapeUtils.forJavaScript(model.getWidth()) + "\""); if (model.getHeight() != null) - writer.write(",height:\"" + ComponentUtils.escapeText(model.getHeight()) + "\""); + writer.write(",height:\"" + EscapeUtils.forJavaScript(model.getHeight()) + "\""); if (model.getLabelInterpolationFnc() != null && !model.getLabelInterpolationFnc().equals("")) writer.write(", labelInterpolationFnc: " + model.getLabelInterpolationFnc());