* Saves the chart properties in the map
*/
public void save() {
ChartProperties chartProperties = view.getChartProperties();
ModelPreferences modelPreferences = ModelPreferences.getInstance();
if (chartProperties.isLegendsAreVisible()) {
modelPreferences.setBoolean("viewer.general.legendsAreVisible", "true");
}
else {
modelPreferences.setBoolean("viewer.general.legendsAreVisible", "false");
}
if (chartProperties.isAutoHighlightOnLegend()) {
modelPreferences.setBoolean("viewer.general.autoHighlightOnLegend", "true");
}
else {
modelPreferences.setBoolean("viewer.general.autoHighlightOnLegend", "false");
}
modelPreferences.setInteger("viewer.general.legendsPlacement", chartProperties
.getLegendsPlacement());
modelPreferences.setInteger("viewer.general.red", chartProperties.getBackgroundColor()
.getRed());
modelPreferences.setInteger("viewer.general.green", chartProperties.getBackgroundColor()
.getGreen());
modelPreferences.setInteger("viewer.general.blue", chartProperties.getBackgroundColor()
.getBlue());
modelPreferences.setInteger("viewer.general.alpha", chartProperties.getBackgroundColor()
.getAlpha());
modelPreferences.setString("viewer.general.headerFont.name", chartProperties
.getHeaderFont().getName());
modelPreferences.setInteger("viewer.general.headerFont.size", chartProperties
.getHeaderFont().getSize());
modelPreferences.setInteger("viewer.general.headerFont.style", chartProperties
.getHeaderFont().getStyle());
modelPreferences.setString("viewer.general.labelFont.name", chartProperties.getLabelFont()
.getName());
modelPreferences.setInteger("viewer.general.labelFont.size", chartProperties.getLabelFont()
.getSize());
modelPreferences.setInteger("viewer.general.labelFont.style", chartProperties
.getLabelFont().getStyle());
modelPreferences.setString("viewer.general.title", chartProperties.getTitle());
modelPreferences.setDouble("viewer.general.displayDuration", chartProperties
.getDisplayDuration());
/*
There is no function to get/set the general grid and the style of the line
*/
modelPreferences.setDouble("viewer.xaxis.scaleMin", chartProperties.getXAxisProperties()
.getScaleMin());
modelPreferences.setDouble("viewer.xaxis.scaleMax", chartProperties.getXAxisProperties()
.getScaleMax());
modelPreferences.setInteger("viewer.xaxis.scaleMode", chartProperties.getXAxisProperties()
.getScaleMode());
if (chartProperties.getXAxisProperties().isAutoScale()) {
modelPreferences.setBoolean("viewer.xaxis.autoScale", "true");
}
else {
modelPreferences.setBoolean("viewer.xaxis.autoScale", "false");
}
if (chartProperties.getXAxisProperties().isSubGridVisible()) {
modelPreferences.setBoolean("viewer.xaxis.subGridVisible", "true");
}
else {
modelPreferences.setBoolean("viewer.xaxis.subGridVisible", "false");
}
if (chartProperties.getXAxisProperties().isDrawOpposite()) {
modelPreferences.setBoolean("viewer.xaxis.drawOpposite", "true");
}
else {
modelPreferences.setBoolean("viewer.xaxis.drawOpposite", "false");
}
if (chartProperties.getXAxisProperties().isVisible()) {
modelPreferences.setBoolean("viewer.xaxis.visible", "true");
}
else {
modelPreferences.setBoolean("viewer.xaxis.visible", "false");
}
modelPreferences.setInteger("viewer.xaxis.labelFormat", chartProperties
.getXAxisProperties().getLabelFormat());
modelPreferences.setString("viewer.xaxis.title", chartProperties.getXAxisProperties()
.getTitle());
modelPreferences.setInteger("viewer.xaxis.red", chartProperties.getXAxisProperties()
.getColor().getRed());
modelPreferences.setInteger("viewer.xaxis.green", chartProperties.getXAxisProperties()
.getColor().getGreen());
modelPreferences.setInteger("viewer.xaxis.blue", chartProperties.getXAxisProperties()
.getColor().getBlue());
modelPreferences.setInteger("viewer.xaxis.alpha", chartProperties.getXAxisProperties()
.getColor().getAlpha());
modelPreferences.setInteger("viewer.xaxis.position", chartProperties.getXAxisProperties()
.getPosition());
if (chartProperties.getY1AxisProperties().isAutoScale()) {
modelPreferences.setBoolean("viewer.y1axis.autoScale", "true");
}
else {
modelPreferences.setBoolean("viewer.y1axis.autoScale", "false");
}
if (chartProperties.getY1AxisProperties().isSubGridVisible()) {
modelPreferences.setBoolean("viewer.y1axis.subGridVisible", "true");
}
else {
modelPreferences.setBoolean("viewer.y1axis.subGridVisible", "false");
}
if (chartProperties.getY1AxisProperties().isDrawOpposite()) {
modelPreferences.setBoolean("viewer.y1axis.drawOpposite", "true");
}
else {
modelPreferences.setBoolean("viewer.y1axis.drawOpposite", "false");
}
if (chartProperties.getY1AxisProperties().isVisible()) {
modelPreferences.setBoolean("viewer.y1axis.visible", "true");
}
else {
modelPreferences.setBoolean("viewer.y1axis.visible", "false");
}
modelPreferences.setDouble("viewer.y1axis.scaleMin", chartProperties.getY1AxisProperties()
.getScaleMin());
modelPreferences.setDouble("viewer.y1axis.scaleMax", chartProperties.getY1AxisProperties()
.getScaleMax());
modelPreferences.setInteger("viewer.y1axis.scaleMode", chartProperties
.getY1AxisProperties().getScaleMode());
modelPreferences.setInteger("viewer.y1axis.labelFormat", chartProperties
.getY1AxisProperties().getLabelFormat());
modelPreferences.setString("viewer.y1axis.title", chartProperties.getY1AxisProperties()
.getTitle());
modelPreferences.setInteger("viewer.y1axis.red", chartProperties.getY1AxisProperties()
.getColor().getRed());
modelPreferences.setInteger("viewer.y1axis.green", chartProperties.getY1AxisProperties()
.getColor().getGreen());
modelPreferences.setInteger("viewer.y1axis.blue", chartProperties.getY1AxisProperties()
.getColor().getBlue());
modelPreferences.setInteger("viewer.y1axis.alpha", chartProperties.getY1AxisProperties()
.getColor().getAlpha());
modelPreferences.setInteger("viewer.y1axis.position", chartProperties.getY1AxisProperties()
.getPosition());
if (chartProperties.getY2AxisProperties().isAutoScale()) {
modelPreferences.setBoolean("viewer.y2axis.autoScale", "true");
}
else {
modelPreferences.setBoolean("viewer.y2axis.autoScale", "false");
}
if (chartProperties.getY2AxisProperties().isSubGridVisible()) {
modelPreferences.setBoolean("viewer.y2axis.subGridVisible", "true");
}
else {
modelPreferences.setBoolean("viewer.y2axis.subGridVisible", "false");
}
if (chartProperties.getY2AxisProperties().isDrawOpposite()) {
modelPreferences.setBoolean("viewer.y2axis.drawOpposite", "true");
}
else {
modelPreferences.setBoolean("viewer.y2axis.drawOpposite", "false");
}
if (chartProperties.getY2AxisProperties().isVisible()) {
modelPreferences.setBoolean("viewer.y2axis.visible", "true");
}
else {
modelPreferences.setBoolean("viewer.y2axis.visible", "false");
}
modelPreferences.setDouble("viewer.y2axis.scaleMin", chartProperties.getY2AxisProperties()
.getScaleMin());
modelPreferences.setDouble("viewer.y2axis.scaleMax", chartProperties.getY2AxisProperties()
.getScaleMax());
modelPreferences.setInteger("viewer.y2axis.scaleMode", chartProperties
.getY2AxisProperties().getScaleMode());
modelPreferences.setInteger("viewer.y2axis.labelFormat", chartProperties
.getY2AxisProperties().getLabelFormat());
modelPreferences.setString("viewer.y2axis.title", chartProperties.getY2AxisProperties()
.getTitle());
modelPreferences.setInteger("viewer.y2axis.red", chartProperties.getY2AxisProperties()
.getColor().getRed());
modelPreferences.setInteger("viewer.y2axis.green", chartProperties.getY2AxisProperties()
.getColor().getGreen());
modelPreferences.setInteger("viewer.y2axis.blue", chartProperties.getY2AxisProperties()
.getColor().getBlue());
modelPreferences.setInteger("viewer.y2axis.alpha", chartProperties.getY2AxisProperties()
.getColor().getAlpha());
modelPreferences.setInteger("viewer.y2axis.position", chartProperties.getY2AxisProperties()
.getPosition());
}