Package org.foray.area

Examples of org.foray.area.TextArea


        final Iterator<OrderedTreeNode> iterator =
                node.postOrderDescendantIterator();
        while (iterator.hasNext()) {
            final OrderedTreeNode otn = iterator.next();
            if (otn instanceof TextArea) {
                final TextArea textArea = (TextArea) otn;
                final CharSequence text = textArea.getRawText();
                builder.append(text);
            }
        }
        return builder.toString();
    }
View Full Code Here


        assertEquals(3, lineArea.getChildCount());

        /* The first child of the line area is a text area. */
        node = lineArea.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea1 = (TextArea) node;
        assertEquals("Lighter(1), ", textArea1.getText().toString());

        /* The second child of the line area is the outside inline area. */
        node = lineArea.getChildAt(1);
        assertTrue(node instanceof InlineArea);
        final InlineArea inlineArea1 = (InlineArea) node;
        assertEquals(3, inlineArea1.getChildCount());

        /* The first child of the outside inline area is a text area. */
        node = inlineArea1.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea2 = (TextArea) node;
        assertEquals("Bolder(1), ", textArea2.getText().toString());

        /* The second child of the outside inline area is the inside inline area. */
        node = inlineArea1.getChildAt(1);
        assertTrue(node instanceof InlineArea);
        final InlineArea inlineArea2 = (InlineArea) node;
        assertEquals(1, inlineArea2.getChildCount());

        /* The first and only child of the inside inline area is a text area. */
        node = inlineArea2.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea3 = (TextArea) node;
        final String textArea3Text = textArea3.getText().toString();
        assertEquals("Lighter(2), ", textArea3Text);

        /* The third child of the outside inline area is another text area. */
        node = inlineArea1.getChildAt(2);
        assertTrue(node instanceof TextArea);
        final TextArea textArea4 = (TextArea) node;
        assertEquals("Bolder(2), ", textArea4.getText().toString());

        /* The third child of the line area is another text area. */
        node = lineArea.getChildAt(2);
        assertTrue(node instanceof TextArea);
        final TextArea textArea5 = (TextArea) node;
        assertEquals("Lighter(3).", textArea5.getText().toString());

    }
View Full Code Here

        assertEquals(expectedInlineY, inlineY);

        /* The first child of the inline-area is a text area. */
        node = inlineArea.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea = (TextArea) node;
        final int inlineYTextArea = textArea.baselineY();
        assertEquals(expectedInlineY, inlineYTextArea);
    }
View Full Code Here

        /* Test location and dimensions of the text area. The key thing we are
         * testing here is that IT IS CENTERED. */
        node = lineArea.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea = (TextArea) node;

        final FreeStandingFont fsf = getHelveticaFont();
        /* The following computation is tested in {@link TestFont4a#testWidth()}. */
        final int textWidth = fsf.width("Test of Centering", 12000, 0, 0, true);
        assertEquals(textWidth, textArea.crIpd());

        /* The x value of the text area content rectangle should be at the x
         * location of the parent line area + 1/2 of the unused area in the
         * line. Total line area ipd = 468,000. Unused line area ipd =
         * 468,000 - 90,780 = 377,220. One half of the unused line area ipd =
         * 188,610. x = 72,000 + 188,610 = 260,610. */
        assertEquals(260610, textArea.crOriginX());

        /* The y value of the text area content rectangle should be the same as
         * the parent line area. */
        assertEquals(718800, textArea.crOriginY());
    }
View Full Code Here

        /* Test location and dimensions of the text area. The key thing we are
         * testing here is that IT IS CENTERED. */
        node = lineArea.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea = (TextArea) node;

        final FreeStandingFont fsf = getHelveticaFont();
        /* The following computation is tested in {@link TestFont4a#testWidth()}.
         * The extra word spacing is .3em = .3 * 12000 = 3600. */
        final int textWidth = fsf.width("Centered with Word Spacing", 12000, 0, 3600, true);
        assertEquals(textWidth, textArea.crIpd());

        /* The x value of the text area content rectangle should be at the x
         * location of the parent line area + 1/2 of the unused area in the
         * line. Total line area ipd = 468,000. Unused line area ipd =
         * 468,000 - 162,684 = 305,316. One half of the unused line area ipd =
         * 152,658.
         * x = 72,000 + 152,238 = 224,658. */
        assertEquals(224658, textArea.crOriginX());

        /* The y value of the text area content rectangle should be the same as
         * the parent line area. */
        assertEquals(718800, textArea.crOriginY());
    }
View Full Code Here

TOP

Related Classes of org.foray.area.TextArea

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.