Examples of BranchElement


Examples of javax.swing.text.AbstractDocument.BranchElement

        leaves[0] = doc.createLeafElement(paragraph, null, 0, 5);
        leaves[1] = doc.createLeafElement(paragraph, bold, 5, 9);
        leaves[2] = doc.createLeafElement(paragraph, italic, 9, 15);
        leaves[3] = doc.createLeafElement(paragraph, null, 15, 16);
        ((BranchElement) paragraph).replace(0, 1, leaves);
        BranchElement branch = (BranchElement) doc.createBranchElement(root, null);
        leaves = new Element[1];
        leaves[0] = doc.createLeafElement(branch, null, 16, 21);
        branch.replace(0, 0, leaves);
        branch.addAttributes(boldFalse);
        branch.addAttributes(italicFalse);
        // Add this branch to the root
        ((BranchElement) root).replace(1, 0, new Element[] { branch });
    }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        doc = htmlDoc;

        doc.insertString(0, "0123456789", as[0]);

        htmlDoc.lockWrite();
        BranchElement branch = doc.new BranchElement(null, as[1]);
        leaf1 = doc.new LeafElement(null, as[2], 0, 3);
        leaf2 = doc.new LeafElement(branch, as[2], 5, 8);
        htmlDoc.unlockWrite();
    }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        };
        doc.buffer = buf;
        doc.writeLock();
        try {
            doc.getContent().insertString(0, "\n0000");
            final BranchElement html = (BranchElement) root;
            html.addAttribute(ELEMENT_NAME, "html");
            final BranchElement head = createBranch(html);
            head.addAttribute(ELEMENT_NAME, "head");
            final BranchElement implied = createBranch(head);
            implied.addAttribute(ELEMENT_NAME, "p-implied");
            final LeafElement content0 = createLeaf(implied, 0, 1);
            content0.addAttribute(ELEMENT_NAME, "head-content");
            final BranchElement body = createBranch(html);
            body.addAttribute(ELEMENT_NAME, "body");
            final BranchElement p1 = createBranch(body);
            p1.addAttribute(ELEMENT_NAME, "p1");
            final LeafElement content1 = createLeaf(p1, 1, 5);
            content1.addAttribute(ELEMENT_NAME, "leaf1");
            final LeafElement content2 = createLeaf(p1, 5, 6);
            content2.addAttribute(ELEMENT_NAME, "leaf2");
            implied.replace(0, 0, new Element[] { content0 });
            p1.replace(0, 0, new Element[] { content1, content2 });
            head.replace(0, 0, new Element[] { implied });
            body.replace(0, 0, new Element[] { p1 });
            html.replace(0, 1, new Element[] { head, body });
        } finally {
            doc.writeUnlock();
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

            }
        };
        doc.buffer = buf;
        doc.writeLock();
        try {
            final BranchElement html = (BranchElement) root;
            html.addAttribute(ELEMENT_NAME, "html");
            final BranchElement body = createBranch(html);
            body.addAttribute(ELEMENT_NAME, "body");
            final BranchElement p = createBranch(body);
            p.addAttribute(ELEMENT_NAME, "p");
            final LeafElement content = createLeaf(p, 0, 1);
            content.addAttribute(ELEMENT_NAME, "leaf1");
            p.replace(0, 0, new Element[] { content });
            body.replace(0, 0, new Element[] { p });
            html.replace(0, 1, new Element[] { body });
        } finally {
            doc.writeUnlock();
        }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        private BranchElement defRoot;

        protected void createRoot() {
            writeLock();
            defRoot = new BranchElement(null, null);
            defRoot.replace(0, 0, new Element[] { new LeafElement(defRoot, null, 0, 1) });
            writeUnlock();
        }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        leaves[0] = doc.createLeafElement(paragraph, null, 0, 5);
        leaves[1] = doc.createLeafElement(paragraph, bold, 5, 9);
        leaves[2] = doc.createLeafElement(paragraph, italic, 9, 15);
        leaves[3] = doc.createLeafElement(paragraph, null, 15, 16);
        ((BranchElement) paragraph).replace(0, 1, leaves);
        BranchElement branch = (BranchElement) doc.createBranchElement(root, null);
        leaves = new Element[1];
        leaves[0] = doc.createLeafElement(branch, null, 16, 21);
        branch.replace(0, 0, leaves);
        // Add this branch to the root
        ((BranchElement) root).replace(1, 0, new Element[] { branch });
        insertOffset = 5 + 2;
    }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        leaves[0] = doc.createLeafElement(paragraph, null, 0, 5);
        leaves[1] = doc.createLeafElement(paragraph, bold, 5, 9);
        leaves[2] = doc.createLeafElement(paragraph, italic, 9, 15);
        leaves[3] = doc.createLeafElement(paragraph, null, 15, 16);
        ((BranchElement) paragraph).replace(0, 1, leaves);
        BranchElement branch = (BranchElement) doc.createBranchElement(root, null);
        leaves = new Element[1];
        leaves[0] = doc.createLeafElement(branch, null, 16, 21);
        branch.replace(0, 0, leaves);
        ((BranchElement) root).replace(1, 0, new Element[] { branch });
    }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        AbstractDocument_AbstractElement_TreeNodeTest {
    @Override
    protected void setUp() throws Exception {
        doc = new DisAbstractedDocument(new GapContent());
        doc.writeLock();
        BranchElement branch = doc.new BranchElement(null, null);
        aElement = doc.new LeafElement(null, null, 0, 3);
        parented = doc.new LeafElement(parent = branch, null, 5, 8);
        doc.writeUnlock();
    }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        leaves[0] = doc.createLeafElement(paragraph, null, 0, 5);
        leaves[1] = doc.createLeafElement(paragraph, bold, 5, 9);
        leaves[2] = doc.createLeafElement(paragraph, italic, 9, 15);
        leaves[3] = doc.createLeafElement(paragraph, null, 15, 16);
        ((BranchElement) paragraph).replace(0, 1, leaves);
        BranchElement branch = (BranchElement) doc.createBranchElement(root, null);
        leaves = new Element[1];
        leaves[0] = doc.createLeafElement(branch, null, 16, 21);
        branch.replace(0, 0, leaves);
        ((BranchElement) root).replace(1, 0, new Element[] { branch });
    }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        leaves[0] = doc.createLeafElement(paragraph, null, 0, 5);
        leaves[1] = doc.createLeafElement(paragraph, bold, 5, 9);
        leaves[2] = doc.createLeafElement(paragraph, italic, 9, 15);
        leaves[3] = doc.createLeafElement(paragraph, null, 15, 16);
        ((BranchElement) paragraph).replace(0, 1, leaves);
        BranchElement branch = (BranchElement) doc.createBranchElement(root, null);
        leaves = new Element[1];
        leaves[0] = doc.createLeafElement(branch, null, 16, 21);
        branch.replace(0, 0, leaves);
        // Add this branch to the root
        ((BranchElement) root).replace(1, 0, new Element[] { branch });
        insertOffset = 5 + 2;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.