Package com.volantis.mcs.layouts

Examples of com.volantis.mcs.layouts.Grid


                CLASS_NAME,
                classname);

//        context.setStyleClassName(CLASS_NAME_2);

        Grid grid = new Grid(null);
        grid.setInstance(1);
        grid.setBorderWidth("10");

//        classname = protocol.getFormatStyleClass(grid);

        assertEquals("Grid classname does not match",
                CLASS_NAME_2,
View Full Code Here


                     CLASS_NAME,
                     classname);

//        context.setStyleClassName(CLASS_NAME_2);

        Grid grid = new Grid(null);
        grid.setInstance(1);
        grid.setBorderWidth("10");

//        classname = protocol.getFormatStyleClass(grid);

        assertEquals("Grid classname does not match",
                     CLASS_NAME_2,
View Full Code Here

        pageContext = new TestMarinerPageContext();
        format = new Pane(canvasLayout);
        format.setName("pane");
        pageContext.addPaneMapping((Pane)format);
        grid = new Grid(canvasLayout);
        grid.setName("grid");
        //logger.debug("setup");

        // Activate the device layout.
        RuntimeDeviceLayout runtimeDeviceLayout =
View Full Code Here

        Format format3 = new Pane(canvasLayout);
        format3.setName("pane3");
        pageContext.addPaneMapping((Pane)format3);
        format3.setParent(tfi);

        Grid grid2 = new Grid(canvasLayout);
        grid2.setName("grid2");      
        grid2.setRows(2);
        grid2.setColumns(1);
        grid2.setParent(sfi2);
        grid2.insertChildAt(format2, 0);
        format2.setParent(grid2);
       
        grid2.insertChildAt(tfi, 1);
        tfi.setParent(grid2);

        grid2.setParent(sfi2);

        grid.setRows(2);
        grid.setColumns(1);
        grid.setParent(sfi);
        grid.insertChildAt(format, 0);
View Full Code Here

        pane = new Pane(null);
        paneContext = new TestPaneInstance();

        deviceLayoutContext = new TestDeviceLayoutContext();

        grid = new Grid(null);
        grid.setInstance(0);

        gridInstance = new GridInstance(NDimensionalIndex.ZERO_DIMENSIONS);
        gridInstance.setDeviceLayoutContext(deviceLayoutContext);
        gridInstance.setFormat(grid);
View Full Code Here

        form.setName("form");
        form.addFormFragment(formFrag1);
        form.addFormFragment(formFrag2);
        form.setParent(innerFrag);

        Grid grid = new Grid(canvasLayout);
        grid.setRows(2);
        grid.setColumns(1);
        grid.setParent(form);
        grid.attributesHaveBeenSet();
        formFrag1.setParent(grid);
        formFrag2.setParent(grid);

        Pane pane1 = new Pane(canvasLayout);
        pane1.setName("pane1");
        pane1.setParent(formFrag1);

        Pane pane2 = new Pane(canvasLayout);
        pane2.setName("pane2");
        pane2.setParent(formFrag2);

        MarinerURL requestURL = context.getRequestURL(false);
        requestURL.setParameterValue("vfrag", "f1");

        try {
            // Set the children of the formats.
            outerFrag.setChildAt(innerFrag, 0);
            innerFrag.setChildAt(grid, 0);
            grid.setChildAt(formFrag1, 0);
            grid.setChildAt(formFrag2, 1);
            formFrag1.setChildAt(pane1, 0);
            formFrag2.setChildAt(pane2, 0);

            // Set up the FormatScopes correctly.
            DeviceLayoutReplicator replicator = new DeviceLayoutReplicator();
View Full Code Here

            FormatRendererContext context,
            GridInstance gridInstance, GridFormatModule module,
            boolean[] requiredRows, boolean[] requiredColumns, int columns)
            throws RendererException {

        Grid grid = (Grid) gridInstance.getFormat();

        // Initialise the attributes.
        GridAttributes attributes = gridInstance.getAttributes();

        TableLayers layers = new TableLayers();

        // Style the grid, and then style all of its columns.
        FormatStylingEngine formatStylingEngine =
                context.getFormatStylingEngine();
        Styles formatStyles = formatStylingEngine.startStyleable(
                grid, grid.getStyleClass());
        layers.setLayer(TableLayers.TABLE, formatStyles);

        attributes.setStyles(formatStyles);
        attributes.setLayers(layers);

        // Style the columns so that we can pick up the height and any
        // other properties associated with the column's style class
        // if any.

        // Style the group of columns. This is to simply group the grid columns
        // together within a single element to simplify the use of those
        // selectors that rely on the position of an element within its parent,
        // e.g. nth-child().
        Styles columnGroupStyles = formatStylingEngine.startStyleable(
                SyntheticStyleableFormat.GRID_COLUMNS,
                null);
        layers.setLayer(TableLayers.COLUMN_GROUP, columnGroupStyles);

        Styles[] columnStyles = getColumnStyles(grid, formatStylingEngine,
                requiredColumns);

        formatStylingEngine.endStyleable(
                SyntheticStyleableFormat.GRID_COLUMNS);

        if (logger.isDebugEnabled()) {
            logger.debug("Grid.writeOutput()");
        }

        attributes.setColumns(columns);

        // Should the order of the columns be reversed,
        // false = 0...n, true = n...0
        boolean reversed =
                DirectionHelper.isDirectionReversed(grid, formatStyles);

        // Open the grid, even if no rows are written
        attributes.setFormat(grid);
        module.writeOpenGrid(attributes);

        // Style the group of rows. See the comment in getColumnStyles().
        Styles bodyStyles = formatStylingEngine.startStyleable(
                SyntheticStyleableFormat.GRID_BODY, null);
        layers.setLayer(TableLayers.ROW_GROUP, bodyStyles);

        // Write out children
        for (int r = 0; r < grid.getRows(); r++) {

            // If the row is completely empty then ignore it.
            if (requiredRows[r]) {
                writeRow(r, context, reversed, columnStyles, gridInstance,
                        requiredColumns, module, columns, layers);
View Full Code Here

            boolean rightToLeft, Styles[] columnStyles,
            GridInstance gridInstance, boolean[] requiredColumns,
            GridFormatModule module, int columns, TableLayers layers)
            throws RendererException {

        Grid grid = (Grid) gridInstance.getFormat();

        Row row = grid.getRow(rowPosition);

        FormatStylingEngine formatStylingEngine =
                context.getFormatStylingEngine();
        Styles rowStyles = formatStylingEngine.startStyleable(
                row, row.getStyleClass());
View Full Code Here

        layers.setLayer(TableLayers.CELL, childStyles);

        layers.mergeColumnStylesIntoCellStyles(
                childStyles, row == 0, column == 0);

        Grid grid = (Grid) gridInstance.getFormat();

        GridChildAttributes childAttributes =
                gridInstance.getChildAttributes();

        childAttributes.resetAttributes();

        childAttributes.setRow(row);
        childAttributes.setColumn(column);
        childAttributes.setStyles(childStyles);
        childAttributes.setFormat(grid);
        childAttributes.setColumns(columns);
        childAttributes.setLayers(layers);

        // Write out the per-child preamble, even if the child
        // is null because otherwise the grid will be
        // misaligned.

        module.writeOpenGridChild(childAttributes);

        Format child = grid.getChildAt(row, column);

        if (child != null) {
            FormatInstance childInstance =
                    context.getFormatInstance(
                            child, gridInstance.getIndex());
View Full Code Here

            builder.attributesRead();
             builder.popFormat();
        }

        // Pop grid
        Grid grid = (Grid) builder.popFormat();

        Layout layout = builder.getLayout();
        FormatStylingEngine formatStylingEngine =
                createFormatStylingEngine(layout);

        Styles actualStyles;

        actualStyles = formatStylingEngine.startStyleable(grid, null);

        assertEquals("Grid Styles",
                     "background-color: red; " +
                     "background-image: none; " +
                     "border: solid 2px; " +
                     "border-spacing: 6px 6px; " +
                     "height: 50px; " +
                     "padding: 0; " +
                     "vertical-align: middle; " +
                     "text-align: right; " +
                     "width: 100%; ",
                     actualStyles);

        String[] expectedColumnStyles = new String[]{
            "width: 15%",
            "width: 25px",
            "width: auto"
        };
        int columns = grid.getColumns();
        for (int c = 0; c < columns; c += 1) {
            Column column = grid.getColumn(c);

            actualStyles = formatStylingEngine.startStyleable(column, null);
            assertEquals("Column " + c + " Styles",
                         expectedColumnStyles[c],
                         actualStyles,
                         COLUMN_STYLING_PROPERTIES);
            formatStylingEngine.endStyleable(column);
        }

        String[] expectedRowStyles = new String[] {
            "height: 10px; " +
                "text-align: right; " +
                "vertical-align: baseline",

            "height: 20%; " +
                "text-align: right; " +
                "vertical-align: baseline"
        };

        String[][] expectedCellStyles = new String[][] {
            // Row 0
            new String[] {
                "text-align: left; vertical-align: top; padding: 4px",
                "text-align: center; vertical-align: middle; padding: 4px",
                "text-align: right; vertical-align: bottom; padding: 4px",
            },
            // Row 1
            new String[] {
                "text-align: left; vertical-align: top; padding: 4px",
                // This is inherited from the grid.
                "text-align: right; vertical-align: baseline; padding: 4px",
                "text-align: right; vertical-align: bottom; padding: 4px",
            }
        };

        int rows = grid.getRows();
        for (int r = 0; r < rows; r += 1) {
            Row row = grid.getRow(r);

            actualStyles = formatStylingEngine.startStyleable(row, null);
            assertEquals("Row " + r + " Styles",
                         expectedRowStyles[r],
                         actualStyles,
View Full Code Here

TOP

Related Classes of com.volantis.mcs.layouts.Grid

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.