public void restoreState(RestorableSupport rs, RestorableSupport.StateObject so) {
    Boolean b = rs.getStateValueAsBoolean(so, "drawInterior");
    if (b != null) this.setDrawInterior(b);

    b = rs.getStateValueAsBoolean(so, "drawOutline");
    if (b != null) this.setDrawOutline(b);

    b = rs.getStateValueAsBoolean(so, "enableAntialiasing");
    if (b != null) this.setEnableAntialiasing(b);

    RestorableSupport.StateObject mo = rs.getStateObject(so, "interiorMaterial");
    if (mo != null) this.setInteriorMaterial(this.getInteriorMaterial().restoreState(rs, mo));

    mo = rs.getStateObject(so, "outlineMaterial");
    if (mo != null) this.setOutlineMaterial(this.getOutlineMaterial().restoreState(rs, mo));

    Double d = rs.getStateValueAsDouble(so, "interiorOpacity");
    if (d != null) this.setInteriorOpacity(d);

    d = rs.getStateValueAsDouble(so, "outlineOpacity");
    if (d != null) this.setOutlineOpacity(d);

    d = rs.getStateValueAsDouble(so, "outlineWidth");
    if (d != null) this.setOutlineWidth(d);

    Integer i = rs.getStateValueAsInteger(so, "outlineStippleFactor");
    if (i != null) this.setOutlineStippleFactor(i);

    i = rs.getStateValueAsInteger(so, "outlineStipplePattern");
    if (i != null) this.setOutlineStipplePattern(i.shortValue());

    String s = rs.getStateValueAsString(so, "interiorImagePath");
    if (s != null) this.setInteriorImageSource(s);

    d = rs.getStateValueAsDouble(so, "interiorImageScale");
    if (d != null) this.setInteriorImageScale(d);
  }
  public void getRestorableState(RestorableSupport rs, RestorableSupport.StateObject so) {
    rs.addStateValueAsBoolean(so, "drawInterior", this.isDrawInterior());

    rs.addStateValueAsBoolean(so, "drawOutline", this.isDrawOutline());

    rs.addStateValueAsBoolean(so, "enableAntialiasing", this.isEnableAntialiasing());

    this.getInteriorMaterial().getRestorableState(rs, rs.addStateObject(so, "interiorMaterial"));

    this.getOutlineMaterial().getRestorableState(rs, rs.addStateObject(so, "outlineMaterial"));

    rs.addStateValueAsDouble(so, "interiorOpacity", this.getInteriorOpacity());

    rs.addStateValueAsDouble(so, "outlineOpacity", this.getOutlineOpacity());

    rs.addStateValueAsDouble(so, "outlineWidth", this.getOutlineWidth());

    rs.addStateValueAsInteger(so, "outlineStippleFactor", this.getOutlineStippleFactor());

    rs.addStateValueAsInteger(so, "outlineStipplePattern", this.getOutlineStipplePattern());

    if (this.getInteriorImageSource() != null && this.getInteriorImageSource() instanceof String)
      rs.addStateValueAsString(so, "interiorImagePath", (String) this.getInteriorImageSource());

    rs.addStateValueAsDouble(so, "interiorImageScale", this.getInteriorImageScale());
  }