Commit b4a48638 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

Cleaned up branch "single_config" a bit and added TODOs.

- Moved all config classes to package "org.vadere.util.config".
- Renamed:
  * "ExperimentalResources" to "VadereConfig".
  * "ConfigurationSection" to "IConfigSection".
  * "INIConfigurationSection" to "IniConfigSection".
- Revised "config.ini" (renamed keys and deleted unnecessary keys).
parent 415d81b2
Obstacle.color=#000000
Target.color=#00FF00
Source.color=#00FFFF
Pedestrian.color=#0000FF
Density.measurementscale=10.0
Density.measurementradius=15
Density.standardderivation=0.5
Pedestrian.Radius=0.195
Toolbar.size=40
Logo.show=false
SettingsDialog.maxNumberOfTargets=10
SettingsDialog.dataFormat=yyyy_MM_dd_HH_mm_ss
SettingsDialog.outputDirectory.path=.
SettingsDialog.snapshotDirectory.path=.
ProjectView.icon.height.value=35
ProjectView.icon.width.value=35
ProjectView.cellWidth=1.0
ProjectView.minCellWidth=0.01
ProjectView.maxCellWidth=10.0
PostVis.SVGWidth=1024
PostVis.SVGHeight=768
PostVis.maxNumberOfSaveDirectories=5
PostVis.maxFramePerSecond=30
PostVis.framesPerSecond=5
PostVis.cellWidth=1.0
PostVis.minCellWidth=0.01
PostVis.maxCellWidth=10.0
PostVis.enableJsonInformationPanel=true
#generate_high_resolution_image = Generate High Resolution Image
ImageSizeDialog.title=Image size
ImageSizeDialog.lblWidth.text=Width
ImageSizeDialog.lblHeight.text=Height
\ No newline at end of file
TopographyCreator.dotRadius=0.5
\ No newline at end of file
...@@ -383,3 +383,7 @@ RunScenarioNotReadyToRun.text=One or more of the selected scenarios isn't ready ...@@ -383,3 +383,7 @@ RunScenarioNotReadyToRun.text=One or more of the selected scenarios isn't ready
ActionEditScenarioDescription.menu.title=Edit description ActionEditScenarioDescription.menu.title=Edit description
Data.TrajectoryOrScenarioFile.NoData.text=No trajectory or scenario file found. Data.TrajectoryOrScenarioFile.NoData.text=No trajectory or scenario file found.
ImageSizeDialog.title=Image size
ImageSizeDialog.lblWidth.text=Width
ImageSizeDialog.lblHeight.text=Height
\ No newline at end of file
...@@ -377,3 +377,7 @@ RunScenarioNotReadyToRun.text=Eines oder mehrere der ausgew\u00e4hlten Szenario ...@@ -377,3 +377,7 @@ RunScenarioNotReadyToRun.text=Eines oder mehrere der ausgew\u00e4hlten Szenario
ActionEditScenarioDescription.menu.title=Beschreibung bearbeiten ActionEditScenarioDescription.menu.title=Beschreibung bearbeiten
Data.TrajectoryOrScenarioFile.NoData.text=Keine Trajektorien- oder Szenario-Datei gefunden. Data.TrajectoryOrScenarioFile.NoData.text=Keine Trajektorien- oder Szenario-Datei gefunden.
ImageSizeDialog.title=Bildgr\u00f6\u00dfe
ImageSizeDialog.lblWidth.text=Breite
ImageSizeDialog.lblHeight.text=H\u00f6he
\ No newline at end of file
package org.vadere.gui.components.control.simulation; package org.vadere.gui.components.control.simulation;
import org.apache.commons.configuration2.Configuration;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Messages; import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.components.view.SimulationRenderer; import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.onlinevisualization.view.IRendererChangeListener; import org.vadere.gui.onlinevisualization.view.IRendererChangeListener;
import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.ImageGenerator; import org.vadere.gui.postvisualization.utils.ImageGenerator;
import org.vadere.gui.postvisualization.view.ImageSizeDialog; import org.vadere.gui.postvisualization.view.ImageSizeDialog;
import org.vadere.util.config.VadereConfig;
import org.vadere.util.logging.Logger; import org.vadere.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.prefs.Preferences;
import javax.imageio.ImageIO;
import javax.swing.*;
public class ActionGeneratePNG extends AbstractAction implements IRendererChangeListener { public class ActionGeneratePNG extends AbstractAction implements IRendererChangeListener {
private static Logger logger = Logger.getLogger(ActionGeneratePNG.class); private static Logger logger = Logger.getLogger(ActionGeneratePNG.class);
private static Resources resources = Resources.getInstance("global"); private static final Configuration CONFIG = VadereConfig.getConfig();
private ImageGenerator generator; private ImageGenerator generator;
private final SimulationModel<? extends DefaultSimulationConfig> model; private final SimulationModel<? extends DefaultSimulationConfig> model;
...@@ -41,10 +41,10 @@ public class ActionGeneratePNG extends AbstractAction implements IRendererChange ...@@ -41,10 +41,10 @@ public class ActionGeneratePNG extends AbstractAction implements IRendererChange
ImageSizeDialog imageSizeDialog = new ImageSizeDialog(model); ImageSizeDialog imageSizeDialog = new ImageSizeDialog(model);
if (imageSizeDialog.getState() == ImageSizeDialog.State.Ok) { if (imageSizeDialog.getState() == ImageSizeDialog.State.Ok) {
JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("SettingsDialog.snapshotDirectory.path", ".")); JFileChooser fileChooser = new JFileChooser(VadereConfig.getConfig().getString("SettingsDialog.snapshotDirectory.path", "."));
Date todaysDate = new java.util.Date(); Date todaysDate = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("SettingsDialog.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(CONFIG.getString("SettingsDialog.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
......
...@@ -4,24 +4,21 @@ package org.vadere.gui.components.control.simulation; ...@@ -4,24 +4,21 @@ package org.vadere.gui.components.control.simulation;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Messages; import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.components.view.SimulationRenderer; import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.onlinevisualization.view.IRendererChangeListener; import org.vadere.gui.onlinevisualization.view.IRendererChangeListener;
import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.SVGGenerator; import org.vadere.gui.postvisualization.utils.SVGGenerator;
import org.vadere.util.config.VadereConfig;
import org.vadere.util.logging.Logger; import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.prefs.Preferences;
import javax.swing.*;
public class ActionGenerateSVG extends AbstractAction implements IRendererChangeListener { public class ActionGenerateSVG extends AbstractAction implements IRendererChangeListener {
private static Logger logger = Logger.getLogger(ActionGenerateSVG.class); private static Logger logger = Logger.getLogger(ActionGenerateSVG.class);
private static Resources resources = Resources.getInstance("global");
private final SVGGenerator svgGenerator; private final SVGGenerator svgGenerator;
private final SimulationModel<? extends DefaultSimulationConfig> model; private final SimulationModel<? extends DefaultSimulationConfig> model;
...@@ -35,10 +32,10 @@ public class ActionGenerateSVG extends AbstractAction implements IRendererChange ...@@ -35,10 +32,10 @@ public class ActionGenerateSVG extends AbstractAction implements IRendererChange
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Date todaysDate = new java.util.Date(); Date todaysDate = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("SettingsDialog.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(VadereConfig.getConfig().getString("SettingsDialog.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("SettingsDialog.snapshotDirectory.path", ".")); JFileChooser fileChooser = new JFileChooser(VadereConfig.getConfig().getString("SettingsDialog.snapshotDirectory.path", "."));
File outputFile = new File(Messages.getString("FileDialog.filenamePrefix") + formattedDate + ".svg"); File outputFile = new File(Messages.getString("FileDialog.filenamePrefix") + formattedDate + ".svg");
fileChooser.setSelectedFile(outputFile); fileChooser.setSelectedFile(outputFile);
......
package org.vadere.gui.components.control.simulation; package org.vadere.gui.components.control.simulation;
import org.apache.commons.configuration2.Configuration;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Messages; import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.components.view.SimulationRenderer; import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.onlinevisualization.view.IRendererChangeListener; import org.vadere.gui.onlinevisualization.view.IRendererChangeListener;
import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.TikzGenerator; import org.vadere.gui.postvisualization.utils.TikzGenerator;
import org.vadere.util.config.VadereConfig;
import org.vadere.util.logging.Logger; import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.prefs.Preferences;
import javax.swing.*;
public class ActionGenerateTikz extends AbstractAction implements IRendererChangeListener { public class ActionGenerateTikz extends AbstractAction implements IRendererChangeListener {
private static Logger logger = Logger.getLogger(ActionGenerateTikz.class); private static Logger logger = Logger.getLogger(ActionGenerateTikz.class);
private static Resources resources = Resources.getInstance("global"); private static final Configuration CONFIG = VadereConfig.getConfig();
private final TikzGenerator tikzGenerator; private final TikzGenerator tikzGenerator;
private final SimulationModel<? extends DefaultSimulationConfig> model; private final SimulationModel<? extends DefaultSimulationConfig> model;
...@@ -35,10 +35,10 @@ public class ActionGenerateTikz extends AbstractAction implements IRendererChang ...@@ -35,10 +35,10 @@ public class ActionGenerateTikz extends AbstractAction implements IRendererChang
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Date todaysDate = new Date(); Date todaysDate = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("SettingsDialog.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(CONFIG.getString("SettingsDialog.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("SettingsDialog.snapshotDirectory.path", ".")); JFileChooser fileChooser = new JFileChooser(VadereConfig.getConfig().getString("SettingsDialog.snapshotDirectory.path", "."));
File outputFile = new File(Messages.getString("FileDialog.filenamePrefix") + formattedDate + ".tex"); File outputFile = new File(Messages.getString("FileDialog.filenamePrefix") + formattedDate + ".tex");
fileChooser.setSelectedFile(outputFile); fileChooser.setSelectedFile(outputFile);
......
package org.vadere.gui.components.control.simulation; package org.vadere.gui.components.control.simulation;
import java.awt.event.ActionEvent; import org.apache.commons.configuration2.Configuration;
import java.io.File;
import java.util.prefs.Preferences;
import javax.swing.JFileChooser;
import javax.swing.JTextField;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Resources; import org.vadere.util.config.VadereConfig;
import org.vadere.gui.postvisualization.PostVisualisation;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.io.File;
public class ActionSetSnapshotDirectory extends ActionVisualization { public class ActionSetSnapshotDirectory extends ActionVisualization {
private static Resources resources = Resources.getInstance("postvisualization"); private static final Configuration CONFIG = VadereConfig.getConfig();
private final JTextField textField; private final JTextField textField;
...@@ -25,14 +22,14 @@ public class ActionSetSnapshotDirectory extends ActionVisualization { ...@@ -25,14 +22,14 @@ public class ActionSetSnapshotDirectory extends ActionVisualization {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final JFileChooser fc = new JFileChooser(resources.getProperty("SettingsDialog.snapshotDirectory.path")); final JFileChooser fc = new JFileChooser(CONFIG.getString("SettingsDialog.snapshotDirectory.path"));
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = fc.showOpenDialog(null); int returnVal = fc.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) { if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile(); File file = fc.getSelectedFile();
resources.setProperty("SettingsDialog.snapshotDirectory.path", file.getAbsolutePath());
Preferences.userNodeForPackage(PostVisualisation.class).put("SettingsDialog.snapshotDirectory.path", CONFIG.setProperty("SettingsDialog.snapshotDirectory.path", file.getAbsolutePath());
file.getAbsolutePath());
textField.setText(file.getAbsolutePath()); textField.setText(file.getAbsolutePath());
} }
} }
......
...@@ -6,16 +6,19 @@ import java.util.Map; ...@@ -6,16 +6,19 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.TreeMap; import java.util.TreeMap;
import org.vadere.gui.components.utils.Resources; import org.apache.commons.configuration2.Configuration;
import org.vadere.util.config.VadereConfig;
import org.vadere.util.visualization.ColorHelper; import org.vadere.util.visualization.ColorHelper;
public class DefaultSimulationConfig extends DefaultConfig { public class DefaultSimulationConfig extends DefaultConfig {
private static Resources resources = Resources.getInstance("global");
private boolean showLogo = Boolean.valueOf(resources.getProperty("Logo.show")); private static final Configuration CONFIG = VadereConfig.getConfig();
private double densityScale = Double.valueOf(resources.getProperty("Density.measurementscale"));
private double densityMeasurementRadius = Double.valueOf(resources.getProperty("Density.measurementradius")); private boolean showLogo = CONFIG.getBoolean("SettingsDialog.showLogo");
private double densityStandardDerivation = Double.valueOf(resources.getProperty("Density.standardderivation")); private double densityScale = CONFIG.getDouble("Density.measurementScale");
private double pedestrianTorso = Double.valueOf(resources.getProperty("Pedestrian.Radius")) * 2; private double densityMeasurementRadius = CONFIG.getDouble("Density.measurementRadius");
private double densityStandardDerivation = CONFIG.getDouble("Density.standardDeviation");
private double pedestrianTorso = CONFIG.getDouble("Pedestrian.radius") * 2;
private boolean useRandomPedestrianColors = false; private boolean useRandomPedestrianColors = false;
private boolean showPedestrianIds = false; private boolean showPedestrianIds = false;
...@@ -37,9 +40,9 @@ public class DefaultSimulationConfig extends DefaultConfig { ...@@ -37,9 +40,9 @@ public class DefaultSimulationConfig extends DefaultConfig {
protected final Color pedestrianDefaultColor = Color.BLUE; protected final Color pedestrianDefaultColor = Color.BLUE;
private Map<Integer, Color> pedestrianColors = new TreeMap<>(); private Map<Integer, Color> pedestrianColors = new TreeMap<>();
private Map<Integer, Color> randomColors = new HashMap<>(); private Map<Integer, Color> randomColors = new HashMap<>();
private double gridWidth = Double.valueOf(resources.getProperty("ProjectView.cellWidth")); private double gridWidth = CONFIG.getDouble("ProjectView.cellWidth");
private final double MIN_CELL_WIDTH = Double.valueOf(resources.getProperty("ProjectView.minCellWidth")); private final double MIN_CELL_WIDTH = CONFIG.getDouble("ProjectView.minCellWidth");
private final double MAX_CELL_WIDTH = Double.valueOf(resources.getProperty("ProjectView.maxCellWidth")); private final double MAX_CELL_WIDTH = CONFIG.getDouble("ProjectView.maxCellWidth");
public DefaultSimulationConfig() { public DefaultSimulationConfig() {
super(); super();
......
package org.vadere.gui.components.utils; package org.vadere.gui.components.utils;
import org.vadere.gui.projectview.VadereApplication;
import org.vadere.gui.projectview.view.ProjectView; import org.vadere.gui.projectview.view.ProjectView;
import org.vadere.util.config.VadereConfig;
import org.vadere.util.lang.BundleManager; import org.vadere.util.lang.BundleManager;
import java.util.Locale;
import java.util.prefs.Preferences;
import javax.swing.*; import javax.swing.*;
import java.util.Locale;
/** /**
* Messages class used in localization. * Messages class used in localization.
...@@ -34,7 +32,7 @@ public class Messages { ...@@ -34,7 +32,7 @@ public class Messages {
} }
public static void changeLanguage(Locale lang) { public static void changeLanguage(Locale lang) {
Preferences.userNodeForPackage(VadereApplication.class).put("language", lang.getLanguage()); VadereConfig.getConfig().setProperty("Messages.language", lang.getLanguage());
BundleManager.instance().setLanguage(lang); BundleManager.instance().setLanguage(lang);
JOptionPane.showMessageDialog(ProjectView.getMainWindow(), getString("Messages.changeLanguagePopup.text"), JOptionPane.showMessageDialog(ProjectView.getMainWindow(), getString("Messages.changeLanguagePopup.text"),
getString("Messages.changeLanguagePopup.title"), JOptionPane.INFORMATION_MESSAGE); getString("Messages.changeLanguagePopup.title"), JOptionPane.INFORMATION_MESSAGE);
......
package org.vadere.gui.components.utils; package org.vadere.gui.components.utils;
import org.apache.commons.configuration2.Configuration;
import org.jcodec.api.awt.SequenceEncoder; import org.jcodec.api.awt.SequenceEncoder;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.IRecorder; import org.vadere.gui.postvisualization.utils.IRecorder;
import org.vadere.util.config.VadereConfig;
import org.vadere.util.logging.Logger; import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
...@@ -14,21 +16,20 @@ import java.io.IOException; ...@@ -14,21 +16,20 @@ import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Observable; import java.util.Observable;
import java.util.prefs.Preferences;
import javax.swing.*;
public class Recorder implements IRecorder { public class Recorder implements IRecorder {
private static Logger logger = Logger.getLogger(Recorder.class); private static Logger logger = Logger.getLogger(Recorder.class);
private static final Configuration CONFIG = VadereConfig.getConfig();
private SequenceEncoder enc; private SequenceEncoder enc;
private static Resources resources = Resources.getInstance("global");
@Override @Override
public void startRecording() { public void startRecording() {
Date todaysDate = new java.util.Date(); Date todaysDate = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("SettingsDialog.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(CONFIG.getString("SettingsDialog.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("SettingsDialog.snapshotDirectory.path", ".")); JFileChooser fileChooser = new JFileChooser(VadereConfig.getConfig().getString("SettingsDialog.snapshotDirectory.path", "."));
File outputFile = new File("VADERE_sim_" + formattedDate + ".mov"); File outputFile = new File("VADERE_sim_" + formattedDate + ".mov");
fileChooser.setSelectedFile(outputFile); fileChooser.setSelectedFile(outputFile);
......
...@@ -2,32 +2,29 @@ package org.vadere.gui.components.view; ...@@ -2,32 +2,29 @@ package org.vadere.gui.components.view;
import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.FormLayout;
import org.apache.commons.configuration2.Configuration;
import org.vadere.gui.components.control.simulation.*; import org.vadere.gui.components.control.simulation.*;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Messages; import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.components.utils.SwingUtils; import org.vadere.gui.components.utils.SwingUtils;
import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.control.ActionCloseSettingDialog; import org.vadere.gui.postvisualization.control.ActionCloseSettingDialog;
import org.vadere.util.config.VadereConfig;
import org.vadere.util.logging.Logger; import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.prefs.Preferences;
import javax.swing.*;
/** /**
* @author Benedikt Zoennchen * @author Benedikt Zoennchen
*/ */
public class SettingsDialog extends JDialog { public class SettingsDialog extends JDialog {
private static Logger logger = Logger.getLogger(SettingsDialog.class); private static Logger logger = Logger.getLogger(SettingsDialog.class);
private static Resources resources = Resources.getInstance("global"); private static final Configuration CONFIG = VadereConfig.getConfig();
private DefaultSimulationConfig config; private DefaultSimulationConfig config;
private List<JButton> targetColorButtons; private List<JButton> targetColorButtons;
...@@ -93,7 +90,8 @@ public class SettingsDialog extends JDialog { ...@@ -93,7 +90,8 @@ public class SettingsDialog extends JDialog {
colorLayeredPane.setLayout(colorLayout); colorLayeredPane.setLayout(colorLayout);
additionalLayeredPane.setLayout(additionalLayout); additionalLayeredPane.setLayout(additionalLayout);
Integer[] colorIds = new Integer[Integer.parseInt(resources.getProperty("SettingsDialog.maxNumberOfTargets"))]; // Integer[] colorIds = new Integer[CONFIG.("SettingsDialog.maxNumberOfTargets")];
Integer[] colorIds = (Integer[])CONFIG.getArray(Integer.class, "SettingsDialog.maxNumberOfTargets");
for (int index = 1; index <= colorIds.length; index++) { for (int index = 1; index <= colorIds.length; index++) {
colorIds[index - 1] = index; colorIds[index - 1] = index;
} }
...@@ -284,8 +282,9 @@ public class SettingsDialog extends JDialog { ...@@ -284,8 +282,9 @@ public class SettingsDialog extends JDialog {
additionalLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblSnapshotDir.text") + ":"), additionalLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblSnapshotDir.text") + ":"),
cc.xy(2, 20)); cc.xy(2, 20));
JTextField tSnapshotDir = new JTextField( /* JTextField tSnapshotDir = new JTextField(