Search in sources :

Example 6 with XMLException

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;
}
Also used : XMLException(org.freeplane.n3.nanoxml.XMLException) Frame(java.awt.Frame) IXMLReader(org.freeplane.n3.nanoxml.IXMLReader) IXMLParser(org.freeplane.n3.nanoxml.IXMLParser) StringReader(java.io.StringReader) StdXMLReader(org.freeplane.n3.nanoxml.StdXMLReader) Dimension(java.awt.Dimension) XMLElement(org.freeplane.n3.nanoxml.XMLElement)

Aggregations

IXMLParser (net.n3.nanoxml.IXMLParser)4 IXMLReader (net.n3.nanoxml.IXMLReader)4 XMLException (net.n3.nanoxml.XMLException)4 IOException (java.io.IOException)2 XMLException (org.freeplane.n3.nanoxml.XMLException)2 XHtmlFilter (eu.webtoolkit.jwt.XHtmlFilter)1 Dimension (java.awt.Dimension)1 Frame (java.awt.Frame)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 StringReader (java.io.StringReader)1 IXMLElement (net.n3.nanoxml.IXMLElement)1 StdXMLReader (net.n3.nanoxml.StdXMLReader)1 XMLElement (net.n3.nanoxml.XMLElement)1 IXMLParser (org.freeplane.n3.nanoxml.IXMLParser)1 IXMLReader (org.freeplane.n3.nanoxml.IXMLReader)1 StdXMLReader (org.freeplane.n3.nanoxml.StdXMLReader)1 XMLElement (org.freeplane.n3.nanoxml.XMLElement)1