Examples of ChildrenFactory


Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

     * Tests <code>getViewIndexAtPosition()</code> when views represent entire
     * elements.
     */
    public void testGetViewIndexAtPositionEntire() {
        assertEquals(0, view.getViewCount());
        final ViewFactory vf = new ChildrenFactory();
        final Element first = root.getElement(0);
        final Element second = root.getElement(1);
        final int middle = (first.getStartOffset() + first.getEndOffset()) / 2;
        View[] views = new View[] { vf.create(first), vf.create(second) };
        view.replace(0, 0, views);
        assertEquals(-1, view.getViewIndexAtPosition(-1));
        assertEquals(0, view.getViewIndexAtPosition(first.getStartOffset()));
        assertEquals(0, view.getViewIndexAtPosition(middle));
        assertEquals(1, view.getViewIndexAtPosition(first.getEndOffset()));
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

     * Tests <code>getViewIndexAtPosition()</code> when views represent portions
     * of elements.
     */
    public void testGetViewIndexAtPositionPartial() {
        assertEquals(0, view.getViewCount());
        final ViewFactory vf = new ChildrenFactory();
        final Element first = root.getElement(0);
        final Element second = root.getElement(1);
        final int middle = (first.getStartOffset() + first.getEndOffset()) / 2;
        View[] views = new View[] { new ElementPartView(first, first.getStartOffset(), middle),
                new ElementPartView(first, middle, first.getEndOffset()), vf.create(second) };
        view.replace(0, 0, views);
        assertEquals(-1, view.getViewIndexAtPosition(-1));
        assertEquals(0, view.getViewIndexAtPosition(first.getStartOffset()));
        assertEquals(0, view.getViewIndexAtPosition(middle - 1));
        assertEquals(1, view.getViewIndexAtPosition(middle));
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

    }

    public void testLoadChildren() {
        assertNull(view.layoutPool);
        assertNull(view.getViewFactory());
        view.loadChildren(new ChildrenFactory());
        assertNotNull(view.layoutPool);
        assertSame(view, view.layoutPool.getParent());
        assertSame(root, view.layoutPool.getElement());
        assertEquals(0, view.layoutPool.getViewCount());
    }
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

    public void testLoadChildrenWithFactory() {
        view = new FlowViewImplWithFactory(root, View.Y_AXIS);
        assertNull(view.layoutPool);
        assertNotNull(view.getViewFactory());
        view.loadChildren(new ChildrenFactory());
        assertNotNull(view.layoutPool);
        assertSame(view, view.layoutPool.getParent());
        assertSame(root, view.layoutPool.getElement());
        assertEquals(root.getElementCount(), view.layoutPool.getViewCount());
    }
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

        assertEquals(Integer.MAX_VALUE, (int) view.getMaximumSpan(View.X_AXIS));
        assertEquals(Integer.MAX_VALUE, (int) view.getMaximumSpan(View.Y_AXIS));
    }

    public void testGetSpanNoRowFlexible() throws Exception {
        ChildrenFactory factory = new ChildrenFactory();
        factory.makeFlexible();
        view = new FlowViewImplWithFactory(root, View.Y_AXIS, factory);
        view.loadChildren(null);
        assertEquals(0, view.getViewCount());
        view.layoutPool.replace(1, view.layoutPool.getViewCount() - 1, null);
        assertEquals(1, view.layoutPool.getViewCount());
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

        assertEquals(Integer.MAX_VALUE, (int) view.getMaximumSpan(View.X_AXIS));
        assertEquals(0, (int) view.getMaximumSpan(View.Y_AXIS));
    }

    public void testGetSpanOneRowNoChildrenFlexible() throws Exception {
        ChildrenFactory factory = new ChildrenFactory();
        factory.makeFlexible();
        view = new FlowViewImplWithFactory(root, View.Y_AXIS, factory);
        view.loadChildren(null);
        assertEquals(0, view.getViewCount());
        view.layoutPool.replace(1, view.layoutPool.getViewCount() - 1, null);
        assertEquals(1, view.layoutPool.getViewCount());
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

        assertEquals(Integer.MAX_VALUE, (int) view.getMaximumSpan(View.X_AXIS));
        assertEquals(Integer.MAX_VALUE, (int) view.getMaximumSpan(View.Y_AXIS));
    }

    public void testGetSpanOneRowOneChildFlexible() throws Exception {
        ChildrenFactory factory = new ChildrenFactory();
        factory.makeFlexible();
        view = new FlowViewImplWithFactory(root, View.Y_AXIS, factory);
        view.loadChildren(null);
        assertEquals(0, view.getViewCount());
        view.layoutPool.replace(1, view.layoutPool.getViewCount() - 1, null);
        assertEquals(1, view.layoutPool.getViewCount());
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

    protected static class FlowViewImplWithFactory extends FlowViewImpl {
        private final ViewFactory factory;

        public FlowViewImplWithFactory(final Element element, final int axis) {
            this(element, axis, new ChildrenFactory());
        }
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

        assertEquals(0.5f, view.getAlignment(View.X_AXIS), 0);
        assertEquals(0.5f, view.getAlignment(View.Y_AXIS), 0);
    }

    public void testGetAlignmentFlexible() {
        factory = new ChildrenFactory();
        ((ChildrenFactory)factory).makeFlexible();
        view = new ListViewImpl(listU);

        assertEquals(0.5f, view.getAlignment(View.X_AXIS), 0);
        assertEquals(0.5f, view.getAlignment(View.Y_AXIS), 0);
View Full Code Here

Examples of javax.swing.text.ViewTestHelpers.ChildrenFactory

            public void exceptionalAction() throws Exception {
                view.getLayoutViewCount();
            }
        });
        view.layoutPool = new BoxView(paragraph, View.Y_AXIS);
        ((CompositeView) view.layoutPool).loadChildren(new ChildrenFactory());
        assertTrue(paragraph.getElementCount() > 0);
        assertEquals(paragraph.getElementCount(), view.getLayoutViewCount());
    }
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.