protected double getValue(DoubleBox box) { try { Double value = box.getValue(); if (value == null) { box.setValue(0.0); value = 0.0; } return value; } catch (Exception e) { box.setValue(0.0); return 0.0; } }
protected String getFieldValue(DoubleBox field, String defaultValue) { try { return String.valueOf(field.getValue()); } catch (Exception e) { field.setText(defaultValue); return defaultValue; } }
protected void setFieldValue(Field f, String value) { Object field = f.field; if (value == null) value = f.defaultValue; if (field instanceof TextBox) setFieldValue((TextBox) field, value); else if (field instanceof IntegerBox) setFieldValue((IntegerBox) field, value); else if (field instanceof NumberSpinner) setFieldValue((NumberSpinner) field, value); else if (field instanceof LongSpinner) setFieldValue((LongSpinner) field, value); else if (field instanceof DoubleSpinner) setFieldValue((DoubleSpinner) field, value); else if (field instanceof DoubleBox) setFieldValue((DoubleBox) field, value); else if (field instanceof SimpleCheckBox) setFieldValue((SimpleCheckBox) field, value); else if (field instanceof ListBox) setFieldValue((ListBox) field, value); else if (field instanceof PassivesPanel) setFieldValue((PassivesPanel) field, value); else if (field instanceof GemsPanel) setFieldValue((GemsPanel) field, value); else if (field instanceof ItemPanel) setFieldValue((ItemPanel) field, value); else if (field instanceof SkillsPanel) setFieldValue((SkillsPanel) field, value); else if (field instanceof DamageTypePanel) setFieldValue((DamageTypePanel) field, value); else if (field instanceof SkillDamagePanel) setFieldValue((SkillDamagePanel) field, value); }
protected void setFieldValue(DoubleBox field, String value) { try { field.setValue(Double.valueOf(value)); } catch (Exception e) { field.setValue(0.0); } }
public DoubleSpinner(String text) { super(new DoubleBox(), text, 0.0, Double.MAX_VALUE, 1.0); }
protected String getFieldValue(Field f) { Object field = f.field; String defaultValue = f.defaultValue; if (field instanceof TextBox) return getFieldValue((TextBox) field, defaultValue); else if (field instanceof IntegerBox) return getFieldValue((IntegerBox) field, defaultValue); else if (field instanceof NumberSpinner) return getFieldValue((NumberSpinner) field, defaultValue); else if (field instanceof LongSpinner) return getFieldValue((LongSpinner) field, defaultValue); else if (field instanceof DoubleSpinner) return getFieldValue((DoubleSpinner) field, defaultValue); else if (field instanceof DoubleBox) return getFieldValue((DoubleBox) field, defaultValue); else if (field instanceof SimpleCheckBox) return getFieldValue((SimpleCheckBox) field, defaultValue); else if (field instanceof ListBox) return getFieldValue((ListBox) field, defaultValue); else if (field instanceof PassivesPanel) return getFieldValue(((PassivesPanel) field).getPassives(), defaultValue); else if (field instanceof GemsPanel) return getGemsFieldValue(((GemsPanel) field).getGems(), defaultValue); else if (field instanceof ItemPanel) return getSpecialItemsFieldValue(((ItemPanel) field).getItems(), ((ItemPanel) field).getSetCounts(), defaultValue); else if (field instanceof SkillsPanel) return getEnumFieldValue(((SkillsPanel) field).getSkills(), defaultValue); else if (field instanceof DamageTypePanel) return getFieldValue(((DamageTypePanel) field).getValues(), defaultValue); else if (field instanceof SkillDamagePanel) return getFieldValue(((SkillDamagePanel) field).getValues(), defaultValue); else return defaultValue; }
public DoubleEditorCell() { super(new DoubleBox()); }