Examples of BranchElement


Examples of javax.swing.text.AbstractDocument.BranchElement

   * @param h
   */
  private void testUnbreakable(TestHarness h)
  {
    DefaultStyledDocument doc = new DefaultStyledDocument();
    Element el = doc.new BranchElement(null, null);
    TestFlowView fv = new TestFlowView(el, View.Y_AXIS);
    // Create one row and fill it with one oversized testview.
    TestFlowView.TestRow row = (TestFlowView.TestRow) fv.createRow();
    fv.replace(0, 0, new View[]{row});
    row.preferred = 200;
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

   * @param h
   */
  private void testGoodBreakable(TestHarness h)
  {
    DefaultStyledDocument doc = new DefaultStyledDocument();
    Element el = doc.new BranchElement(null, null);
    TestFlowView fv = new TestFlowView(el, View.Y_AXIS);
    // Create one row and fill it with one oversized testview.
    TestFlowView.TestRow row = (TestFlowView.TestRow) fv.createRow();
    fv.replace(0, 0, new View[]{row});
    row.breakWeight = View.GoodBreakWeight;
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

   * @param h
   */
  private void testExcellentBreakable(TestHarness h)
  {
    DefaultStyledDocument doc = new DefaultStyledDocument();
    Element el = doc.new BranchElement(null, null);
    TestFlowView fv = new TestFlowView(el, View.Y_AXIS);
    // Create one row and fill it with one oversized testview.
    TestFlowView.TestRow row = (TestFlowView.TestRow) fv.createRow();
    fv.replace(0, 0, new View[]{row});
    row.breakWeight = View.ExcellentBreakWeight;
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

   * @param h
   */
  private void testForceBreakable(TestHarness h)
  {
    DefaultStyledDocument doc = new DefaultStyledDocument();
    Element el = doc.new BranchElement(null, null);
    TestFlowView fv = new TestFlowView(el, View.Y_AXIS);
    // Create one row and fill it with one oversized testview.
    TestFlowView.TestRow row = (TestFlowView.TestRow) fv.createRow();
    fv.replace(0, 0, new View[]{row});
    row.breakWeight = View.ForcedBreakWeight;
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

        RuntimeException rte = new RuntimeException();
        rte.initCause(ex);
        throw rte;
      }
   
    BranchElement el = (BranchElement) doc.getDefaultRootElement();
    // Modify the element structure a little and seen how the initial
    // elements are created then.
    LeafElement el1 = doc.new LeafElement(el, null, 0, 3);
    LeafElement el2 = doc.new LeafElement(el, null, 3, 7);
    LeafElement el3 = doc.new LeafElement(el, null, 7, 11);
    el.replace(0, 1, new Element[]{el1, el2, el3});


    TestZoneView zv = new TestZoneView(el, View.Y_AXIS);
    // Set the maximum zone size somewhere inside the second element.
    zv.setMaximumZoneSize(5);
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

    public void testUndo02() throws BadLocationException {
        final class UndoPlainDocument extends PlainDocument {
            private static final long serialVersionUID = 1L;

            BranchElement altRoot = new BranchElement(null, null);

            boolean undone = false;

            boolean redone = false;
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

     * <code>view.getEndOffset() != doc.getLength()</code>.
     */
    public void testViewToModel04() {
        // Modify the root
        final int oldCount = root.getElementCount();
        BranchElement docRoot = (BranchElement) root;
        final Element[] empty = new Element[0];
        docRoot.replace(0, 1, empty);
        docRoot.replace(docRoot.getElementCount() - 1, 1, empty);
        final int newCount = root.getElementCount();
        assertEquals(oldCount - 2, newCount);
        // Re-load children
        view.removeAll();
        view.loadChildren(factory);
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

    /**
     * Test getElementIndex behavior if some elements are zero-length,
     * i.e. start and end offsets are the same.
     */
    public void testGetElementIndex02() {
        BranchElement root = doc.new BranchElement(null, null);
        LeafElement[] leaves = { doc.new LeafElement(root, null, 0, 0), // [0]
                doc.new LeafElement(root, null, 0, 1), // [1]
                doc.new LeafElement(root, null, 0, 1), // [2]
                doc.new LeafElement(root, null, 1, 1), // [3]
                doc.new LeafElement(root, null, 1, 1), // [4]
                doc.new LeafElement(root, null, 1, 2), // [5]
                doc.new LeafElement(root, null, 2, 3) // [6]
        };
        root.replace(0, 0, leaves);
        assertEquals(0, root.getElementIndex(-1));
        assertEquals(1, root.getElementIndex(0));
        assertEquals(5 /*2*/, root.getElementIndex(1));
        assertEquals(6, root.getElementIndex(2));
        assertEquals(6, root.getElementIndex(3));
        assertEquals(6, root.getElementIndex(4));
    }
View Full Code Here

Examples of javax.swing.text.AbstractDocument.BranchElement

    /**
     * Tests getElementIndex behavior when there are no children in the
     * BranchElement.
     */
    public void testGetElementIndex03() {
        BranchElement root = doc.new BranchElement(null, null);
        try {
            assertEquals(0, root.getElementIndex(-1));
            if (!BasicSwingTestCase.isHarmony()) {
                fail("NullPointerException should be thrown");
            }
        } catch (NullPointerException e) {
        }
        try {
            assertEquals(0, root.getElementIndex(0));
            if (!BasicSwingTestCase.isHarmony()) {
                fail("NullPointerException should be thrown");
            }
        } catch (NullPointerException e) {
        }
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.