public void writeDimension(final Dimension dimension, final @NonNls String elementName) {
    if (dimension.width == -1 && dimension.height == -1) {
      return;
    }
    startElement(elementName);
    try {
      addAttribute("width", dimension.width);
      addAttribute("height", dimension.height);
    }
    finally {
      endElement();
    }
  }
public void writeDimension(final Dimension dimension, final @NonNls String elementName)