Examples of LayoutModule


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

                    ivalue = 0;
                }
                attributes.setMarginWidth(ivalue);

                // Get the module.
                LayoutModule module = context.getLayoutModule();

                module.writeOpenSegment(attributes);
                module.writeCloseSegment(attributes);
            }
        } catch (IOException e) {
            throw new RendererException(
                    exceptionLocalizer.format("renderer-error",
                            instance.getFormat()), e);
View Full Code Here

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

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

                LayoutModule module = context.getLayoutModule();
                FormInstance formInstance = (FormInstance) instance;

                FormatInstance childInstance =
                        context.getFormatInstance(
                                child, instance.getIndex());

                // If the page contained an XFForm element
                if (formInstance.getPreambleBuffer(false) != null ||
                        formInstance.getContentBuffer(false) != null ||
                        formInstance.getPostambleBuffer(false) != null) {
                   
                    // Write out the form and contained layouts
                    FormAttributes attributes = factory.createFormAttributes();
                    attributes.setForm(form);

                    module.writeOpenForm(attributes);

                    OutputBuffer buffer =
                            formInstance.getPreambleBuffer(false);
                    if (buffer != null) {
                        module.writeFormPreamble(buffer);
                    }

                    context.renderFormat(childInstance);

                    buffer = formInstance.getPostambleBuffer(false);
                    if (buffer != null) {
                        module.writeFormPostamble(buffer);
                    }

                    module.writeCloseForm(attributes);
                } else {
                    // Ignore the form, and just write the contained layouts
                    // NOTE: this is only here for backwards compatibility
                    // because otherwise if you add content to form's child
                    // panes from "outside" the form (and never created the
View Full Code Here

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

        // Get the attributes.
        RowIteratorPaneAttributes attributes = (RowIteratorPaneAttributes)
                paneInstance.getAttributes();

        // Get the module.
        LayoutModule module = context.getLayoutModule();

        // Write out our pane preamble
        module.writeOpenRowIteratorPane(attributes);

        if (logger.isDebugEnabled()) {
            logger.debug("RowIteratorPane.writeOutput() for "
                         + pane.getName());
        }

        // Concatenate together the entire contents of all of the
        // content buffers
        Iterator itr = paneInstance.getBufferIterator();
        while (itr.hasNext()) {
            Object o = itr.next();
            if (o instanceof OutputBuffer) {
                OutputBuffer contentBuffer = (OutputBuffer) o;

                if (!contentBuffer.isEmpty()) {
                    // Copy the attributes because the rendering process
                    // destroys the styles.
                    RowIteratorPaneAttributes paneElementAttributes =
                            new RowIteratorPaneAttributes();
                    paneElementAttributes.copy(attributes);

                    // Write out the element preamble
                    module.writeOpenRowIteratorPaneElement(
                            paneElementAttributes);

                    // Write out the contents of this buffer, trim off
                    // any leading or trailing white space.
                    module.writeRowIteratorPaneElementContents(contentBuffer);

                    // Write out the element postamble
                    module.writeCloseRowIteratorPaneElement(
                            paneElementAttributes);
                }
            }
        }

        // Write out our pane postamble
        module.writeCloseRowIteratorPane(attributes);
    }
View Full Code Here

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

            logger.debug("ColumnIteratorFormat.writeOutput() for "
                         + pane.getName());
        }

        // Get the module.
        LayoutModule module = context.getLayoutModule();

        // Write out our pane preamble
        module.writeOpenColumnIteratorPane(attributes);

        Iterator itr =
                paneInstance.getBufferIterator();
        while (itr.hasNext()) {
            Object o = itr.next();
            if (o instanceof OutputBuffer) {
                OutputBuffer contentBuffer = (OutputBuffer) o;
                if (!contentBuffer.isEmpty()) {

                    // Copy the attributes because the rendering process
                    // destroys the styles.
                    ColumnIteratorPaneAttributes paneElementAttributes =
                            new ColumnIteratorPaneAttributes();
                    paneElementAttributes.copy(attributes);

                    // Write out the element preamble
                    module.writeOpenColumnIteratorPaneElement(
                            attributes);

                    // Write out the contents of this buffer, trim off
                    // any leading or trailing white space.
                    module.writeColumnIteratorPaneElementContents(
                            contentBuffer);

                    // Write out the element postamble
                    module.writeCloseColumnIteratorPaneElement(
                            attributes);
                }
            }
        }

        // Write out our pane postamble
        module.writeCloseColumnIteratorPane(attributes);
    }
View Full Code Here

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

                    attributes.setRowHeights(rowHeights);
                    attributes.setRowHeightUnits(rowHeightUnits);
                }

                // Get the module.
                LayoutModule module = context.getLayoutModule();

                module.writeOpenSegmentGrid(attributes);

                // Write out children
                int index;
                for (int r = 0; r < rows; r += 1) {
                    for (int c = 0; c < columns; c += 1) {
                        index = r * columns + c;
                        Format child = grid.getChildAt(index);
                        if (child != null) {
                            FormatInstance childInstance =
                                    context.getFormatInstance(child,
                                            instance.getIndex());
                            context.renderFormat(childInstance);
                        } else {
                            if (logger.isDebugEnabled()) {
                                logger.debug("SegmentGridRenderer.render: " +
                                        "child r" + r + ", c" + c +
                                        " is null");
                            }
                        }
                    }
                }

                module.writeCloseSegmentGrid(attributes);
            }
        } catch (IOException e) {
            throw new RendererException(
                    exceptionLocalizer.format("renderer-error",
                            instance.getFormat()), e);
View Full Code Here

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

            }

            NDimensionalIndex childIndex = parentIndex.addDimension();

            // Get the module.
            LayoutModule module = context.getLayoutModule();

            // Retrieve the TemporalIterator's child and ensure that it
            // only has a single child.
            int numChildren = temporal.getNumChildren();
            if (numChildren != 1) {
                throw new RendererException(exceptionLocalizer.format(
                        "render-temporal-iterator-multiple-children"));
            }
            Format child = temporal.getChildAt(0);

            // Use the open/closeSlide method in the protocols to create
            // the slide. Visit each child and then close the slide. Do
            // this temporal.TEMPORAL_ITERATOR_CELL_COUNT times to generate
            // the slides
            for (int rowLoop = 0, index = 0; rowLoop < elements;
                 rowLoop++) {

                context.setCurrentFormatIndex(childIndex);
                attributes.setDuration(timeValueArray[index]);
                module.writeOpenSlide(attributes);

                FormatInstance childInstance = context.getFormatInstance(
                        child, childIndex);
                context.renderFormat(childInstance);

                module.writeCloseSlide(attributes);

                // If this is not the last slide then move onto the next slide.
                if (rowLoop + 1 < elements) {
                    childIndex = childIndex.incrementCurrentFormatIndex(1);
                    // Increment the index if it is less than the array length.
View Full Code Here

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

        attributes.setBackLinkText(paneInstance.getLinkFromText());

        // If the output is going to be dissected then write a protocol
        // specific marker in the text which the protocol parser will
        // recognise.
        LayoutModule module = context.getLayoutModule();
        module.writeOpenDissectingPane(attributes);
        super.renderPaneInstance(context, abstractPaneInstance);
        module.writeCloseDissectingPane(attributes);
    }
View Full Code Here

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

        PaneAttributes attributes = abstractPaneInstance.getAttributes();
        attributes.setPane(pane);
        attributes.setFormat(pane.getParent());

        // Get the module.
        LayoutModule module = context.getLayoutModule();

        module.writeOpenPane(attributes);

        if (logger.isDebugEnabled()) {
            logger.debug("Pane.writeOutput() for " + pane.getName());
        }

        // Write out the contents of the content buffer
        OutputBuffer contentBuffer =
                abstractPaneInstance.getCurrentBuffer(false);

        // Write out the contents of this buffer, trim off any leading
        // or trailing white space.
        if (contentBuffer != null) {
            module.writePaneContents(contentBuffer);
        }

        // Write out our pane postamble
        attributes.setFormat(pane.getParent());
        module.writeClosePane(attributes);
    }
View Full Code Here

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

                             FormatRendererContext formatRendererContext)
            throws IOException, RendererException {

        NDimensionalIndex index = NDimensionalIndex.ZERO_DIMENSIONS;

        LayoutModule module = formatRendererContext.getLayoutModule();

        // Save the current DeviceLayoutContext to restore later.

        // Set the current device layout context.
        formatRendererContext.pushDeviceLayoutContext(context);

        RuntimeDeviceLayout deviceLayout = formatRendererContext.getDeviceLayout();

        LayoutAttributes attributes = factory.createLayoutAttributes();
        attributes.setDeviceLayoutContext(context);

        // Get the style sheet associated with the layout and push it into the
        // styling engine.
        RuntimeDeviceLayout runtimeDeviceLayout = context.getDeviceLayout();
        CompiledStyleSheet layoutStyleSheet =
                runtimeDeviceLayout.getCompiledStyleSheet();

        // Set up the styling engine with the applicable style sheets.
        FormatStylingEngine formatStylingEngine =
                formatRendererContext.getFormatStylingEngine();
        // First add the layout style sheet into the styling engine.
        formatStylingEngine.pushStyleSheet(layoutStyleSheet);
        // Then add the theme style sheet(s) into the styling engine.
        CompiledStyleSheetCollection themeStyleSheets =
                context.getThemeStyleSheets();
        if (themeStyleSheets != null) {
            themeStyleSheets.pushAll(formatStylingEngine);
        }
        // else, allow tests to run without doing the above. Dodgy.

        // Process a nested inclusion, this is done after the page context has been
        // updated in order to make sure that the nesting depth is correct.
        boolean inclusion = (context.getIncludingDeviceLayoutContext() != null);

        if (inclusion) {
            module.beginNestedInclusion();
        }

        module.writeOpenLayout(attributes);

        Fragment fragment = formatRendererContext.getCurrentFragment();
        if (fragment == null) {
            if (logger.isDebugEnabled()) {
                String name =
                        deviceLayout != null ? deviceLayout.getName():null;
                logger.debug("Writing out the Layout named "
                             + name + " to the page");

                // Write the format tree

            }
            Format root = deviceLayout.getRootFormat();
            if (root != null) {
                FormatInstance rootInstance =
                        formatRendererContext.getFormatInstance(
                                root, index);
                formatRendererContext.renderFormat(rootInstance);
            } else {
                if (logger.isDebugEnabled()) {
                    logger.debug("Empty layout");
                }
            }

        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("Writing out the fragment named "
                             + fragment.getName() + " to the page");
            }
            // Write out the fragment and the fragment link list which contains
            // links to the fragment's parent and peer fragments.
            if (!module.getSupportsFragmentLinkListTargetting()) {
                // Write out parent/peer fragment link list *after* the fragment.
                // This is necessary as the fragment link list is being appended to
                // the existing content and must therefore come after it.

                // First, write out the fragment itself
                FormatInstance fragmentInstance =
                        formatRendererContext.getFormatInstance(
                                fragment, index);
                formatRendererContext.renderFormat(fragmentInstance);

                // Then, write out the parent/peer fragment link list.
                writeFragmentLinkList(fragment, formatRendererContext);
            } else {
                // Write out parent/peer fragment link list *before* the fragment.
                // This is necessary as the fragment link list is going into it's
                // own pane which would be empty if we tried to render it before
                // creating them.

                // First, write out parent/peer fragment link list.
                writeFragmentLinkList(fragment, formatRendererContext);
                // Then, write out the fragment itself.
                FormatInstance fragmentInstance =
                        formatRendererContext.getFormatInstance(
                                fragment, index);

                formatRendererContext.renderFormat(fragmentInstance);
            }

        }

        // Write the link to the default segment if necessary.
        SegmentLinkWriter segmentLinkWriter =
                formatRendererContext.getSegmentLinkWriter();
        segmentLinkWriter.writeDefaultSegmentLink();

        module.writeCloseLayout(attributes);

        // Finish processing the nested inclusion.
        if (inclusion) {
            module.endNestedInclusion();
        }

        // Clean up the styling information we added to the styling engine.
        // This should be done in reverse order.
        // First we remove the theme style sheet(s).
View Full Code Here

Examples of y.module.LayoutModule

        //        try {
        // fToolbar.updateUndoRedoButtons(fCommandController.canUndo(),fCommandController.canRedo());
        // getGraphElementsVisibilityController().updateGraphElementsVisibility();
        final DependencyGraph graph = (DependencyGraph) fGraphView.getGraph2D();
        if (doLayout) {
            final LayoutModule layoutModule = graph.getLayoutModule();

            layoutModule.addModuleListener(new ModuleListener() {
                public void moduleEventHappened(ModuleEvent event) {
                    if (event.getEventType() == ModuleEvent.TYPE_MODULE_MAIN_RUN_FINISHED) {
                        if (postLayout != null) {
                            postLayout.updateSelection();
                        }
//                        fGraphView.fitContent();
                        fGraphView.updateView();
//                        graph.updateViews();
                    } else if (event.getEventType() == ModuleEvent.TYPE_MODULE_DISPOSED) {
                        layoutModule.removeModuleListener(this);
                    }
                }
            });

            if (preLayout != null) {
                preLayout.updateSelection();
            }
            sLogger.info("Do graph layout " + getSelectionString());
            layoutModule.start(graph);
        } else {
//            fGraphView.fitContent();
            fGraphView.updateView();
//            graph.updateViews();
        }
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.