Beispiel #1
0
  public Element toXML() {
    Element result = new Element("timer");

    XMLUtil.createElement("title", getTitle(), result);
    XMLUtil.createElement("started", started == null ? "" : started.toString(), result);
    XMLUtil.createElement("total", period.toString(), result);
    XMLUtil.createElement("speed", update_speed, result);

    XMLUtil.createElement("x", getX(), result);
    XMLUtil.createElement("y", getY(), result);
    XMLUtil.createElement("width", getWidth(), result);
    XMLUtil.createElement("height", getHeight(), result);

    XMLUtil.createElement(
        "foreground", String.format("%08x", total.getForeground().getRGB()), result);
    XMLUtil.createElement(
        "background", String.format("%08x", panel.getBackground().getRGB()), result);

    XMLUtil.createElement("visible", isVisible(), result);

    Element times = new Element("times");
    for (TimeSpan ts : this.times) {
      times.addContent(ts.toXML());
    }
    result.addContent(times);
    return result;
  }