Examples of NDimensionalIndex


Examples of com.volantis.mcs.layouts.NDimensionalIndex

        fr = FormatReferenceParser.parsePane(paneName, context);
        assertEquals("stem not as",
                     "beer",
                     fr.getStem());
        assertEquals("instance not as",
                     new NDimensionalIndex(new int[1], 0),
                     fr.getIndex());
    }
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

        //Create a new pane
        Pane pane = (Pane) createPane();
        //Pretend to get the buffers for two different format instances
        int[] idx = { 2 };
        PaneInstance ctx2 = (PaneInstance) dlContext.getFormatInstance(pane,
                new NDimensionalIndex(idx));
        ctx2.getCurrentBuffer().writeText("non-empty");
        idx[0] = 5;
        PaneInstance ctx5 = (PaneInstance) dlContext.getFormatInstance(pane,
                new NDimensionalIndex(idx));
        ctx5.getCurrentBuffer().writeText("non-empty");
        temporal.setChildAt(pane, 0);
        //Render the format
        TemporalFormatIteratorInstance sfi =
                new TemporalFormatIteratorInstance(
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

        //Create a new pane
        Pane pane = (Pane) createPane();
        //Pretend to get the buffers for two different format instances
        int[] idx = { 2 };
        PaneInstance ctx2 = (PaneInstance) dlContext.getFormatInstance(pane,
                new NDimensionalIndex(idx));
        ctx2.getCurrentBuffer().writeText("non-empty");
        idx[0] = 5;
        PaneInstance ctx5 = (PaneInstance) dlContext.getFormatInstance(pane,
                new NDimensionalIndex(idx));
        ctx5.getCurrentBuffer().writeText("non-empty");
        temporal.setChildAt(pane, 0);
        //Render the format
        TemporalFormatIteratorInstance sfi =
                new TemporalFormatIteratorInstance(
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

        //Create a new pane
        Pane pane = (Pane) createPane();
        //Pretend to get the buffers for two different format instances
        int[] idx = { 2 };
        PaneInstance ctx2 = (PaneInstance) dlContext.getFormatInstance(pane,
                new NDimensionalIndex(idx));
        ctx2.getCurrentBuffer().writeText("non-empty");
        idx[0] = 5;
        PaneInstance ctx5 = (PaneInstance) dlContext.getFormatInstance(pane,
                new NDimensionalIndex(idx));
        ctx5.getCurrentBuffer().writeText("non-empty");
        temporal.setChildAt(pane, 0);
        //Render the format
        TemporalFormatIteratorInstance sfi =
                new TemporalFormatIteratorInstance(
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

            paneName = pane.getName();
        }

        FormatReference formatRef =
                FormatReferenceParser.parsePane(paneName, pageContext);
        NDimensionalIndex paneIndex = formatRef.getIndex();

        if (null == pane) {
            // get hold of the Pane via it's FormatReference
            pane = pageContext.getPane(formatRef.getStem());
            if (null == pane) {
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

    private NDimensionalIndex createIndex(
            String stem,
            int[] userIndeces,
            FormatNamespace namespace) {

        NDimensionalIndex index = NDimensionalIndex.ZERO_DIMENSIONS;

        Format format = context.getFormat(stem, namespace);

        if (format != null) {
            int dims = format.getDimensions();
            int[] indeces;
            int limit = Math.min(dims, userIndeces.length);
            indeces = new int[dims];
            System.arraycopy(userIndeces, 0, indeces, 0, limit);

            // If there are extra dimensions to be initialized, do so
            // explicitly
            for (int i = limit; i < dims; i++) {
                indeces[i] = 0;
            }

            index = new NDimensionalIndex(indeces, limit);
        }

        return index;
    }
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

        }

        FormatReference formatRef =
                FormatReferenceParser.parse(regionName, pageContext);
        Region region = pageContext.getRegion(formatRef.getStem());
        NDimensionalIndex regionIndex = formatRef.getIndex();

        if (region == null) {
            logger.info("region-missing", new Object[]{attributes.getName()});
            skipped = true;
            return SKIP_ELEMENT_BODY;
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

        String paneName = attributes.getPane();
        if (paneName != null) {
            FormatReference formatRef =
                    FormatReferenceParser.parsePane(paneName, pageContext);
            Pane pane = pageContext.getPane(formatRef.getStem());
            NDimensionalIndex paneIndex = formatRef.getIndex();

            if (pane == null) {
                skipped = true;
                return SKIP_ELEMENT_BODY;
            }
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

            }
            TemporalFormatIterator temporal =
                    (TemporalFormatIterator)instance.getFormat();

            // Get the parent index and hang on to it.
            NDimensionalIndex parentIndex = instance.getIndex();
            if (logger.isDebugEnabled()) {
                logger.debug("Parent index is " + parentIndex);
            }

            // Get this temporal format iterator's properties
            IteratorSizeConstraint cellConstraint =
                    temporal.getMaxCellConstraint();

            int elements;
            // Determine no. of elements to render
            if (cellConstraint.isFixed()) {
                elements = cellConstraint.getMaximumValue();
            } else {
                // Get maximum number of cells to be rendered.
                IteratedFormatInstanceCounter instanceCounter =
                        context.getInstanceCounter();
                int cells = instanceCounter.getMaxInstances(
                        temporal, parentIndex);
                if (logger.isDebugEnabled()) {
                    logger.debug("cells=" + cells);
                }

                elements = cellConstraint.getConstrained(cells);
            }

            SlideAttributes attributes = factory.createSlideAttributes();
            String timeValues = (String) temporal.getAttribute(
                    TemporalFormatIterator.TEMPORAL_ITERATOR_CLOCK_VALUES);

            // If this is a space or (for backwards-compatibility) a comma
            // separated list of time values stick 'em into an array
            String timeValueArray[];
            String separator = null;

            if (timeValues.indexOf(',') > -1) {
                separator = ",";
            } else if (timeValues.indexOf(' ') > -1) {
                separator = " ";
            }

            if (separator != null) {
                StringTokenizer st = new StringTokenizer(timeValues,
                                                         separator);
                int index = 0;
                timeValueArray = new String[st.countTokens()];
                while (st.hasMoreTokens()) {
                    timeValueArray[index++] = st.nextToken();
                }
            } else {
                timeValueArray = new String[]{timeValues};
            }

            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.
                    // The duration will be the value of the last duration if
                    // there are more slides.
                    index += (index < timeValueArray.length - 1 ? 1 : 0);
                }
View Full Code Here

Examples of com.volantis.mcs.layouts.NDimensionalIndex

                if (layoutDim <= 0) {
                    ref = new FormatReference(
                            stem,
                            NDimensionalIndex.ZERO_DIMENSIONS);
                } else {
                    NDimensionalIndex tail =
                                createIndex(formatRef, layoutDim);
                    ref = new FormatReference(stem, tail);
                }
            } else {
                ref = new FormatReference(formatRef,
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.