use of net.n3.nanoxml.XMLException in project freeplane by freeplane.
the class WindowConfigurationStorage method unmarschall.
protected XMLElement unmarschall(final String marshalled, final JDialog dialog) {
if (marshalled != null) {
final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
final IXMLReader xmlReader = new StdXMLReader(new StringReader(marshalled));
parser.setReader(xmlReader);
try {
final XMLElement storage = (XMLElement) parser.parse();
if (storage != null) {
x = Integer.parseInt(storage.getAttribute("x", "-1"));
y = Integer.parseInt(storage.getAttribute("y", "-1"));
width = Integer.parseInt(storage.getAttribute("width", "-1"));
height = Integer.parseInt(storage.getAttribute("height", "-1"));
UITools.setBounds(dialog, x, y, width, height);
return storage;
}
} catch (final NumberFormatException e) {
LogUtils.severe(e);
} catch (final XMLException e) {
LogUtils.severe(e);
}
}
final Frame rootFrame = JOptionPane.getFrameForComponent(dialog);
final Dimension prefSize = rootFrame.getSize();
prefSize.width = prefSize.width * 3 / 4;
prefSize.height = prefSize.height * 3 / 4;
dialog.setSize(prefSize);
return null;
}
Aggregations