Examples of SegmentGridAttributes


Examples of com.volantis.mcs.protocols.SegmentGridAttributes

        int[] rows = null;
        int[] cols = null;


        SegmentGridAttributes ga = new SegmentGridAttributes();
        // set to null
        ga.setColumnWidths(cols);
        ga.setRowHeights(rows);

        protocol.openSegmentGrid(buffer, ga);

        // test to ensure that null columnWidth and rowHeights produce NO
        // args in the resulting HTML
        String expected = "<frameset border=\"0\" frameborder=\"no\" " +
                "framespacing=\"0\"/>";
        assertEquals("Ensure that null column and row widths do not produce " +
                "attributes", expected, bufferToString(buffer));

        // test to ensure that -1 for row or column attribute will be replaced
        // by "*" (indicating default value for the browser to decide how to
        // render
        expected = "<frameset border=\"0\" frameborder=\"no\" " +
                "framespacing=\"0\" rows=\"*\"/>";
        rows = new int[1];
        rows[0] = -1;
        ga.setRowHeights(rows);
        buffer.clear();
        protocol.openSegmentGrid(buffer, ga);
        assertEquals("Ensure that -1 is replaced by * (rows)", expected,
                bufferToString(buffer));

        // same test as above but for columns
        expected = "<frameset border=\"0\" cols=\"*\" frameborder=\"no\" " +
                "framespacing=\"0\"/>";
        ga.setRowHeights(null);
        ga.setColumnWidths(rows);
        buffer.clear();
        protocol.openSegmentGrid(buffer, ga);
        assertEquals("Ensure -1 is replaced by * (cols)", expected,
                bufferToString(buffer));

        // general test to check substitution of negative values for "*"
        expected = "<frameset border=\"0\" cols=\"*,4,*\" frameborder=\"no\" " +
                "framespacing=\"0\" rows=\"3,*,3\"/>";
        rows = new int[]{3, -100, 3};
        cols = new int[]{-1, 4, -1};
        ga.setRowHeights(rows);
        ga.setColumnWidths(cols);
        buffer.clear();
        protocol.openSegmentGrid(buffer, ga);
        assertEquals("Ensure that general substitution occurs correctly",
                expected, bufferToString(buffer));
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.SegmentGridAttributes

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        int[] rows = null;
        int[] cols = null;
        SegmentGridAttributes ga = new SegmentGridAttributes();
        // set to null
        ga.setColumnWidths(cols);
        ga.setRowHeights(rows);

        rows = new int[]{3, -100, 3};
        cols = new int[]{-1, 4, -1};
        ga.setRowHeights(rows);
        ga.setColumnWidths(cols);
        buffer.clear();
        protocol.openSegmentGrid(buffer, ga);
        assertEquals("Ensure that nothing is returned",
                "", bufferToString(buffer));
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.SegmentGridAttributes

                SegmentGridInstance segmentGridContext =
                        (SegmentGridInstance) instance;

                // Initialise the attributes.
                SegmentGridAttributes attributes =
                        segmentGridContext.getAttributes();

                String value;
                int ivalue;

                value = (String) grid.getAttribute(
                        FormatConstants.BORDER_WIDTH_ATTRIBUTE);
                try {
                    ivalue = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {
                    ivalue = 0;
                }
                attributes.setBorderWidth(ivalue);

                value = (String) grid.getAttribute(
                        FormatConstants.BORDER_COLOUR_ATTRIBUTE);
                attributes.setBorderColor(value);

                value = (String) grid.getAttribute(
                        FormatConstants.FRAME_BORDER_ATTRIBUTE);
                attributes.setFrameBorder("true".equalsIgnoreCase(value));

                value = (String) grid.getAttribute(
                        FormatConstants.FRAME_SPACING_ATTRIBUTE);
                try {
                    ivalue = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {
                    ivalue = 0;
                }
                attributes.setFrameSpacing(ivalue);

                // Make column width array
                int columns = grid.getColumns();

                int columnWidths [] = new int[columns];
                String columnWidthUnits [] = new String[columns];
                for (int i = 0; i < columnWidths.length; i += 1) {
                    Column column = grid.getColumn(i);
                    String width = column.getWidth();
                    if (width != null) {
                        columnWidths[i] = Integer.parseInt(width);
                    } else {
                        columnWidths[i] = -1;
                    }
                    columnWidthUnits[i] = column.getWidthUnits();
                }
                if (columnWidths.length > 0) {
                    attributes.setColumnWidths(columnWidths);
                    attributes.setColumnWidthUnits(columnWidthUnits);
                }

                // Make row height array
                int rows = grid.getRows();
                int rowHeights [] = new int[rows];
                String rowHeightUnits [] = new String[rows];
                for (int i = 0; i < rowHeights.length; i += 1) {
                    Row row = grid.getRow(i);
                    String height = row.getHeight();
                    if (height != null) {
                        rowHeights[i] = Integer.parseInt(height);
                    } else {
                        rowHeights[i] = -1;
                    }
                    rowHeightUnits[i] = row.getHeightUnits();
                }
                if (rowHeights.length > 0) {
                    attributes.setRowHeights(rowHeights);
                    attributes.setRowHeightUnits(rowHeightUnits);
                }

                // Get the module.
                LayoutModule module = context.getLayoutModule();
View Full Code Here

Examples of com.volantis.mcs.protocols.SegmentGridAttributes

     * This method tests the method public void writeOpenSegmentGrid (
     * SegmentGridAttributes ) for the
     * com.volantis.mcs.protocols.VolantisProtocol class.
     */
    public void testWriteOpenSegmentGrid() throws Exception {
        final SegmentGridAttributes attributes =
                (SegmentGridAttributes) ProtocolIntegrationTestHelper.
                provideAttributes(SegmentGridAttributes.class);

        final VolantisProtocol protocol = getProtocol();

View Full Code Here

Examples of com.volantis.mcs.protocols.SegmentGridAttributes

    /**
     * Create a new <code>SegmentGridInstance</code>.
     */
    public SegmentGridInstance(NDimensionalIndex index) {
        super(index);
        attributes = new SegmentGridAttributes();
    }
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.