Package jreepad

Examples of jreepad.JreepadNode


        LineNumberReader reader = new LineNumberReader(new InputStreamReader(in, encoding));
        reader.readLine(); // skip first line // TODO check for treepadness

        Stack nodeStack = new Stack();
        int depthMarker;
        JreepadNode newNode;
        JreepadNode rootNode = null;
        String dtLine, nodeLine, titleLine, depthLine;
        StringBuffer currentContent;
        String currentLine;
        dtLine = "dt=text";

        while ((fileFormat == 2 || (dtLine = reader.readLine()) != null)
            && (nodeLine = reader.readLine()) != null && (titleLine = reader.readLine()) != null
            && (depthLine = reader.readLine()) != null)
        {
            // Read "dt=text" [or error] - NB THE OLDER FORMAT DOESN'T INCLUDE THIS LINE SO WE SKIP
            // IT
            if (dtLine.equals("") && nodeLine.startsWith("<bmarks>"))
                throw new IOException(
                    "This is not a Treepad-Lite-compatible file!\n\nFiles created in more advanced versions of Treepad\ncontain features that are not available in Jreepad.");

            if (fileFormat != 2)
                if (!(dtLine.toLowerCase().startsWith("dt=text")))
                    throw new IOException("Unrecognised node dt format at line " + reader.getLineNumber() + ": "
                        + dtLine);
            // Read "<node>" [or error]
            if (!(nodeLine.toLowerCase().startsWith("<node>")))
                throw new IOException("Unrecognised node format at line " + (reader.getLineNumber() + 1) + ": "
                    + nodeLine);

            // Read THE CONTENT! [loop until we find "<end node> 5P9i0s8y19Z"]
            currentContent = new StringBuffer();
            while ((currentLine = reader.readLine()) != null
                && !currentLine.equals("<end node> 5P9i0s8y19Z"))
            {
                currentContent.append(currentLine + "\n");
            }

            // Now, having established the content and the title and the depth, we'll create the
            // child
            String content = currentContent.substring(0, Math.max(currentContent.length() - 1, 0));
            newNode = new JreepadNode(titleLine, content);
            // babyNode = new JreepadNode(titleLine, currentContent.substring(0,
            // Math.max(currentContent.length()-2,0)),
            // (JreepadNode)(nodeStack.peek()));

            // Turn it into a HTML-mode node if it matches "<html> ... </html>"
View Full Code Here


            content = new StringBuffer();

            String title = attributes.getValue(TITLE_ATTRIBUTE);
            String type = attributes.getValue(TYPE_ATTRIBUTE);

            JreepadNode newNode = new JreepadNode(title, "");
            if (currentNode != null)
                currentNode.add(newNode);
            currentNode = newNode;
            if (root == null)
                root = currentNode;
View Full Code Here

TOP

Related Classes of jreepad.JreepadNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.