public static Color parseValue(Color def, XMLHelper node) { try { return Color.decode(node.getValue()); } catch (Exception e) { node.setValue(def); return def; } }
public static float parseValue(float def, XMLHelper node) { try { return Float.parseFloat(node.getValue()); } catch (Exception e) { node.setValue(def); return def; } }
public static int parseValue(int def, XMLHelper node) { try { return Integer.parseInt(node.getValue()); } catch (Exception e) { node.setValue(def); return def; } }
public static boolean parseValue(boolean def, XMLHelper node) { String value = node.getValue().toUpperCase(); if ("TRUE".compareTo(value) == 0) { return true; } else if ("FALSE".compareTo(value) == 0) { return false; } else { node.setValue(def); return def; } }
public String getValue(String subnode, String def) { XMLHelper helper = getSubNode(subnode); // To account for the case where the default is not a blank string, but we may want to // eventually set the setting to one // We don't do this if we are doing getValue() on this node, because we should know if its new // or not if (helper.getIsNewNode()) { helper.setValue(def); return def; } else { return helper.getValue(); } }