/** * Writes the location of the views of the known {@link Note}s. * * @param element the xml-element to write into, the attributes of <code>element</code> will not * be changed */ public void writeXML(XElement element) throws IOException { PropertyTransformer transformer = new PropertyTransformer(); for (Map.Entry<Note, Tuple<DockStation, DockableProperty>> location : locations.entrySet()) { XElement xnote = element.addElement("note"); xnote.addString("id", location.getKey().getId()); xnote.addString("station", manager.getName(location.getValue().getA())); transformer.writeXML(location.getValue().getB(), xnote); } }
public <B> void write(XElement element, ModeSettingsConverter<Location, B> converter) { Set<String> keys = new HashSet<String>(); if (lastMaximizedLocation != null) { keys.addAll(lastMaximizedLocation.keySet()); } if (lastMaximizedMode != null) { keys.addAll(lastMaximizedMode.keySet()); } if (!keys.isEmpty()) { XElement xmaximized = element.addElement("maximized"); for (String key : keys) { Path mode = lastMaximizedMode.get(key); Location location = lastMaximizedLocation.get(key); if (mode != null || location != null) { XElement xitem = xmaximized.addElement("item"); xitem.addString("id", key); if (mode != null) { xitem.addElement("mode").setString(mode.toString()); } if (location != null) { converter.writePropertyXML( converter.convertToSetting(location), xitem.addElement("location")); } } } } }