package dasherJava.core.settings;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class SettingsFileReader {
public static Settings readSettingsFile(String fileName) throws IOException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName),
StandardCharsets.UTF_8))) {
Map<String, String> settingsLines = new HashMap<>();
String line;
while ((line=reader.readLine())!=null) { //read and store all lines
String[] parts = line.split("=", 2);
if (parts.length!=2) {
System.out.println("SettingsFileReader: Ignoring invalid input line \""+line
+"\". Lines must be of the form \"key=value\"");
continue;
}
if (settingsLines.containsKey(parts[0]))
System.out.println("SettingsFileReader: Duplicate definition of the \""+parts[0]
+"\" setting, overwriting the previous value");
settingsLines.put(parts[0], parts[1]);
}
int frameRate = Settings.DEFAULT_SETTINGS.getFrameRate();
String antialiasing = Settings.DEFAULT_SETTINGS.getAntialiasing();
String textAntialiasing = Settings.DEFAULT_SETTINGS.getTextAntialiasing();
int windowX = Settings.DEFAULT_SETTINGS.getWindowX();
int windowY = Settings.DEFAULT_SETTINGS.getWindowY();
int windowWidth = Settings.DEFAULT_SETTINGS.getWindowWidth();
int windowHeight = Settings.DEFAULT_SETTINGS.getWindowHeight();
int spaceBehindNodes = Settings.DEFAULT_SETTINGS.getSpaceBehindNodes();
String windowAlwaysOnTop = Settings.DEFAULT_SETTINGS.getWindowAlwaysOnTop();
String windowUnfocusable = Settings.DEFAULT_SETTINGS.getWindowUnfocusable();
boolean rememberWindowPosition = Settings.DEFAULT_SETTINGS.getRememberWindowPosition();
boolean rememberWindowSize = Settings.DEFAULT_SETTINGS.getRememberWindowSize();
boolean showStatusBar = Settings.DEFAULT_SETTINGS.getShowStatusBar();
String confirmExit = Settings.DEFAULT_SETTINGS.getConfirmExit();
List<String> alphabetHistory = Settings.DEFAULT_SETTINGS.getAlphabetHistory();
int maxAlphabetHistoryLength = Settings.DEFAULT_SETTINGS.getMaxAlphabetHistoryLength();
String colorPaletteNameOverride = Settings.DEFAULT_SETTINGS.getColorPaletteNameOverride();
String orientationOverride = Settings.DEFAULT_SETTINGS.getOrientationOverride();
int ppmMaxOrder = Settings.DEFAULT_SETTINGS.getPPMMaxOrder();
int ppmAlpha = Settings.DEFAULT_SETTINGS.getPPMAlpha();
int ppmBeta = Settings.DEFAULT_SETTINGS.getPPMBeta();
int ppmUniform = Settings.DEFAULT_SETTINGS.getPPMUniform();
String textOutputTarget = Settings.DEFAULT_SETTINGS.getTextOutputTarget();
String inputProvider = Settings.DEFAULT_SETTINGS.getInputProvider();
boolean startStopOnLeftClick = Settings.DEFAULT_SETTINGS.getStartStopOnLeftClick();
float movementSpeed = Settings.DEFAULT_SETTINGS.getMovementSpeed();
boolean onlineLearning = Settings.DEFAULT_SETTINGS.getOnlineLearning();
int onlineLearningDelay = Settings.DEFAULT_SETTINGS.getOnlineLearningDelay();
int maxNumberOfNodes = Settings.DEFAULT_SETTINGS.getMaxNumberOfNodes();
int maxNumberOfOldRootNodes = Settings.DEFAULT_SETTINGS.getMaxNumberOfOldRootNodes();
float minGainForNodeTrade = Settings.DEFAULT_SETTINGS.getMinGainForNodeTrade();
float minNodeSizeForExpansion = Settings.DEFAULT_SETTINGS.getMinNodeSizeForExpansion();
float maxNodeSizeForCollapse = Settings.DEFAULT_SETTINGS.getMaxNodeSizeForCollapse();
float minNodeSizeForRendering = Settings.DEFAULT_SETTINGS.getMinNodeSizeForRendering();
float minGroupSizeForRendering = Settings.DEFAULT_SETTINGS.getMinGroupSizeForRendering();
float dropRootNodeMarginTop = Settings.DEFAULT_SETTINGS.getDropRootNodeMarginTop();
float dropRootNodeMarginBottom = Settings.DEFAULT_SETTINGS.getDropRootNodeMarginBottom();
float dropRootNodeMarginSize = Settings.DEFAULT_SETTINGS.getDropRootNodeMarginSize();
float zoomOutMarginTop = Settings.DEFAULT_SETTINGS.getZoomOutMarginTop();
float zoomOutMarginBottom = Settings.DEFAULT_SETTINGS.getZoomOutMarginBottom();
float zoomOutMarginSize = Settings.DEFAULT_SETTINGS.getZoomOutMarginSize();
int normalFontSize = Settings.DEFAULT_SETTINGS.getNormalFontSize();
int mediumFontSize = Settings.DEFAULT_SETTINGS.getMediumFontSize();
int highlightFontSize = Settings.DEFAULT_SETTINGS.getHighlightFontSize();
float mediumFontSizeMarginBefore = Settings.DEFAULT_SETTINGS.getMediumFontSizeMarginBefore();
float mediumFontSizeMarginAfter = Settings.DEFAULT_SETTINGS.getMediumFontSizeMarginAfter();
float nodeOutlineThickness = Settings.DEFAULT_SETTINGS.getNodeOutlineThickness();
float inputLineThickness = Settings.DEFAULT_SETTINGS.getInputLineThickness();
float crosshairThickness = Settings.DEFAULT_SETTINGS.getCrosshairThickness();
float crosshairWidth = Settings.DEFAULT_SETTINGS.getCrosshairWidth();
String startStopHandler = Settings.DEFAULT_SETTINGS.getStartStopHandler();
float circleSize = Settings.DEFAULT_SETTINGS.getCircleSize();
float circleOutlineThickness = Settings.DEFAULT_SETTINGS.getCircleOutlineThickness();
float circleOutlineThicknessHold = Settings.DEFAULT_SETTINGS.getCircleOutlineThicknessHold();
int circleHoldStartTime = Settings.DEFAULT_SETTINGS.getCircleHoldStartTime();
int circleHoldStopTime = Settings.DEFAULT_SETTINGS.getCircleHoldStopTime();
float firstBoxSize = Settings.DEFAULT_SETTINGS.getFirstBoxSize();
float firstBoxLeftInset = Settings.DEFAULT_SETTINGS.getFirstBoxLeftInset();
float firstBoxRightInset = Settings.DEFAULT_SETTINGS.getFirstBoxRightInset();
float firstBoxOutlineThickness = Settings.DEFAULT_SETTINGS.getFirstBoxOutlineThickness();
float firstBoxOutlineThicknessHold = Settings.DEFAULT_SETTINGS.getFirstBoxOutlineThicknessHold();
int firstBoxHoldTime = Settings.DEFAULT_SETTINGS.getFirstBoxHoldTime();
int firstBoxResetTime = Settings.DEFAULT_SETTINGS.getFirstBoxResetTime();
float secondBoxSize = Settings.DEFAULT_SETTINGS.getSecondBoxSize();
float secondBoxLeftInset = Settings.DEFAULT_SETTINGS.getSecondBoxLeftInset();
float secondBoxRightInset = Settings.DEFAULT_SETTINGS.getSecondBoxRightInset();
float secondBoxOutlineThickness = Settings.DEFAULT_SETTINGS.getSecondBoxOutlineThickness();
float secondBoxOutlineThicknessHold = Settings.DEFAULT_SETTINGS.getSecondBoxOutlineThicknessHold();
int secondBoxHoldTime = Settings.DEFAULT_SETTINGS.getSecondBoxHoldTime();
int socketOutputPort = Settings.DEFAULT_SETTINGS.getSocketOutputPort();
String joystickInputName = Settings.DEFAULT_SETTINGS.getJoystickInputName();
String joystickInputComponentNameX = Settings.DEFAULT_SETTINGS.getJoystickInputComponentNameX();
float joystickInputSensitivityX = Settings.DEFAULT_SETTINGS.getJoystickInputSensitivityX();
float joystickInputOffsetX = Settings.DEFAULT_SETTINGS.getJoystickInputOffsetX();
String joystickInputComponentNameY = Settings.DEFAULT_SETTINGS.getJoystickInputComponentNameY();
float joystickInputSensitivityY = Settings.DEFAULT_SETTINGS.getJoystickInputSensitivityY();
float joystickInputOffsetY = Settings.DEFAULT_SETTINGS.getJoystickInputOffsetY();
String joystickInputComponentNameStartStop = Settings.DEFAULT_SETTINGS.getJoystickInputComponentNameStartStop();
int socketInputPort = Settings.DEFAULT_SETTINGS.getSocketInputPort();
String socketInputLabelX = Settings.DEFAULT_SETTINGS.getSocketInputLabelX();
float socketInputMinX = Settings.DEFAULT_SETTINGS.getSocketInputMinX();
float socketInputMaxX = Settings.DEFAULT_SETTINGS.getSocketInputMaxX();
String socketInputLabelY = Settings.DEFAULT_SETTINGS.getSocketInputLabelY();
float socketInputMinY = Settings.DEFAULT_SETTINGS.getSocketInputMinY();
float socketInputMaxY = Settings.DEFAULT_SETTINGS.getSocketInputMaxY();
String socketInputLabelStartStop = Settings.DEFAULT_SETTINGS.getSocketInputLabelStartStop();
for (Entry<String, String> entry : settingsLines.entrySet()) { //process stored lines
switch (entry.getKey()) {
case "frameRate":
try {
frameRate=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"frameRate\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getFrameRate()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "antialiasing":
antialiasing=entry.getValue();
break;
case "textAntialiasing":
textAntialiasing=entry.getValue();
break;
case "windowX":
try {
windowX=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"windowX\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getWindowX()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "windowY":
try {
windowY=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"windowY\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getWindowY()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "windowWidth":
try {
windowWidth=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"windowWidth\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getWindowWidth()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "windowHeight":
try {
windowHeight=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"windowHeight\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getWindowHeight()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "spaceBehindNodes":
try {
spaceBehindNodes=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"spaceBehindNodes\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSpaceBehindNodes()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "windowAlwaysOnTop":
windowAlwaysOnTop=entry.getValue();
break;
case "windowUnfocusable":
windowUnfocusable=entry.getValue();
break;
case "rememberWindowPosition":
rememberWindowPosition=!entry.getValue().equalsIgnoreCase("false"); //default value is true
break;
case "rememberWindowSize":
rememberWindowSize=!entry.getValue().equalsIgnoreCase("false"); //default value is true
break;
case "showStatusBar":
showStatusBar=!entry.getValue().equalsIgnoreCase("false"); //default value is true
break;
case "confirmExit":
confirmExit=entry.getValue();
break;
case "alphabetHistory":
//RegEx with negative lookbehind: Only match semicolons that are not escaped with a backslash
alphabetHistory=new ArrayList<>(Arrays.asList(entry.getValue().split("(?<!\\\\);")));
for (int i = 0; i<alphabetHistory.size(); i++) { //Undo escaping of semicolons with a backslash
alphabetHistory.set(i, alphabetHistory.get(i).replace("\\;", ";"));
}
break;
case "maxAlphabetHistoryLength":
try {
maxAlphabetHistoryLength=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"maxAlphabetHistoryLength\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMaxAlphabetHistoryLength()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "colorPaletteNameOverride":
colorPaletteNameOverride=entry.getValue();
break;
case "orientationOverride":
orientationOverride=entry.getValue();
break;
case "ppmMaxOrder":
try {
ppmMaxOrder=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"ppmMaxOrder\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getPPMMaxOrder()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "ppmAlpha":
try {
ppmAlpha=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"ppmAlpha\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getPPMAlpha()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "ppmBeta":
try {
ppmBeta=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"ppmBeta\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getPPMBeta()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "ppmUniform":
try {
ppmUniform=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"ppmUniform\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getPPMUniform()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "textOutputTarget":
textOutputTarget=entry.getValue();
break;
case "inputProvider":
inputProvider=entry.getValue();
break;
case "startStopOnLeftClick":
startStopOnLeftClick=!entry.getValue().equalsIgnoreCase("false"); //default value is true
break;
case "movementSpeed":
try {
movementSpeed=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"movementSpeed\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMovementSpeed()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "onlineLearning":
onlineLearning=!entry.getValue().equalsIgnoreCase("false"); //default value is true
break;
case "onlineLearningDelay":
try {
onlineLearningDelay=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"onlineLearningDelay\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getOnlineLearningDelay()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "maxNumberOfNodes":
try {
maxNumberOfNodes=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"maxNumberOfNodes\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMaxNumberOfNodes()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "maxNumberOfOldRootNodes":
try {
maxNumberOfOldRootNodes=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"maxNumberOfOldRootNodes\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMaxNumberOfOldRootNodes()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "minGainForNodeTrade":
try {
minGainForNodeTrade=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"minGainForNodeTrade\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMinGainForNodeTrade()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "minNodeSizeForExpansion":
try {
minNodeSizeForExpansion=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"minNodeSizeForExpansion\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMinNodeSizeForExpansion()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "maxNodeSizeForCollapse":
try {
maxNodeSizeForCollapse=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"maxNodeSizeForCollapse\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMaxNodeSizeForCollapse()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "minNodeSizeForRendering":
try {
minNodeSizeForRendering=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"minNodeSizeForRendering\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMinNodeSizeForRendering()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "minGroupSizeForRendering":
try {
minGroupSizeForRendering=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"minGroupSizeForRendering\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMinGroupSizeForRendering()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "dropRootNodeMarginTop":
try {
dropRootNodeMarginTop=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"dropRootNodeMarginTop\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getDropRootNodeMarginTop()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "dropRootNodeMarginBottom":
try {
dropRootNodeMarginBottom=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"dropRootNodeMarginBottom\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getDropRootNodeMarginBottom()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "dropRootNodeMarginSize":
try {
dropRootNodeMarginSize=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"dropRootNodeMarginSize\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getDropRootNodeMarginSize()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "zoomOutMarginTop":
try {
zoomOutMarginTop=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"zoomOutMarginTop\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getZoomOutMarginTop()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "zoomOutMarginBottom":
try {
zoomOutMarginBottom=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"zoomOutMarginBottom\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getZoomOutMarginBottom()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "zoomOutMarginSize":
try {
zoomOutMarginSize=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"zoomOutMarginSize\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getZoomOutMarginSize()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "normalFontSize":
try {
normalFontSize=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"normalFontSize\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getNormalFontSize()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "mediumFontSize":
try {
mediumFontSize=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"mediumFontSize\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMediumFontSize()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "highlightFontSize":
try {
highlightFontSize=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"highlightFontSize\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getHighlightFontSize()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "mediumFontSizeMarginBefore":
try {
mediumFontSizeMarginBefore=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"mediumFontSizeMarginBefore\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMediumFontSizeMarginBefore()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "mediumFontSizeMarginAfter":
try {
mediumFontSizeMarginAfter=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"mediumFontSizeMarginAfter\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getMediumFontSizeMarginAfter()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "nodeOutlineThickness":
try {
nodeOutlineThickness=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"nodeOutlineThickness\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getNodeOutlineThickness()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "inputLineThickness":
try {
inputLineThickness=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"inputLineThickness\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getInputLineThickness()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "crosshairThickness":
try {
crosshairThickness=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"crosshairThickness\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getCrosshairThickness()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "crosshairWidth":
try {
crosshairWidth=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"crosshairWidth\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getCrosshairWidth()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "startStopHandler":
startStopHandler=entry.getValue();
break;
case "circleSize":
try {
circleSize=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"circleSize\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getCircleSize()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "circleOutlineThickness":
try {
circleOutlineThickness=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"circleOutlineThickness\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getCircleOutlineThickness()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "circleOutlineThicknessHold":
try {
circleOutlineThicknessHold=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"circleOutlineThicknessHold\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getCircleOutlineThicknessHold()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "circleHoldStartTime":
try {
circleHoldStartTime=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"circleHoldStartTime\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getCircleHoldStartTime()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "circleHoldStopTime":
try {
circleHoldStopTime=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"circleHoldStopTime\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getCircleHoldStopTime()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "firstBoxSize":
try {
firstBoxSize=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"firstBoxSize\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getFirstBoxSize()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "firstBoxLeftInset":
try {
firstBoxLeftInset=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"firstBoxLeftInset\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getFirstBoxLeftInset()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "firstBoxRightInset":
try {
firstBoxRightInset=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"firstBoxRightInset\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getFirstBoxRightInset()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "firstBoxOutlineThickness":
try {
firstBoxOutlineThickness=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"firstBoxOutlineThickness\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getFirstBoxOutlineThickness()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "firstBoxOutlineThicknessHold":
try {
firstBoxOutlineThicknessHold=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"firstBoxOutlineThicknessHold\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getFirstBoxOutlineThicknessHold()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "firstBoxHoldTime":
try {
firstBoxHoldTime=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"firstBoxHoldTime\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getFirstBoxHoldTime()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "firstBoxResetTime":
try {
firstBoxResetTime=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"firstBoxResetTime\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getFirstBoxResetTime()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "secondBoxSize":
try {
secondBoxSize=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"secondBoxSize\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSecondBoxSize()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "secondBoxLeftInset":
try {
secondBoxLeftInset=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"secondBoxLeftInset\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSecondBoxLeftInset()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "secondBoxRightInset":
try {
secondBoxRightInset=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"secondBoxRightInset\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSecondBoxRightInset()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "secondBoxOutlineThickness":
try {
secondBoxOutlineThickness=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"secondBoxOutlineThickness\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSecondBoxOutlineThickness()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "secondBoxOutlineThicknessHold":
try {
secondBoxOutlineThicknessHold=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"secondBoxOutlineThicknessHold\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSecondBoxOutlineThicknessHold()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "secondBoxHoldTime":
try {
secondBoxHoldTime=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"secondBoxHoldTime\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSecondBoxHoldTime()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "socketOutputPort":
try {
socketOutputPort=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"socketOutputPort\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSocketOutputPort()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "joystickInputName":
joystickInputName=entry.getValue();
break;
case "joystickInputComponentNameX":
joystickInputComponentNameX=entry.getValue();
break;
case "joystickInputSensitivityX":
try {
joystickInputSensitivityX=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"joystickInputSensitivityX\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getJoystickInputSensitivityX()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "joystickInputOffsetX":
try {
joystickInputOffsetX=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"joystickInputOffsetX\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getJoystickInputOffsetX()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "joystickInputComponentNameY":
joystickInputComponentNameY=entry.getValue();
break;
case "joystickInputSensitivityY":
try {
joystickInputSensitivityY=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"joystickInputSensitivityY\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getJoystickInputSensitivityY()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "joystickInputOffsetY":
try {
joystickInputOffsetY=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"joystickInputOffsetY\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getJoystickInputOffsetY()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "joystickInputComponentNameStartStop":
joystickInputComponentNameStartStop=entry.getValue();
break;
case "socketInputPort":
try {
socketInputPort=Integer.parseInt(entry.getValue(), 10);
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"socketInputPort\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSocketInputPort()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "socketInputLabelX":
socketInputLabelX=entry.getValue();
break;
case "socketInputMinX":
try {
socketInputMinX=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"socketInputMinX\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSocketInputMinX()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "socketInputMaxX":
try {
socketInputMaxX=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"socketInputMaxX\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSocketInputMaxX()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "socketInputLabelY":
socketInputLabelY=entry.getValue();
break;
case "socketInputMinY":
try {
socketInputMinY=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"socketInputMinY\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSocketInputMinY()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "socketInputMaxY":
try {
socketInputMaxY=Float.parseFloat(entry.getValue());
} catch (NumberFormatException ex) {
System.out.println("SettingsFileReader: Invalid \"socketInputMaxY\" setting, using default (\""
+Settings.DEFAULT_SETTINGS.getSocketInputMaxY()+"\"): NumberFormatException: "+ex.getMessage());
}
break;
case "socketInputLabelStartStop":
socketInputLabelStartStop=entry.getValue();
break;
default:
System.out.println("SettingsFileReader: Ignoring unknown \""+entry.getKey()+"\" setting");
break;
}
}
return new Settings(frameRate, antialiasing, textAntialiasing, windowX, windowY, windowWidth, windowHeight,
spaceBehindNodes, windowAlwaysOnTop, windowUnfocusable, rememberWindowPosition, rememberWindowSize,
showStatusBar, confirmExit, alphabetHistory, maxAlphabetHistoryLength, colorPaletteNameOverride,
orientationOverride, ppmMaxOrder, ppmAlpha, ppmBeta, ppmUniform, textOutputTarget, inputProvider,
startStopOnLeftClick, movementSpeed, onlineLearning, onlineLearningDelay, maxNumberOfNodes,
maxNumberOfOldRootNodes, minGainForNodeTrade, minNodeSizeForExpansion, maxNodeSizeForCollapse,
minNodeSizeForRendering, minGroupSizeForRendering, dropRootNodeMarginTop, dropRootNodeMarginBottom,
dropRootNodeMarginSize, zoomOutMarginTop, zoomOutMarginBottom, zoomOutMarginSize, normalFontSize,
mediumFontSize, highlightFontSize, mediumFontSizeMarginBefore, mediumFontSizeMarginAfter,
nodeOutlineThickness, inputLineThickness, crosshairThickness, crosshairWidth, startStopHandler,
circleSize, circleOutlineThickness, circleOutlineThicknessHold, circleHoldStartTime,
circleHoldStopTime, firstBoxSize, firstBoxLeftInset, firstBoxRightInset, firstBoxOutlineThickness,
firstBoxOutlineThicknessHold, firstBoxHoldTime, firstBoxResetTime, secondBoxSize,
secondBoxLeftInset, secondBoxRightInset, secondBoxOutlineThickness, secondBoxOutlineThicknessHold,
secondBoxHoldTime, socketOutputPort, joystickInputName, joystickInputComponentNameX,
joystickInputSensitivityX, joystickInputOffsetX, joystickInputComponentNameY,
joystickInputSensitivityY, joystickInputOffsetY, joystickInputComponentNameStartStop,
socketInputPort, socketInputLabelX, socketInputMinX, socketInputMaxX, socketInputLabelY,
socketInputMinY, socketInputMaxY, socketInputLabelStartStop);
}
}
}