public <B> void read(DataInputStream in, ModeSettingsConverter<Location, B> converter)
      throws IOException {
    Version version = Version.read(in);
    version.checkCurrent();

    lastMaximizedLocation = new HashMap<String, Location>();
    lastMaximizedMode = new HashMap<String, Path>();

    int count = in.readInt();
    for (int i = 0; i < count; i++) {
      String key = in.readUTF();
      String value = in.readUTF();
      lastMaximizedMode.put(key, new Path(value));
    }

    count = in.readInt();
    for (int i = 0; i < count; i++) {
      String key = in.readUTF();
      Location location = converter.convertToWorld(converter.readProperty(in));
      lastMaximizedLocation.put(key, location);
    }
  }
  public <B> void read(XElement element, ModeSettingsConverter<Location, B> converter) {
    lastMaximizedLocation = new HashMap<String, Location>();
    lastMaximizedMode = new HashMap<String, Path>();

    XElement xmaximized = element.getElement("maximized");

    if (xmaximized != null) {
      for (XElement xitem : xmaximized.getElements("item")) {
        String key = xitem.getString("id");

        XElement xmode = xitem.getElement("mode");
        if (xmode != null) {
          lastMaximizedMode.put(key, new Path(xmode.getString()));
        }

        XElement xlocation = xitem.getElement("location");
        if (xlocation != null) {
          lastMaximizedLocation.put(
              key, converter.convertToWorld(converter.readPropertyXML(xlocation)));
        }
      }
    }
  }