Skip to content
Snippets Groups Projects
Commit 8451d69c authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

Better file and settings management (CONTROLGUI-381)

parent bffc1f9d
No related branches found
No related tags found
No related merge requests found
......@@ -68,7 +68,7 @@ public class CometeTrendController {
colorRotationTool = new ColorUtils();
chartProperties = new ChartProperties();
chartProperties.setAutoHighlightOnLegend(true);
chartProperties.setLegendsAreVisible(true);
chartProperties.setLegendVisible(true);
chartProperties.setDisplayDuration(AbstractHistoryDataSource.DEFAULT_HISTORY_DEPTH);
refreshingPeriod = TrendFile.DEFAULT_REFRESHING_PERIOD;
......@@ -82,7 +82,7 @@ public class CometeTrendController {
public ChartProperties generateChartProperties() {
ChartProperties chartProperties = new ChartProperties();
chartProperties.setAutoHighlightOnLegend(true);
chartProperties.setLegendsAreVisible(true);
chartProperties.setLegendVisible(true);
chartProperties.setDisplayDuration(AbstractHistoryDataSource.DEFAULT_HISTORY_DEPTH);
return chartProperties;
}
......
......@@ -7,7 +7,6 @@ import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collection;
......@@ -570,11 +569,6 @@ public class TrendFile {
boolean dateVisibleConvert = convertToBoolean(dateVisibleValue, dateVisible);
setDateVisible(dateVisibleConvert);
String graphBackGroundValue = parameterMap.get(GRAPH_BACKGROUND_KEY);
// Is not used
chartProperties
.setBackgroundColor(convertToCometeColor(graphBackGroundValue, chartProperties.getBackgroundColor()));
String fitDisplayDurationValue = parameterMap.get(FIT_DISPLAY_DURATION_KEY);
boolean fitDisplayDurationConvert = convertToBoolean(fitDisplayDurationValue, fitDisplayDuration);
setFitDisplayDuration(fitDisplayDurationConvert);
......@@ -605,10 +599,10 @@ public class TrendFile {
controller.setRefreshingPeriod(refreshTimeConvert, false);
}
@SuppressWarnings("unused")
private void updateChartProperties(PrintWriter writer) {
writer.println(GRAPH_TITLE_KEY + SEPARATOR + controller.getChartProperties().getTitle());
}
// @SuppressWarnings("unused")
// private void updateChartProperties(PrintWriter writer) {
// writer.println(GRAPH_TITLE_KEY + SEPARATOR + controller.getChartProperties().getTitle());
// }
private void retrieveChartProperties(ChartProperties chartProperties) {
String title = parameterMap.get(GRAPH_TITLE_KEY);
......@@ -619,7 +613,7 @@ public class TrendFile {
String labelVisible = parameterMap.get(LABEL_VISIBLE_KEY);
boolean labelVisibleBoolean = convertToBoolean(labelVisible, true);
chartProperties.setLegendsAreVisible(labelVisibleBoolean);
chartProperties.setLegendVisible(labelVisibleBoolean);
String labelPlacement = parameterMap.get(LABEL_PLACEMENT_KEY);
int labelPlacementConvert = convertToInteger(labelPlacement, 0);
......@@ -634,6 +628,11 @@ public class TrendFile {
chartProperties.getBackgroundColor());
chartProperties.setBackgroundColor(chartBackGroundConvert);
String graphBackGround = parameterMap.get(GRAPH_BACKGROUND_KEY);
CometeColor graphBackGroundConvert = convertToCometeColor(graphBackGround,
chartProperties.getGlobalBackgroundColor());
chartProperties.setGlobalBackgroundColor(graphBackGroundConvert);
String displayDuration = parameterMap.get(DISPLAY_DURATION_KEY);
double displayConvert = convertToDouble(displayDuration, 0);
chartProperties.setDisplayDuration(displayConvert);
......@@ -659,53 +658,56 @@ public class TrendFile {
AxisProperties axisProperties = getAxisProperties(axisPrefix, chartProperties);
if (axisProperties != null) {
String axis = axisPrefix.toString();
// get visible key
String visibleValue = parameterMap.get(axisPrefix.toString() + VISIBLE_KEY);
String visibleValue = parameterMap.get(axis + VISIBLE_KEY);
boolean axisVisible = convertToBoolean(visibleValue, true);
axisProperties.setVisible(axisVisible);
String gridKey = parameterMap.get(axisPrefix.toString() + GRID_KEY);
String gridKey = parameterMap.get(axis + GRID_KEY);
boolean gridConvert = convertToBoolean(gridKey, false);
axisProperties.setGridVisible(gridConvert);
String subgridAxis = parameterMap.get(axisPrefix.toString() + SUBGRID_KEY);
String subgridAxis = parameterMap.get(axis + SUBGRID_KEY);
boolean subgridAxisConvert = convertToBoolean(subgridAxis, false);
axisProperties.setSubGridVisible(subgridAxisConvert);
String gridStyleAxis = parameterMap.get(axisPrefix.toString() + GRID_STYLE_KEY);
String gridStyleAxis = parameterMap.get(axis + GRID_STYLE_KEY);
int gridStyleConvertToInteger = convertToInteger(gridStyleAxis, 0);
axisProperties.setGridStyle(gridStyleConvertToInteger);
String minAxis = parameterMap.get(axisPrefix.toString() + MIN_KEY);
String minAxis = parameterMap.get(axis + MIN_KEY);
double minConvert = convertToDouble(minAxis, 0);
axisProperties.setScaleMin(minConvert);
String maxAxis = parameterMap.get(axisPrefix.toString() + MAX_KEY);
String maxAxis = parameterMap.get(axis + MAX_KEY);
double maxConvert = convertToDouble(maxAxis, 0);
axisProperties.setScaleMax(maxConvert);
String autoscaleAxis = parameterMap.get(axisPrefix.toString() + AUTOSCALE_KEY);
String autoscaleAxis = parameterMap.get(axis + AUTOSCALE_KEY);
boolean autoScaleAxisConvert = convertToBoolean(autoscaleAxis, true);
axisProperties.setAutoScale(autoScaleAxisConvert);
String scale = parameterMap.get(axisPrefix.toString() + SCALE_KEY);
String scale = parameterMap.get(axis + SCALE_KEY);
int scaleConvert = convertToInteger(scale, 0);
axisProperties.setScaleMode(scaleConvert);
String labelFormat = parameterMap.get(axisPrefix.toString() + FORMAT_KEY);
String labelFormat = parameterMap.get(axis + FORMAT_KEY);
int labelFormatConvert = convertToInteger(labelFormat, 0);
axisProperties.setLabelFormat(labelFormatConvert);
String titleAxis = parameterMap.get(axisPrefix.toString() + TITLE_KEY);
String titleAxis = parameterMap.get(axis + TITLE_KEY);
String titleAxisConvert = convertToTitle(titleAxis);
if (titleAxis != null) {
axisProperties.setTitle(titleAxisConvert);
}
String colorAxis = parameterMap.get(axisPrefix.toString() + COLOR_KEY);
String colorAxis = parameterMap.get(axis + COLOR_KEY);
CometeColor colorAxisConvert = convertToCometeColor(colorAxis, axisProperties.getColor());
axisProperties.setColor(colorAxisConvert);
String labelFont = parameterMap.get(axis + LABEL_FONT_KEY);
CometeFont labelFontConvert = convertToCometeFont(labelFont);
axisProperties.setLabelFont(labelFontConvert);
}
}
......@@ -1115,7 +1117,7 @@ public class TrendFile {
System.out.println(TITLE_FONT_KEY + "=" + controller.getChartProperties().getHeaderFont());
System.out.println(LABEL_FONT_KEY + "=" + controller.getChartProperties().getLabelFont());
System.out.println(LABEL_PLACEMENT_KEY + "=" + controller.getChartProperties().getLegendsPlacement());
System.out.println(LABEL_VISIBLE_KEY + "=" + controller.getChartProperties().isLegendsAreVisible());
System.out.println(LABEL_VISIBLE_KEY + "=" + controller.getChartProperties().isLegendVisible());
System.out.println(DISPLAY_DURATION_KEY + "=" + controller.getChartProperties().getDisplayDuration());
System.out.println(PRECISION_KEY + "=" + controller.getChartProperties().getTimePrecision());
......@@ -1135,7 +1137,7 @@ public class TrendFile {
System.out.println(SCALE_KEY + "=" + axisProperties.getScaleMode());
System.out.println(FORMAT_KEY + "=" + axisProperties.getLabelFormat());
System.out.println(COLOR_KEY + "=" + axisProperties.getColor());
System.out.println(LABEL_FONT_KEY + "=" + axisProperties.getLabelFont());
}
System.out.println("*****key list Properties****");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment