Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to primeface 7x #30

Merged
merged 5 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<dependency>
<groupId>org.chartistjsf</groupId>
<artifactId>ChartistJSF</artifactId>
<version>4.0</version>
</dependency>
```

PrimeFaces 6.x
```xml
<dependency>
Expand Down
53 changes: 29 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under
the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
you under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.chartistjsf</groupId>
<artifactId>ChartistJSF</artifactId>
<packaging>jar</packaging>
<version>3.0</version>
<version>4.0-SNAPSHOT</version>
<name>ChartistJSF</name>
<description>Highly Customizable Responsive Charts for JSF based on PrimeFaces</description>
<url>http://www.chartistjsf.org</url>
Expand Down Expand Up @@ -84,7 +88,7 @@
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
<version>7.0</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -131,7 +135,8 @@
</configuration>
</plugin>

<!-- Configure the jar with the sources (or rather, convince Maven that we want sources at all) -->
<!-- Configure the jar with the sources (or rather, convince Maven that
we want sources at all) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand All @@ -146,31 +151,30 @@
</executions>
</plugin>

<!-- Configure the jar with the javadoc (or rather, convince Maven that we want javadoc at all) -->
<!-- Configure the jar with the javadoc (or rather, convince Maven that
we want javadoc at all) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<javadocVersion>1.8</javadocVersion>
<notimestamp>true</notimestamp>
<splitindex>true</splitindex>
<doctitle>ChartistJSF API documentation</doctitle>
<links>
<link>https://docs.oracle.com/javaee/7/api/</link>
</links>
</configuration>
<version>3.1.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<!-- Fix for https://bugs.openjdk.java.net/browse/JDK-8212233 -->
<source>8</source>
<!-- Turn off doclint in JDK 8 because it errors instead of warns -->
<doclint>none</doclint>
</configuration>
</execution>
</executions>
</plugin>

<!-- Deploying is done via sonatype's Nexus Snapshot deploy: mvn clean deploy Release deploy: mvn clean deploy -P release -->
<!-- Deploying is done via sonatype's Nexus Snapshot deploy: mvn clean
deploy Release deploy: mvn clean deploy -P release -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
Expand All @@ -190,7 +194,8 @@
<id>release</id>
<build>
<plugins>
<!-- Signing with GPG is a requirement for a release deployment (to Maven central) -->
<!-- Signing with GPG is a requirement for a release deployment (to
Maven central) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "'");
Expand All @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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());

Expand All @@ -51,7 +51,7 @@ protected void encodeData(FacesContext context, Chart chart) throws IOException
for (Iterator<ChartSeries> 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<Number> numbersIter = series.getData().iterator(); numbersIter.hasNext();) {
Number number = numbersIter.next();
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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() : "");

Expand All @@ -50,7 +50,7 @@ protected void encodeData(FacesContext context, Chart chart) throws IOException
for (Iterator<ChartSeries> 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<Number> numbersIter = series.getData().iterator(); numbersIter.hasNext();) {
Number number = numbersIter.next();
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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():"");

Expand Down Expand Up @@ -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());
Expand Down