Package com.volantis.mcs.protocols.layouts

Examples of com.volantis.mcs.protocols.layouts.ContainerInstance


                // write out the option

                // the option is either written to dedicated container instance
                // or the current buffer
                ContainerInstance entryContainerInstance =
                        option.getEntryContainerInstance();
                // Need to fully qualify access to outer class due to bug in
                // in the Sun 1.2 jdk compiler
                DOMOutputBuffer optionBuffer =
                        (null != entryContainerInstance) ?
View Full Code Here


       
        DeviceLayoutContext layoutToPop = pageContext.getDeviceLayoutContext();       
       
        pageContext.popDeviceLayoutContext();               

        ContainerInstance containingInstance =
            pageContext.getCurrentContainerInstance();

        // buffer from annonymous region must be merged
        // with current buffer from instance
        containingInstance.getCurrentBuffer().transferContentsFrom(
            this.anonymousRegionInstance.getCurrentBuffer());
        return result;
    }       
View Full Code Here

        /**
         * Finds entry container name for option
         */
        private String getContainerName(SelectOption option) {
            StringBuffer sb = null;
            ContainerInstance containerInstance = option.getEntryContainerInstance();
            if (containerInstance != null) {
                String containerName = containerInstance.getFormat().getName();
                if (containerName != null) {
                    sb = new StringBuffer(containerName);
                    NDimensionalIndex index = containerInstance.getIndex();
                    int[] indicies = index.getIndicies();
                    if (indicies.length > 0) {
                        sb.append('_').append(indicies[0]);
                    }
                }
View Full Code Here

    /**
     * Override doTextInput in parent to add do connect now meta tag.
     */
    public void doTextInput(XFTextInputAttributes attributes)
            throws ProtocolException {
        ContainerInstance entryContainerInstance;

        // If the entry container is not set then return as there is nothing
        // else we can do.
        if ((entryContainerInstance =
                attributes.getEntryContainerInstance()) == null) {
View Full Code Here

     * Generate checkboxes, radio buttons or options list for xf*selects
     */
    public void doSelectInput(XFSelectAttributes attributes)
            throws ProtocolException {

        ContainerInstance captionContainerInstance;
        ContainerInstance entryContainerInstance;
        String value;
        // Add the caption to the caption container.
        if ((captionContainerInstance =
                attributes.getCaptionContainerInstance()) != null &&
                (value = getPlainText(attributes.getCaption())) != null) {
View Full Code Here

                        resolver.resolveQuotedTextExpression(labelText);
                attributes.setCaption(caption);

                // The caption container instance will have been set to the
                // current container as part of initialising the attributes.
                final ContainerInstance captionContainer =
                        pageContext.getCurrentContainerInstance();
                attributes.setCaptionContainerInstance(captionContainer);
            }
        }
    }
View Full Code Here

                getSpecifiedLayout(layout, pageContext);

        // If a layout was specified, then ensure it is allowed in this context.
        RegionInstance containingRegion = null;
        if (layoutContext != null) {
            ContainerInstance containingInstance =
                        pageContext.getCurrentContainerInstance();

            // Make sure that the containing instance is a region.
            if (containingInstance instanceof RegionInstance) {
                containingRegion = (RegionInstance) containingInstance;
            } else {
                throw new IllegalStateException("Container " +
                        containingInstance.getFormat().getName() +
                        " is not a region");
            }
        }

        // If the parent of the element currently being processed is in an
        // inactive group, then the current element must also be.
        boolean suppressedLayout = false;
        if (parentState != null) {
            if (parentState.isInactiveGroup()) {
                isInactiveGroup = true;
            }
            if (parentState.isSuppressing() && layoutContext != null ||
                    parentState.isInSuppressedLayout()) {
                // if you push a new layout on while the parent is suppressing,
                // all the elements should remain suppressed even if they
                // target valid containers. This is because the layout itself
                // wasn't correctly targetted at a valid container.
                suppressedLayout = true;
            }
        }

        // Get the specified container - may be null.
        ContainerInstance containerInstance =
                getSpecifiedContainer(container, pageContext, layoutContext);

        // Determine the formatting result given the layout and container.
        FormattingResult formattingResult =
                determineFormattingResult(layoutContext, containerInstance,
View Full Code Here

    protected ContainerInstance getSpecifiedContainer(
            StyleValue container,
            MarinerPageContext pageContext,
            DeviceLayoutContext specifiedLayout) {

        ContainerInstance instance = null;
        String containerName = getSpecifiedContainerName(container);

        if (container instanceof StyleFormatReference) {
            StyleFormatReference styleFormatReference =
                    (StyleFormatReference) container;
            FormatReference reference = styleFormatReference.getReference();

            // Try and find the format instance.
            Format format = pageContext.getFormat(reference.getStem(),
                    FormatNamespace.CONTAINER);
            if (format != null) {
                instance = (ContainerInstance) pageContext.getFormatInstance(
                        format, reference.getIndex());
            }

        } else if (containerName != null) {

            final ContainerInstance currentContainer =
                pageContext.getCurrentContainerInstance();
            if (specifiedLayout == null && currentContainer != null &&
                containerName.equals(currentContainer.getFormat().getName())) {
                // if no new layout is specified and the container name is the
                // same as the name of the current container then we can use the
                // current container
                specifiedCurrentContainer = true;
            } else {
View Full Code Here

    private ContainerInstance findContainerInstance(Class instanceClass) {

        if (containerInstanceStack != null) {

            for (int i = containerInstanceStack.size() - 1; i >= 0; i--) {
                ContainerInstance instance = (ContainerInstance)
                        containerInstanceStack.get(i);
                if (instanceClass.isInstance(instance)) {
                    return instance;
                }
            }
View Full Code Here

     *                         be popped. If this is not null and not equal to the ContainerInstance
     *                         on the top of the stack then throw an IllegalStateException.
     */
    public void popContainerInstance(ContainerInstance expectedInstance) {

        ContainerInstance instance = (ContainerInstance) containerInstanceStack.pop();
        if (expectedInstance != null && expectedInstance != instance) {
            throw new IllegalStateException("CONTAINER INSTANCE STACK:"
                                            + " Expected " + expectedInstance
                                            + " popped " + instance);
        }
        if (logger.isDebugEnabled()) {
            logger.debug("CONTAINER INSTANCE STACK: Popped " + instance);
        }

        popOutputBuffer(instance.getCurrentBuffer());

        // End the current content buffer.
        instance.endCurrentBuffer();
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.layouts.ContainerInstance

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.