Examples of LayoutBuilder


Examples of com.volantis.mcs.accessors.LayoutBuilder

    }


    public RuntimeDeviceLayout createDeviceLayout(boolean inTemporal)
            throws LayoutException {
        LayoutBuilder builder = new LayoutBuilder(new RuntimeLayoutFactory());
        builder.createLayout(LayoutType.CANVAS);
        if(inTemporal){
            builder.pushFormat(FormatType.TEMPORAL_FORMAT_ITERATOR.getTypeName(),0);
            builder.setAttribute(FormatConstants.NAME_ATTRIBUTE, "temporal");
            builder.setAttribute(TemporalFormatIterator.TEMPORAL_ITERATOR_CELLS,
                    "variable");
            builder.setAttribute(TemporalFormatIterator.TEMPORAL_ITERATOR_CELL_COUNT,
                                "5");
            builder.setAttribute(TemporalFormatIterator.TEMPORAL_ITERATOR_CLOCK_VALUES,
                                "1,2,3,4,5");
        }
        builder.pushFormat(FormatType.GRID.getTypeName(),0);
        builder.setAttribute(Grid.COLUMNS_ATTRIBUTE,"1");
        builder.setAttribute(Grid.ROWS_ATTRIBUTE,"2");
        builder.attributesRead();
        builder.createSubComponent(Grid.COLUMN_FORMAT_TYPE,0);
        builder.attributesRead();
        builder.createSubComponent(Grid.ROW_FORMAT_TYPE,0);
        builder.attributesRead();
        builder.pushFormat(FormatType.PANE.getTypeName(),0);
        builder.setAttribute(FormatConstants.NAME_ATTRIBUTE,"one");
        builder.setAttribute(FormatConstants.DESTINATION_AREA_ATTRIBUTE,"Text");
        builder.attributesRead();
        //pop pane one
         builder.popFormat();

        builder.pushFormat(FormatType.PANE.getTypeName(),1);
        builder.setAttribute(FormatConstants.NAME_ATTRIBUTE,"two");
        builder.setAttribute(FormatConstants.DESTINATION_AREA_ATTRIBUTE,"Image");
        builder.attributesRead();
        //pop pane two
        builder.popFormat();
        // pop grid
        builder.popFormat();
        //if required pop temporal
        if(inTemporal){
            builder.popFormat();
        }

        // Activate the device layout.
        RuntimeDeviceLayout runtimeDeviceLayout =
                RuntimeDeviceLayoutTestHelper.activate(builder.getLayout());

        return runtimeDeviceLayout;
    }
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

        return writer.toString();
    }

    public RuntimeDeviceLayout createDeviceLayout(boolean inTemporal)
            throws LayoutException {
        LayoutBuilder builder = new LayoutBuilder(new RuntimeLayoutFactory());
        builder.createLayout(LayoutType.CANVAS);
        if(inTemporal){
            builder.pushFormat(FormatType.TEMPORAL_FORMAT_ITERATOR.getTypeName(),0);
            builder.setAttribute(FormatConstants.NAME_ATTRIBUTE, "temporal");
            builder.setAttribute(TemporalFormatIterator.TEMPORAL_ITERATOR_CELLS,
                    "variable");
            builder.setAttribute(TemporalFormatIterator.TEMPORAL_ITERATOR_CELL_COUNT,
                                "5");
            builder.setAttribute(TemporalFormatIterator.TEMPORAL_ITERATOR_CLOCK_VALUES,
                                "1,2,3,4,5");
        }
        builder.pushFormat(FormatType.GRID.getTypeName(),0);
        builder.setAttribute(Grid.COLUMNS_ATTRIBUTE,"1");
        builder.setAttribute(Grid.ROWS_ATTRIBUTE,"2");
        builder.attributesRead();
        builder.createSubComponent(Grid.COLUMN_FORMAT_TYPE,0);
        builder.attributesRead();
        builder.createSubComponent(Grid.ROW_FORMAT_TYPE,0);
        builder.attributesRead();
        builder.pushFormat(FormatType.PANE.getTypeName(),0);
        builder.setAttribute(FormatConstants.NAME_ATTRIBUTE,"one");
        builder.setAttribute(FormatConstants.DESTINATION_AREA_ATTRIBUTE,"Text");
        builder.attributesRead();
        //pop pane one
         builder.popFormat();

        builder.pushFormat(FormatType.PANE.getTypeName(),1);
        builder.setAttribute(FormatConstants.NAME_ATTRIBUTE,"two");
        builder.setAttribute(FormatConstants.DESTINATION_AREA_ATTRIBUTE,"Image");
        builder.attributesRead();
        //pop pane two
        builder.popFormat();
        // pop grid
        builder.popFormat();
        //if required pop temporal
        if(inTemporal){
            builder.popFormat();
        }

        // Activate the device layout.
        RuntimeDeviceLayout runtimeDeviceLayout =
                RuntimeDeviceLayoutTestHelper.activate(builder.getLayout());

        return runtimeDeviceLayout;
    }
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

         // todo: later: layout builder is from the pre-xdime accessors.
         // We probably should not be using it. We can read one in from internal
         // xml file in a static initialiser the same way we load default
         // stylesheets.
         LayoutBuilder builder = new LayoutBuilder(
                 new RuntimeLayoutFactory());

         // here the anonymous layout device name is being used to specifically
         // identify the region as the anonymous one. This is then used when
         // creating the anonymous region to allow it not to specify a name.
         builder.createLayout(LayoutType.CANVAS);
         builder.setAnonymous(true);
         builder.pushFormat(FormatType.REGION.getTypeName(), 0);
         builder.setAttribute(FormatConstants.WIDTH_ATTRIBUTE, "100");
         builder.setAttribute(FormatConstants.WIDTH_UNITS_ATTRIBUTE,
                              FormatConstants.WIDTH_UNITS_VALUE_PERCENT);
         builder.attributesRead();
         builder.popFormat();
         Layout layout = builder.getLayout();

         InternalPolicyFactory policyFactory = (InternalPolicyFactory)
                 PolicyFactory.getDefaultInstance();
         InternalLayoutContentBuilder layoutContent =
                 policyFactory.createLayoutContentBuilder();
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

        extends TestCaseAbstract {

    protected RuntimeDeviceLayout createRuntimeDeviceLayout()
        throws Exception {

        LayoutBuilder builder = new LayoutBuilder(new RuntimeLayoutFactory());

        // Create the layout.
        builder.createLayout(LayoutType.CANVAS);

        // Push spatial
        builder.pushFormat(FormatType.SPATIAL_FORMAT_ITERATOR.getTypeName(), 0);
        builder.setAttribute(SpatialFormatIterator.ROW_STYLE_CLASSES, "r1 r2");
        builder.setAttribute(SpatialFormatIterator.COLUMN_STYLE_CLASSES, "c1 c2 c3");
        builder.attributesRead();

        // Push grid
        builder.pushFormat(FormatType.GRID.getTypeName(), 0);
        builder.setAttribute(Grid.COLUMNS_ATTRIBUTE, "3");
        builder.setAttribute(Grid.ROWS_ATTRIBUTE, "2");
        builder.attributesRead();

        // Push panes.
        for (int i = 0; i < 6; i += 1) {
            builder.pushFormat(FormatType.PANE.getTypeName(), i);
            builder.setAttribute(FormatConstants.NAME_ATTRIBUTE, "Pane" + i);
            builder.attributesRead();
             builder.popFormat();
        }

        // Pop grid
        builder.popFormat();

        // Pop spatial
        builder.popFormat();

        Layout layout = builder.getLayout();

        RuntimeDeviceLayout runtimeDeviceLayout =
                RuntimeDeviceLayoutTestHelper.activate(layout);

        return runtimeDeviceLayout;
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

public class GridRuleBuilderTestCase
    extends FormatRuleBuilderTestAbstract {

    public void testStyling() throws Exception {

        LayoutBuilder builder = new LayoutBuilder(new RuntimeLayoutFactory());

        // Create the layout.
        builder.createLayout(LayoutType.CANVAS);

        // Push grid
        builder.pushFormat(FormatType.GRID.getTypeName(), 0);
        builder.setAttribute(Grid.COLUMNS_ATTRIBUTE, "3");
        builder.setAttribute(Grid.ROWS_ATTRIBUTE, "2");
        builder.setAttribute(FormatConstants.BACKGROUND_COLOUR_ATTRIBUTE, "red");
        builder.setAttribute(FormatConstants.BORDER_WIDTH_ATTRIBUTE, "2");
        builder.setAttribute(FormatConstants.CELL_PADDING_ATTRIBUTE, "4");
        builder.setAttribute(FormatConstants.CELL_SPACING_ATTRIBUTE, "6");
        builder.setAttribute(FormatConstants.WIDTH_ATTRIBUTE, "100");
        builder.setAttribute(FormatConstants.WIDTH_UNITS_ATTRIBUTE,
                             FormatConstants.WIDTH_UNITS_VALUE_PERCENT);
        builder.setAttribute(FormatConstants.HEIGHT_ATTRIBUTE, "50");
        builder.setAttribute(FormatConstants.HORIZONTAL_ALIGNMENT_ATTRIBUTE,
                             FormatConstants.HORIZONTAL_ALIGNMENT_VALUE_RIGHT);
        builder.setAttribute(FormatConstants.VERTICAL_ALIGNMENT_ATTRIBUTE,
                             FormatConstants.VERTICAL_ALIGNMENT_VALUE_CENTER);
        builder.attributesRead();

        // Row 0
        builder.createSubComponent(Grid.ROW_FORMAT_TYPE, 0);
        builder.setAttribute(FormatConstants.HEIGHT_ATTRIBUTE, "10");
        builder.attributesRead();

        // Row 1
        builder.createSubComponent(Grid.ROW_FORMAT_TYPE, 1);
        builder.setAttribute(FormatConstants.HEIGHT_ATTRIBUTE, "20");
        builder.setAttribute(FormatConstants.HEIGHT_UNITS_ATTRIBUTE,
                             FormatConstants.HEIGHT_UNITS_VALUE_PERCENT);
        builder.attributesRead();

        // Column 0
        builder.createSubComponent(Grid.COLUMN_FORMAT_TYPE, 0);
        builder.setAttribute(FormatConstants.WIDTH_ATTRIBUTE, "15");
        builder.attributesRead();

        // Column 1
        builder.createSubComponent(Grid.COLUMN_FORMAT_TYPE, 1);
        builder.setAttribute(FormatConstants.WIDTH_ATTRIBUTE, "25");
        builder.setAttribute(FormatConstants.WIDTH_UNITS_ATTRIBUTE,
                             FormatConstants.WIDTH_UNITS_VALUE_PIXELS);
        builder.attributesRead();

        // Push panes.
        String[] horizontalAlign = new String[]{
            FormatConstants.HORIZONTAL_ALIGNMENT_VALUE_LEFT,
            FormatConstants.HORIZONTAL_ALIGNMENT_VALUE_CENTER,
            FormatConstants.HORIZONTAL_ALIGNMENT_VALUE_RIGHT,
            FormatConstants.HORIZONTAL_ALIGNMENT_VALUE_LEFT,
            FormatConstants.HORIZONTAL_ALIGNMENT_VALUE_CENTER,
            FormatConstants.HORIZONTAL_ALIGNMENT_VALUE_RIGHT,
        };
        String[] verticalAlign = new String[] {
            FormatConstants.VERTICAL_ALIGNMENT_VALUE_TOP,
            FormatConstants.VERTICAL_ALIGNMENT_VALUE_CENTER,
            FormatConstants.VERTICAL_ALIGNMENT_VALUE_BOTTOM,
            FormatConstants.VERTICAL_ALIGNMENT_VALUE_TOP,
            FormatConstants.VERTICAL_ALIGNMENT_VALUE_CENTER,
            FormatConstants.VERTICAL_ALIGNMENT_VALUE_BOTTOM,
        };
        for (int i = 0; i < 6; i += 1) {

            // Make an empty cell.
            if (i == 4) continue;

            builder.pushFormat(FormatType.PANE.getTypeName(), i);
            builder.setAttribute(FormatConstants.NAME_ATTRIBUTE, "Pane" + i);
            builder.setAttribute(FormatConstants.HORIZONTAL_ALIGNMENT_ATTRIBUTE,
                                 horizontalAlign[i]);
            builder.setAttribute(FormatConstants.VERTICAL_ALIGNMENT_ATTRIBUTE,
                                 verticalAlign[i]);
            builder.attributesRead();
             builder.popFormat();
        }

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

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

        Styles actualStyles;
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

     *
     */
    protected RuntimeDeviceLayout createDeviceLayout()
            throws RepositoryException {

        LayoutBuilder builder = new LayoutBuilder(new RuntimeLayoutFactory());

        builder.createLayout(LayoutType.CANVAS);

        builder.pushFormat("Pane", 0);

        builder.setAttribute("Name", "pane");

        builder.popFormat();

        Layout layout = builder.getLayout();

        return RuntimeDeviceLayoutTestHelper.activate(layout);
    }
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

    protected RuntimeDeviceLayout createDeviceLayout()
            throws RepositoryException {

        RuntimeDeviceLayout result = null;

        LayoutBuilder builder = new LayoutBuilder(new RuntimeLayoutFactory());

        builder.createLayout(LayoutType.CANVAS);

        builder.pushFormat("Pane", 0);

        builder.setAttribute("Name", "pane");

        builder.setAttribute(FormatConstants.HEIGHT_ATTRIBUTE, "100");
        builder.setAttribute(FormatConstants.WIDTH_ATTRIBUTE, "8");
        builder.setAttribute(FormatConstants.WIDTH_UNITS_ATTRIBUTE,
                             FormatConstants.WIDTH_UNITS_VALUE_PIXELS);

        builder.popFormat();

        Layout layout = builder.getLayout();
        result = RuntimeDeviceLayoutTestHelper.activate(layout);

        return result;
    }
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

        // todo: later: layout builder is from the pre-xdime accessors.
        // We probably should not be using it. We can read one in from internal
        // xml file in a static initialiser the same way we load default
        // stylesheets.
        LayoutBuilder builder = new LayoutBuilder(
                new RuntimeLayoutFactory());

        // here the anonymous layout device name is being used to specifically
        // identify the region as the anonymous one. This is then used when
        // creating the anonymous region to allow it not to specify a name.
        builder.createLayout(LayoutType.CANVAS);
        builder.setAnonymous(true);
        builder.pushFormat(FormatType.REGION.getTypeName(), 0);
        builder.setAttribute(FormatConstants.WIDTH_ATTRIBUTE, "100");
        builder.setAttribute(FormatConstants.WIDTH_UNITS_ATTRIBUTE,
                             FormatConstants.WIDTH_UNITS_VALUE_PERCENT);
        builder.attributesRead();
        builder.popFormat();
        Layout layout = builder.getLayout();

        InternalPolicyFactory policyFactory = (InternalPolicyFactory)
                PolicyFactory.getDefaultInstance();
        InternalLayoutContentBuilder layoutContent =
                policyFactory.createLayoutContentBuilder();
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

        // todo: later: layout builder is from the pre-xdime accessors.
        // We probably should not be using it. We can read one in from internal
        // xml file in a static initialiser the same way we load default
        // stylesheets.
        LayoutBuilder builder = new LayoutBuilder(
                new RuntimeLayoutFactory());

        // here the anonymous layout device name is being used to specifically
        // identify the region as the anonymous one. This is then used when
        // creating the anonymous region to allow it not to specify a name.
        builder.createLayout(LayoutType.CANVAS);
        builder.setAnonymous(true);
        builder.pushFormat(FormatType.REGION.getTypeName(), 0);
        builder.setAttribute(FormatConstants.WIDTH_ATTRIBUTE, "100");
        builder.setAttribute(FormatConstants.WIDTH_UNITS_ATTRIBUTE,
                             FormatConstants.WIDTH_UNITS_VALUE_PERCENT);
        builder.attributesRead();
        builder.popFormat();
        Layout layout = builder.getLayout();

        InternalPolicyFactory policyFactory = (InternalPolicyFactory)
                PolicyFactory.getDefaultInstance();
        InternalLayoutContentBuilder layoutContent =
                policyFactory.createLayoutContentBuilder();
View Full Code Here

Examples of com.volantis.mcs.accessors.LayoutBuilder

     */
    protected CanvasLayout createDeviceLayout(String name,
                                              String deviceName)
        throws RepositoryException {

        LayoutBuilder builder = new LayoutBuilder(new RuntimeLayoutFactory());

        builder.createLayout(LayoutType.CANVAS);

        builder.pushFormat("Pane", 0);

        builder.setAttribute("Name", "pane");

        builder.popFormat();

        return builder.getCanvasLayout();
    }
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.