Package com.volantis.mcs.layouts

Examples of com.volantis.mcs.layouts.Fragment


        activateAndSetDeviceLayout();

        assertSame(pane, context.getPane("pane"));

        Fragment fragment = new Fragment(canvasLayout);
        Format dp = new DissectingPane(canvasLayout);
        dp.setName("dissectingPane");
        canvasLayout.removeFormat(dp);
        fragment.addFormat(dp);

        activateAndSetDeviceLayout();

        context.setCurrentFragment(fragment);
        assertSame(dp, context.getPane("dissectingPane"));
View Full Code Here


    /**
     * Test the setCurrentFragment() method.
     */
    public void testSetCurrentFragment() throws RepositoryException {
        Fragment fragment = new Fragment(canvasLayout);
        activateAndSetDeviceLayout();

        context.setCurrentFragment(fragment);

        assertSame(fragment, context.getCurrentFragment());

        Format pane = new Pane(canvasLayout);
        pane.setName("pane");


        assertSame(pane, context.getPane("pane"));

        Format dp = new DissectingPane(canvasLayout);
        dp.setName("dissectingPane");
        canvasLayout.removeFormat(dp);
        fragment.addFormat(dp);

        context.setCurrentFragment(fragment);

        assertNull(context.getPane("pane"));

        assertSame(dp, context.getPane("dissectingPane"));

        Fragment fragment2 = new Fragment(canvasLayout);

        context.setCurrentFragment(fragment2);

        assertSame(pane, context.getPane("pane"));
        assertNull(context.getPane("dissectingPane"));
View Full Code Here

     */
    public void testUpdateFormFragmentationState() throws RepositoryException {
        // The layout consists of an outer fragment that contains an inner
        // fragment which contains a grid. The grid has two fragmented form
        // fields containing panes.
        Fragment outerFrag = new Fragment(canvasLayout);
        outerFrag.setName("outerFrag");
        canvasLayout.setRootFormat(outerFrag);

        Fragment innerFrag = new Fragment(canvasLayout);
        innerFrag.setName("innerFrag");
        innerFrag.setParent(outerFrag);

        FormFragment formFrag1 = new FormFragment(canvasLayout);
        formFrag1.setName("formFrag1");

        FormFragment formFrag2 = new FormFragment(canvasLayout);
        formFrag2.setName("formFrag2");

        Form form = new Form(canvasLayout);
        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);

View Full Code Here

        });
        // Fragmentation stores it's state in the page generation cache.
        pageContext.setPageGenerationCache(new PageGenerationCache());

        FragmentLinkWriter writer = new DefaultFragmentLinkWriter(pageContext);
        Fragment source = new Fragment(canvasLayout);
        Fragment destination = new Fragment(canvasLayout);

        // Render and check that we have the default fragment style.
        writer.writeFragmentLink(formatRendererContext, source, destination,
                false, false);
        compareStringToBuffer("<fragmentLink styleClass=\"fraglinks\"/>",
View Full Code Here

        });
        // Fragmentation stores it's state in the page generation cache.
        pageContext.setPageGenerationCache(new PageGenerationCache());

        FragmentLinkWriter writer = new DefaultFragmentLinkWriter(pageContext);
        Fragment source = new Fragment(canvasLayout);
        Fragment destination = new Fragment(canvasLayout);

        // Render and check that we have the default fragment style.
        writer.writeFragmentLink(formatRendererContext, source, destination,
                false, false);
        compareStringToBuffer("<fragmentLink styleClass=\"fraglinks\"/>",
View Full Code Here

                    // caching is not supported for fragmented pages
                    if (cachingDirectives != null) {
                        cachingDirectives.disable();
                    }

                    Fragment fragment = (Fragment)instance.getFormat();
                    Format child = fragment.getChildAt(0);

                    // If there is no child then there is nothing to write,
                    // not even a link.
                    if (child == null) {
                        return;
                    }

                    Fragment currentFragment =
                            context.getCurrentFragment();

                    // If the page is not being fragmented, then write out
                    // the children.
                    if (currentFragment == null) {
View Full Code Here

    public Format getFormat(String name, FormatNamespace namespace) {
        Format format = null;
        // Get the format scope.
        FormatScope formatScope = null;
        // Attempt to get it from the fragment first
        final Fragment currentFragment = getCurrentFragment();
        if (currentFragment != null) {
            formatScope = currentFragment.getFormatScope();
        }

        // If it doesn't match a fragment, then try in the layout.
        if (formatScope == null) {
            formatScope = getDeviceLayout().getFormatScope();
View Full Code Here

    /**
     * This is called after the format and the instance have been set and allows
     * the sub class to do any initialisation which depends on those values.
     */
    public void initialise() {
        Fragment fragment = (Fragment) format;
        this.linkToText = fragment.getLinkText();
        this.linkFromText = fragment.getBackLinkText();
        super.initialise();
    }
View Full Code Here

    }

    // Javadoc inherited from super class.
    protected boolean isEmptyImpl() {

        Fragment currentFragment = context.getCurrentFragment();
        Fragment fragment = (Fragment) format;

        Format child = fragment.getChildAt(0);

        if (child != null) {
            if (currentFragment == null || fragment == currentFragment) {
                return context.isFormatEmpty(child);
            } else {
View Full Code Here

     * Get the FormatScope initializing it first if necessary.
     *
     * @return An initialized FormatScope.
     */
    private FormatScope getFormatScope() {
        final Fragment currentFragment =
            getDeviceLayoutContext().getCurrentFragment();
        if (currentFragment != null) {
            final FormatScope fragmentScope = currentFragment.getFormatScope();
            if (fragmentScope != null) {
                return fragmentScope;
            }
        }
        return getDeviceLayout().getFormatScope();
View Full Code Here

TOP

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

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.