Package com.volantis.mcs.protocols.renderer.layouts

Examples of com.volantis.mcs.protocols.renderer.layouts.FragmentLinkWriter


        });
        // 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\"/>",
                pageContext.getCurrentOutputBuffer(),
                "Fragment link should have default 'fraglinks' style");

        // set the fragment link class style to 'test'
        source.setAttribute(FormatConstants.FRAGMENT_LINK_STYLE_CLASS_ATTRIBUTE, "test");

        // Re-render and check that we have the correct 'test' fragment style.
        ((DOMOutputBuffer) pageContext.getCurrentOutputBuffer()).clear();
        writer.writeFragmentLink(formatRendererContext, source, destination,
                false, false);
        compareStringToBuffer("<fragmentLink styleClass=\"test\"/>",
                pageContext.getCurrentOutputBuffer(),
                "Fragment link should have explicit 'test' style");
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\"/>",
                pageContext.getCurrentOutputBuffer(),
                "Fragment link should have default 'fraglinks' style");

        // set the fragment link class style to 'test'
        source.setAttribute(FormatConstants.FRAGMENT_LINK_STYLE_CLASS_ATTRIBUTE,
                            "test");

        // Re-render and check that we have the correct 'test' fragment style.
        ((DOMOutputBuffer) pageContext.getCurrentOutputBuffer()).clear();
        writer.writeFragmentLink(formatRendererContext, source, destination,
                false, false);
        compareStringToBuffer("<fragmentLink styleClass=\"test\"/>",
                pageContext.getCurrentOutputBuffer(),
                "Fragment link should have explicit 'test' style");
View Full Code Here

                        }
                        // Write out a fragment link, it should appear as an
                        // independent link as it is in the middle of the page
                        // somewhere rather than in the parent / peer link
                        // list.
                        final FragmentLinkWriter fragmentLinkWriter =
                                context.getFragmentLinkWriter();

                        fragmentLinkWriter.writeFragmentLink(
                                context, currentFragment, fragment,
                                false, false);
                    }
                }
            } else {
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug("Fragment is " + fragment);
            logger.debug("Enclosing fragment is " + enclosingFragment);
        }

        FragmentLinkWriter fragmentLinkWriter =
                context.getFragmentLinkWriter();

        if (enclosingFragment != null) {
            if (fragment.isParentLinkFirst()) {
                fragmentLinkWriter.writeFragmentLink(
                        context, fragment, enclosingFragment, true, true);
                writePeerFragmentLinks(context, fragment);
            } else {
                writePeerFragmentLinks(context, fragment);
                fragmentLinkWriter.writeFragmentLink(
                        context, fragment, enclosingFragment, true, true);
            }
        }
    }
View Full Code Here

        // Only write the links if we have been asked to.
        if (!fragment.getPeerLinks()) {
            return;
        }

        FragmentLinkWriter fragmentLinkWriter =
                context.getFragmentLinkWriter();

        // Walk through the children of the parent (our peers)
        Format parent = fragment.getParent();
        if (parent != null) {
            int numChildren = parent.getNumChildren();
            if (logger.isDebugEnabled()) {
                logger.debug("Searching " + numChildren + " peers");
            }
            for (int child = 0; child < numChildren; child++) {
                // Check if the peer is a fragment
                Format peer = parent.getChildAt(child);
                if (logger.isDebugEnabled()) {
                    logger.debug("Found peer " + peer);
                }
                if ((peer != null)
                        && peer.getFormatType().equals(FormatType.FRAGMENT)) {
                    Fragment peerFragment = (Fragment) peer;
                    // Dont write to ourselves
                    if (!peerFragment.getName().equals(fragment.getName())) {
                        if (logger.isDebugEnabled()) {
                            logger.debug("Adding link to peer fragment"
                                         + peerFragment.getName());
                        }
                        fragmentLinkWriter.writeFragmentLink(
                                context, fragment, peerFragment, true, false);
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.renderer.layouts.FragmentLinkWriter

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.