Package javax.swing

Examples of javax.swing.SizeRequirements


        view = new BlockViewImpl(block, Y_AXIS);

        assertEquals(1, view.getResizeWeight(X_AXIS));
        assertEquals(isHarmony() ? 1 : 0, view.getResizeWeight(Y_AXIS));

        SizeRequirements r = view.calculateMajorAxisRequirements(Y_AXIS, null);
        assertEquals(44, r.minimum);
        assertEquals(400, r.maximum);
        assertEquals(44, (int)view.getMinimumSpan(Y_AXIS));
        assertEquals(400, (int)view.getMaximumSpan(Y_AXIS));
    }
View Full Code Here


        view.setParent(null);
        assertFalse(propertiesMarker.isOccurred());
    }

    public void testCalculateMajorAxisRequirements() {
        SizeRequirements r = view.calculateMajorAxisRequirements(Y_AXIS, null);
        assertEquals(r.preferred, r.minimum);
        assertEquals(0, r.preferred);
        assertEquals(0, r.maximum);

        doc.getStyleSheet().addRule("p {width: 305pt}");
        view.setPropertiesFromAttributes();
        SizeRequirements sr = view.calculateMajorAxisRequirements(Y_AXIS, r);
        assertSame(r, sr);
        assertEquals(0, r.minimum);
        assertEquals(0, r.preferred);
        assertEquals(0, r.maximum);
View Full Code Here

        assertEquals(400, maxSpan);


        doc.getStyleSheet().addRule("p {height: 45pt}");
        view.setPropertiesFromAttributes();
        SizeRequirements r = view.calculateMajorAxisRequirements(Y_AXIS, null);
        assertEquals(44, r.minimum); // 45 - 15 def. margin = 30 < 44
        assertEquals(isHarmony() ? 112 : 44, r.preferred);
        assertEquals(400, r.maximum);

        doc.getStyleSheet().addRule("p {height: 60pt}");
View Full Code Here

        assertEquals(45, r.preferred);
        assertEquals(45, r.maximum);
    }

    public void testCalculateMinorAxisRequirements() {
        SizeRequirements r = view.calculateMinorAxisRequirements(X_AXIS, null);
        assertEquals(r.preferred, r.minimum);
        assertEquals((int)getMaxChildSpan(X_AXIS), r.preferred);
        assertEquals(Integer.MAX_VALUE, r.maximum);

        doc.getStyleSheet().addRule("p {height: 40pt}");
        view.setPropertiesFromAttributes();
        SizeRequirements sr = view.calculateMinorAxisRequirements(X_AXIS, r);
        assertSame(r, sr);
        assertEquals(r.preferred, r.minimum);
        assertEquals((int)getMaxChildSpan(X_AXIS), r.preferred);
        assertEquals(Integer.MAX_VALUE, r.maximum);
View Full Code Here

        assertEquals(100, prefSpan);


        doc.getStyleSheet().addRule("p {width: 46pt}");
        view.setPropertiesFromAttributes();
        SizeRequirements r = view.calculateMinorAxisRequirements(X_AXIS, null);
        assertEquals(50, r.minimum);
        assertEquals(isHarmony() ? 100 : 50, r.preferred);
        assertEquals(Integer.MAX_VALUE, r.maximum);

        doc.getStyleSheet().addRule("p {width: 146pt}");
View Full Code Here

        assertEquals(146, r.maximum);
    }

    public void testCalculateMinorAxisRequirementsOrthogonal() {
        view = new BlockViewImpl(block, X_AXIS);
        SizeRequirements r = view.calculateMinorAxisRequirements(Y_AXIS, null);
        assertEquals(r.preferred, r.minimum);
        assertEquals(0, r.preferred);
        assertEquals(Integer.MAX_VALUE, r.maximum);

        doc.getStyleSheet().addRule("p {width: 305pt}");
        view.setPropertiesFromAttributes();
        SizeRequirements sr = view.calculateMinorAxisRequirements(Y_AXIS, r);
        assertSame(r, sr);
        assertEquals(r.preferred, r.minimum);
        assertEquals(0, r.preferred);
        assertEquals(Integer.MAX_VALUE, r.maximum);
View Full Code Here

        final int[] spans = new int[view.getViewCount()];
        final int target = 305;
        ((BlockViewImpl)view).layoutMinorAxis(target, X_AXIS, offsets, spans);
        for (int i = 0; i < view.getViewCount(); i++) {
            View child = view.getView(i);
            SizeRequirements sr =
                new SizeRequirements((int)child.getMinimumSpan(X_AXIS),
                                     (int)child.getPreferredSpan(X_AXIS),
                                     (int)child.getMaximumSpan(X_AXIS),
                                     child.getAlignment(X_AXIS));
            assertEquals(getChildSpan(target, sr), spans[i]);
            assertEquals(getChildOffset(target, spans[i], sr), offsets[i]);
View Full Code Here

        final int[] spans = new int[view.getViewCount()];
        final int target = 451;
        ((BlockViewImpl)view).layoutMinorAxis(target, X_AXIS, offsets, spans);
        for (int i = 0; i < view.getViewCount(); i++) {
            View child = view.getView(i);
            SizeRequirements sr =
                new SizeRequirements((int)child.getMinimumSpan(X_AXIS),
                                     (int)child.getPreferredSpan(X_AXIS),
                                     (int)child.getMaximumSpan(X_AXIS),
                                     child.getAlignment(X_AXIS));
            assertEquals(getChildSpan(target, sr), spans[i]);
            assertEquals(getChildOffset(target, spans[i], sr), offsets[i]);
View Full Code Here

    /**
     * Tests <code>baselineRequirements</code> with ordinary children along
     * major axis - Y.
     */
    public void testBaselineRequirements01() {
        SizeRequirements sr;
        final int axis = Y_AXIS;
        sr = view.baselineRequirements(axis, null);
        // The sizes to the left and to the right from the alignment point
        int left = getLeft(PREFERRED, axis);
        int right = getRight(PREFERRED, axis);
        int size = left + right;
        assertEquals(size, sr.minimum);
        assertEquals(size, sr.preferred);
        assertEquals(size, sr.maximum);
        assertEquals((float) left / (float) size, sr.alignment, 0.00001f);
        SizeRequirements another = view.baselineRequirements(axis, sr);
        assertSame(sr, another);
    }
View Full Code Here

    public void testBaselineRequirements02() {
        if (!isHarmony()) {
            return;
        }
        makeFlexible();
        SizeRequirements sr;
        final int axis = Y_AXIS;
        sr = view.baselineRequirements(axis, null);
        // The sizes to the left and to the right from the alignment point
        int minL = getLeft(MINIMUM, axis);
        int minR = getRight(MINIMUM, axis);
View Full Code Here

TOP

Related Classes of javax.swing.SizeRequirements

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.