Examples of DeviceLayoutContext


Examples of com.volantis.mcs.protocols.DeviceLayoutContext

                            "no-suitable-device-layout",
                            new Object[]{layoutName,
                                         getDeviceName()}));
                }

                DeviceLayoutContext deviceLayoutContext =
                        new DeviceLayoutContext();
                deviceLayoutContext.setMarinerPageContext(this);

//                formatRendererContext.pushDeviceLayoutContext(
//                        deviceLayoutContext);

                if (inclusionState) {
                    DeviceLayoutContext idlc
                            = getDeviceLayoutContext();
                    deviceLayoutContext.setIncludingDeviceLayoutContext(idlc);
                    boolean inRegion
                            = (getEnclosingRegionInstance() != null);
                    deviceLayoutContext.setInRegion(inRegion);
View Full Code Here

Examples of com.volantis.mcs.protocols.DeviceLayoutContext

     *
     * @return The inclusion path from the including device layout context, or
     * null.
     */
    private String getIncludingInclusionPath() {
        DeviceLayoutContext including = getIncludingDeviceLayoutContext();
        if (including == null) {
            return null;
            } else {
            return including.getInclusionPath();
            }
            }
View Full Code Here

Examples of com.volantis.mcs.protocols.DeviceLayoutContext

     * Get the including device layout context.
     *
     * @return The including device layout context.
     */
    private DeviceLayoutContext getIncludingDeviceLayoutContext() {
        DeviceLayoutContext current = getDeviceLayoutContext();
        DeviceLayoutContext including =
                current.getIncludingDeviceLayoutContext();
        return including;
        }
View Full Code Here

Examples of com.volantis.mcs.protocols.DeviceLayoutContext

     *
     * @return The short inclusion path from the including device layout
     * context, or null.
     */
    private String getIncludingShortInclusionPath() {
        DeviceLayoutContext including = getIncludingDeviceLayoutContext();
        if (including == null) {
            return null;
        } else {
            return including.getShortInclusionPath();
        }
        }
View Full Code Here

Examples of com.volantis.mcs.protocols.DeviceLayoutContext

     * Get all the information needed to render a Layout.
     *
     * @return The DeviceLayoutContext.
     */
    public DeviceLayoutContext getDeviceLayoutContext() {
        DeviceLayoutContext deviceLayoutContext = null;
        if (deviceLayoutContextStack != null) {
            if (!deviceLayoutContextStack.isEmpty()) {
                deviceLayoutContext =
                        (DeviceLayoutContext) deviceLayoutContextStack.peek();
            }
View Full Code Here

Examples of com.volantis.mcs.protocols.DeviceLayoutContext

            createDeviceLayout("Test Layout", "Master");

        RuntimeDeviceLayout runtimeDeviceLayout =
                RuntimeDeviceLayoutTestHelper.activate(canvasLayout);

        DeviceLayoutContext deviceLayoutContext = new DeviceLayoutContext();
        deviceLayoutContext.setMarinerPageContext(marinerPageContextMock);
        deviceLayoutContext.setDeviceLayout(runtimeDeviceLayout);

        deviceLayoutContextStack.push(deviceLayoutContext);

        /*
         * Pane related mock objects
         */
        Pane pane = new Pane(canvasLayout);

        com.volantis.mcs.protocols.PaneAttributes protocolPaneAttributes =
            new com.volantis.mcs.protocols.PaneAttributes();

        PaneInstanceMock paneInstance = new PaneInstanceMock(
            "mockPaneInstance", expectations,
            NDimensionalIndex.ZERO_DIMENSIONS);
        paneInstance.expects.ignore().returns(false).any();
        // optional for XDIME2.
        paneInstance.expects.setStyleClass(null).any();
        paneInstance.expects.getAttributes().returns(protocolPaneAttributes).any();
        paneInstance.expects.getFormat().returns(pane).any();

        StyleSheetConfiguration styleSheetConfig = new StyleSheetConfiguration();
        volantisMock.expects.getPageHeadingMsg().returns(PAGE_HEADER_COMMENT);
        volantisMock.expects.getStyleSheetConfiguration().returns(
            styleSheetConfig);
       
        volantisMock.expects.getPageTrackerFactory().returns(null).any();

        /*
         * Set expectations on MarinerPageContext Mock
         */
        marinerPageContextMock.expects.getRequestURL(false).returns(
            requestURL).any();

        marinerPageContextMock.expects.getDeviceLayoutContext().does(new MethodAction() {
            public Object perform(MethodActionEvent event) throws Throwable {
                Object result = null;
                if (!deviceLayoutContextStack.empty()) {
                    result = deviceLayoutContextStack.peek();
                }
                return result;
            }
        }).any();
        marinerPageContextMock.fuzzy.pushDeviceLayoutContext(
            mockFactory.expectsInstanceOf(DeviceLayoutContext.class))
            .does(new MethodAction() {
                public Object perform(MethodActionEvent event)
                    throws Throwable {
                    Object context = event.getArgument(
                        DeviceLayoutContext.class);

                    deviceLayoutContextStack.push(context);
                    return null;
                }
            }).any();
        // optional for XDIME2
        marinerPageContextMock.expects.setCanvasHasChildren(false).any();
        marinerPageContextMock.fuzzy.getFormatInstance(
            mockFactory.expectsInstanceOf(Pane.class),
            NDimensionalIndex.ZERO_DIMENSIONS)
            .returns(paneInstance)
            .any();

        InternalProjectFactory factory =
                InternalProjectFactory.getInternalInstance();

//        ProjectMock project = new ProjectMock("project mock", expectations);
        final RuntimeProjectMock project =
                new RuntimeProjectMock("projectMock", expectations);
        project.expects.getPolicySource()
                .returns(factory.createXMLPolicySource(null, ".")).any();

        MethodAction initialiseCanvasAction = new MethodAction() {

            public Object perform(MethodActionEvent event) throws Throwable {
                // Optional for XDIME2.
                marinerPageContextMock.expects.initialisedCanvas().returns(true).any();
                return null;
            }
        };
        marinerPageContextMock.fuzzy.initialise(Boolean.FALSE,
                Boolean.FALSE,
                null,
                null,
                mockFactory.expectsInstanceOf(CompiledStyleSheetCollection.class),
                LAYOUT_NAME).does(initialiseCanvasAction);

        marinerPageContextMock.expects.peekCanvasType().does(new MethodAction() {
            public Object perform(MethodActionEvent event) throws Throwable {
                Object result = null;
                if (!canvasTypeStack.empty()) {
                    result = canvasTypeStack.peek();
                }
                return result;
            }
        }).any();
        marinerPageContextMock.expects.popCanvasType().does(new MethodAction() {
            public Object perform(MethodActionEvent event) throws Throwable {
                Object result = null;
                if (!canvasTypeStack.empty()) {
                    result = canvasTypeStack.pop();
                }
                return result;
            }
        }).any();
        marinerPageContextMock.fuzzy.pushCanvasType(
            mockFactory.expectsInstanceOf(String.class))
            .does(new MethodAction() {
                public Object perform(MethodActionEvent event)
                    throws Throwable {
                    Object context = event.getArgument(String.class);

                    canvasTypeStack.push(context);
                    return null;
                }
            }).any();


        // Since we have pane set for XDIMECP via cdm:pane and for XDIME2 via
        // mcs-container these two will be called twice as we cannot vary the
        // stylesheet per test.
        marinerPageContextMock.expects.pushContainerInstance(paneInstance).any();
        marinerPageContextMock.expects.popContainerInstance(paneInstance).any();

        marinerPageContextMock.expects.getCurrentContainerInstance().returns(paneInstance).any();
        marinerPageContextMock.expects.getCurrentPane().returns(pane).any();

        marinerPageContextMock.expects.updateFragmentationState();
        marinerPageContextMock.expects.getProtocol().returns(protocol).any();
        marinerPageContextMock.expects.getDeviceName().returns("Master");
        marinerPageContextMock.expects.getDevice().returns(device).any();

        // optional for XDIME1?
        marinerPageContextMock.fuzzy.getFormat("pane",
                mockFactory.expectsInstanceOf(FormatNamespace.class))
                .returns(pane).any();
        // optional for XDIME2.
        marinerPageContextMock.expects.getPane("pane").returns(pane).any();
        marinerPageContextMock.fuzzy.pushOutputBuffer(
            mockFactory.expectsInstanceOf(DOMOutputBuffer.class))
            .does(new MethodAction() {
                public Object perform(MethodActionEvent event)
                    throws Throwable {
                    Object buffer = event.getArgument(OutputBuffer.class);

                    outputBufferStack.push(buffer);

                    return null;
                }
            }).any();
        marinerPageContextMock.fuzzy.popOutputBuffer(
            mockFactory.expectsInstanceOf(DOMOutputBuffer.class))
            .does(new MethodAction() {
                public Object perform(MethodActionEvent event)
                    throws Throwable {

                    return outputBufferStack.pop();
                }
            }).any();
        marinerPageContextMock.expects.getCurrentOutputBuffer().does(new MethodAction() {

            public Object perform(MethodActionEvent event) throws Throwable {
                return outputBufferStack.peek();
            }
        }).any();

        RuntimeDeviceTheme runtimeDeviceTheme = createRuntimeDeviceTheme();

        marinerPageContextMock.expects.retrieveThemeStyleSheet(THEME_NAME).
            returns(runtimeDeviceTheme.getCompiledStyleSheet());
       
        marinerPageContextMock.expects.enteringXDIMECPElement().any();
        marinerPageContextMock.expects.insideXDIMECPElement()
                .returns(false).any();
        marinerPageContextMock.expects.exitingXDIMECPElement().any();
        marinerPageContextMock.expects.getEnclosingRegionInstance()
                .returns(null).any();
        marinerPageContextMock.expects.popDeviceLayoutContext()
                .does(new MethodAction() {
                    public Object perform(MethodActionEvent methodActionEvent)
                            throws Throwable {

                        // Don't actually pop this as it prevents the markup
                        // from being generated at the end. NASTY.
                        return deviceLayoutContextStack.peek();
                    }
                }).any();
        setProtocolSpecificExpectations();

        ApplicationContext applicationContext = new ApplicationContext(
            requestContextMock);
        applicationContext.setDevice(device);
        applicationContext.setProtocol(protocol);
        applicationContext.setDissectionSupported(true);
        applicationContext.setFragmentationSupported(true);
        applicationContext.setCanvasTagSupported(true);
        applicationContext.setWMLCSupported(false);

        ExpressionFactory expressionFactory = ExpressionFactory.getDefaultInstance();

        ExpressionContext expressionContext =
            expressionFactory.createExpressionContext(null,
                                                      NamespaceFactory.getDefaultInstance()
                                                      .createPrefixTracker());

        expressionContext.setProperty(MarinerRequestContext.class,
                                      requestContextMock, false);

        final CurrentProjectProviderMock projectProviderMock =
                new CurrentProjectProviderMock("projectProviderMock",
                        expectations);
        projectProviderMock.expects.getCurrentProject().returns(project).any();

        // Add a project provider in for resolving relative policy expressions
        // without a project into absolute IDs containing a project.
        expressionContext.setProperty(CurrentProjectProvider.class,
                projectProviderMock, false);

        // Optional for XDIME2
        marinerPageContextMock.expects.setBrandName(null, false).any();

        marinerPageContextMock.expects.getStylingEngine().returns(
            stylingEngine)
            .any();

        requestContextMock.expects.getApplicationContext().returns(
            applicationContext)
            .any();
        requestContextMock.expects.getMarinerPageContext().returns(
            marinerPageContextMock)
            .any();

        requestContextMock.expects.getEnvironmentContext()
                .returns(environmentContextMock).any();

        requestContextMock.expects.pushProject(project).any();

        requestContextMock.expects.popProject(project).returns(project).any();

        marinerPageContextMock.expects.getEnvironmentContext()
            .returns(environmentContextMock).any();   //  fixed(2);


        environmentContextMock.fuzzy.setAttribute(
                CacheScopeConstant.CACHE_SCOPE_ATTRIBUTE,
                mockFactory.expectsInstanceOf(CacheScopeConstant.class));

        environmentContextMock.expects.getCachingDirectives().returns(null).any();
        environmentContextMock.expects.applyCachingDirectives().any();

        deviceLayoutContext.initialise();

        ListenerEventRegistryMock listenerEventRegistryMock =
                new ListenerEventRegistryMock("listenerEventRegistry",
                        expectations);

View Full Code Here

Examples of com.volantis.mcs.protocols.DeviceLayoutContext

            Styles styles = pattributes.getStyles();
            PropertyValues propertyValues = styles.getPropertyValues();
            ImmutablePropertyValues immutablePropertyValues =
                    propertyValues.createImmutablePropertyValues();

            DeviceLayoutContext dlc = pageContext.getDeviceLayoutContext();
            dlc.setInheritableStyleValues(immutablePropertyValues);

            if (writePage) {
                // Open the canvas page.
                protocol.openCanvasPage(pattributes);
            } else if (inclusion) {
View Full Code Here

Examples of com.volantis.mcs.protocols.DeviceLayoutContext

        }

        TabsContext context = getCurrentContext();

        // pop labels deviceLayoutContext
        DeviceLayoutContext labelsLayoutToPop = context.getPageContext()
                .getDeviceLayoutContext();
        RegionContent labelsRegionContent = new DeviceLayoutRegionContent(
                labelsLayoutToPop);
        context.getPageContext().popDeviceLayoutContext();

        // pop tab's content RegionInstance
        context.getPageContext().popContainerInstance(getContentsRegionInstance());

        DOMOutputBuffer mainBuffer = getCurrentBuffer(protocol);

        Styles contentsTrStyle = StylingFactory.getDefaultInstance()
          .createInheritedStyles(
            protocol.getMarinerPageContext().getStylingEngine()
            .getStyles(), DisplayKeywords.TABLE_ROW);
               
        // Create tr element for labels in main buffer       
        Element labelsTrElem = mainBuffer.openStyledElement("tr", contentsTrStyle);
       
        labelsTrElem.setAttribute("id", protocol.getMarinerPageContext()
                .generateUniqueFCID());
        // set in order to label occupy only area for content
        labelsTrElem.setAttribute("style", "height: 1px");

        setElementLocked(protocol, labelsTrElem);

        // get main RegionInstance
        ContainerInstance containingInstance = context.getPageContext()
                .getCurrentContainerInstance();

        containingInstance.getCurrentBuffer().transferContentsFrom(
                getLabelsRegionInstance().getCurrentBuffer());
       
        renderTabStripFiller(mainBuffer);
        // Increase colspan for tab strip filler
        context.addColspan(1);

        // Close labels tr
        mainBuffer.closeElement("tr");

        // Create tr element for contents in main buffer               
        Element contentsTrElem = mainBuffer.openStyledElement("tr", contentsTrStyle);
       
        contentsTrElem.setAttribute("id", protocol.getMarinerPageContext()
                .generateUniqueFCID());
        setElementLocked(protocol, contentsTrElem);

        // Create td element with proper style
        Styles contentsTdStyle = StylingFactory.getDefaultInstance()
          .createInheritedStyles(
                 protocol.getMarinerPageContext().getStylingEngine()           
            .getStyles(), DisplayKeywords.TABLE_CELL);
       
        Element contentsTdElem = mainBuffer.openStyledElement("td",
                contentsTdStyle);
        String contentId = protocol.getMarinerPageContext()
                .generateUniqueFCID();
        context.setContentId(contentId);
        contentsTdElem.setAttribute("id", contentId);
        contentsTdElem.setAttribute("colspan", "" + context.getColspan());
        setElementLocked(protocol, contentsTdElem);
        contentsTdElem.getStyles().getPropertyValues()
                .setComputedAndSpecifiedValue(
                        StylePropertyDetails.VERTICAL_ALIGN,
                        VerticalAlignKeywords.TOP);

        // Insert tab contents buffer to main buffer
        // mainBuffer.addOutputBuffer(tabsBuffer);

        // pop tab's contents deviceLayoutContext
        DeviceLayoutContext contentsLayoutToPop = context.getPageContext()
                .getDeviceLayoutContext();
        RegionContent contentsRegionContent = new DeviceLayoutRegionContent(
                contentsLayoutToPop);
        context.getPageContext().popDeviceLayoutContext();
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.