public boolean writeValue(Object o_value, RTFGenerator target, boolean force) throws IOException { Boolean val; if (o_value == null) val = Boolean.valueOf(swingDefault); else val = (Boolean) o_value; if (force || (val.booleanValue() != rtfDefault)) { if (val.booleanValue()) { target.writeControlWord(rtfName); } else { target.writeControlWord(rtfName, 0); } } return true; }
public boolean writeValue(Object value, RTFGenerator target, boolean force) throws IOException { if (value == null) { return !force; } if (value.equals(swingValue)) { target.writeControlWord(rtfName); return true; } return !force; }
public boolean writeValue(Object o_value, RTFGenerator target, boolean force) throws IOException { Number value = (Number) o_value; if (value == null) value = swingDefault; if (value == null) { /* TODO: What is the proper behavior if the Swing object does not specify a value, and we don't know its default value? Currently we pretend that the RTF default value is equivalent (probably a workable assumption) */ return true; } int int_value = Math.round(value.floatValue() * scale); if (force || (int_value != rtfDefault)) target.writeControlWord(rtfName, int_value); return true; }