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

chore: bump maven-gpg-plugin from 1.6 to 3.0.1 #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.vaadin.flow.component.ComponentUtil;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.charts.model.AbstractConfigurationObject;
import com.vaadin.flow.component.charts.model.Global;
import com.vaadin.flow.component.charts.model.Lang;
import com.vaadin.flow.component.charts.model.style.Theme;
import com.vaadin.flow.component.charts.util.ChartSerialization;
Expand All @@ -25,6 +26,7 @@ public class ChartOptions extends AbstractConfigurationObject {
@JsonUnwrapped
private Theme theme;
private Lang lang;
private Global global;
private transient JreJsonFactory jsonFactory;

protected ChartOptions() {
Expand Down Expand Up @@ -94,6 +96,30 @@ public void setTheme(Theme theme) {
updateOptions();
}

/**
* Returns the {@link Global} in use or {@code null} if no global configuration
* has been set.
*
* @return the {@link Global} in use or {@code null}.
*/
public Global getGlobal() {
return global;
}

/**
* Changes the Global params of all charts.
* <p/>
* Note that if the view is already drawn, all existing {@link Chart}s will
* be redrawn.
*
* @param global
*/
public void setGlobal(Global global) {
this.global = global;
updateOptions();
}


/**
* Returns a ChartOptions instance for the given UI. If a ChartOptions
* extension has not yet been added, a new one is created and added.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.charts.model.Global;
import com.vaadin.flow.component.charts.model.Lang;
import com.vaadin.flow.component.charts.util.ChartSerialization;
import org.mockito.junit.MockitoJUnitRunner;
Expand Down Expand Up @@ -84,4 +85,34 @@ public void toJSON_LangWithFinnishLocale_LocaleSerialized_Days()

Assert.assertArrayEquals(fiDays, chartOptions.getLang().getWeekdays());
}

@Test
public void toJSON_GlobalWithoutUTC()
throws IOException {
final Global noUTC = new Global();
noUTC.setUseUTC(false);

options.setGlobal(noUTC);
String json = toJSON(options);

ObjectMapper om = ChartSerialization.createObjectMapper();
ChartOptions chartOptions = om.readValue(json, ChartOptions.class);

Assert.assertFalse(chartOptions.getGlobal().getUseUTC());
}

@Test
public void toJSON_GlobalWithUTC()
throws IOException {
final Global withUTC = new Global();
withUTC.setUseUTC(true);

options.setGlobal(withUTC);
String json = toJSON(options);

ObjectMapper om = ChartSerialization.createObjectMapper();
ChartOptions chartOptions = om.readValue(json, ChartOptions.class);

Assert.assertTrue(chartOptions.getGlobal().getUseUTC());
}
}