Exemplo n.º 1
0
 public static Color parseValue(Color def, XMLHelper node) {
   try {
     return Color.decode(node.getValue());
   } catch (Exception e) {
     node.setValue(def);
     return def;
   }
 }
Exemplo n.º 2
0
 public static float parseValue(float def, XMLHelper node) {
   try {
     return Float.parseFloat(node.getValue());
   } catch (Exception e) {
     node.setValue(def);
     return def;
   }
 }
Exemplo n.º 3
0
 public static int parseValue(int def, XMLHelper node) {
   try {
     return Integer.parseInt(node.getValue());
   } catch (Exception e) {
     node.setValue(def);
     return def;
   }
 }
Exemplo n.º 4
0
 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;
   }
 }
Exemplo n.º 5
0
 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();
   }
 }