Package com.volantis.mcs.layouts

Examples of com.volantis.mcs.layouts.NDimensionalIndex


    // found then return and skip the element body.
    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


            // Make sure the reference reflects the actual number of
            // dimensions
            if (layoutDim == 0) {
                return NDimensionalIndex.ZERO_DIMENSIONS;
            } else {
                return new NDimensionalIndex(new int[layoutDim], 0);
            }
        }
                       
        int nextPos = pos;
       
        // Store the ints in between each of the dots of the format reference's
        // tail in an array of ints.
        int[] coords;
        int specified = -1;

        try {
            coords = new int[layoutDim];
           
            boolean reachedEnd = false;
           
            // By trying to get the correct number of dimensions we deal with
            // references with too many indices by ignoring those on the right.
            for (int counter = 0; counter < layoutDim; counter++) {
                if (!reachedEnd) {
                    nextPos = formatRef.indexOf('.', pos + 1);
                    if (nextPos != -1) {
                        coords[counter] =
                            Integer.parseInt(formatRef.substring(pos + 1,
                                                                 nextPos));
                        pos = nextPos;
                    } else {
                        coords[counter] =
                            Integer.parseInt(formatRef.substring(pos + 1));
                        reachedEnd = true;
                    }

                    // We've had at least this many indices specified
                    specified = counter;
                } else {
                    // If we have reached the end of the string before we have
                    // got all the dimensions that we need we assume that those
                    // present refer to the outermost format iterators. Missing
                    // indices assume a value of zero e.g. if we expect 2
                    // dimensions and only one is supplied we interpret test.2
                    // as test.2.0
                    coords[counter] = 0;
                }
            }
        } catch (NullPointerException e) {
            throw new IllegalArgumentException(
                "formatRef " + formatRef + " is invalid");
        }

        return new NDimensionalIndex(coords, specified + 1);
    }
View Full Code Here

            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

                || rows == 0) {
            return false;
        }


        NDimensionalIndex childIndex =
                formatInstance.getIndex().addDimension();

        // Retrieve the (must be) single SpatialIterator's child
        int numChildren = spatial.getNumChildren();
        final Format child = spatial.getChildAt(0);
        if (numChildren != 1) {
            throw new IllegalStateException(exceptionLocalizer.format(
                    "render-spatial-iterator-multiple-children"));
        }

        for (int row = 0; row < rows; row++) {

            for (int col = 0; col < columns; col++) {

                // Map the 2D (row, col) coordinates down onto the
                // 1D sequence of instances.
                int position = coordinateConverter.getPosition(col, row);

                // Set and store the new child index.
                childIndex = childIndex.setCurrentFormatIndex(position);
                formatRendererContext.setCurrentFormatIndex(childIndex);

                // Handle the spatial cell processing
                FormatInstance instance =
                        formatRendererContext.getFormatInstance(
View Full Code Here

        // also rendered)

        EndlessStringArray rowStyleClasses = spatial.getRowStyleClasses();
        EndlessStringArray columnStyleClasses = spatial.getColumnStyleClasses();

        NDimensionalIndex childIndex =
                formatInstance.getIndex().addDimension();

        // Retrieve the number of rows and columns.
        int rows = converter.getRows();
        //        assert rows > 0;
        int columns = converter.getColumns();
        //        assert columns > 0;

        // Open the spatial format iterator.
        module.writeOpenSpatialFormatIterator(spatialAttributes);

        // Get the styles for the spatial iterator columns. Do these up front
        // as they will be merged into the styles for the cells later on.

        // Style the group of columns. This simply groups the spatial columns
        // together within a single element to simplify the use of those
        // selectors that rely on the position of an element within its parent,
        // e.g. nth-child().
        Styles groupStyles = formatStylingEngine.startStyleable(
                SyntheticStyleableFormat.SPATIAL_COLUMNS,
                null);
        setDisplayStyle(groupStyles, DisplayKeywords.TABLE_ROW_GROUP);
        spatialLayers.setLayer(TableLayers.COLUMN_GROUP, groupStyles);

        Styles[] columnStyles = getColumnStyles(
                formatStylingEngine, columns, requiredSlices,
                columnStyleClasses);

        formatStylingEngine.endStyleable(
                SyntheticStyleableFormat.SPATIAL_COLUMNS);

        // Style the group of rows. See the comment in getColumnStyles().
        Styles spatialBodyStyles = formatStylingEngine.startStyleable(
                SyntheticStyleableFormat.SPATIAL_BODY,
                null);
        setDisplayStyle(spatialBodyStyles, DisplayKeywords.TABLE_ROW_GROUP);
        spatialLayers.setLayer(TableLayers.ROW_GROUP, spatialBodyStyles);

        for (int row = 0; row < rows; row++) {
            if (!requiredSlices.isSpatialRowRequired(row)) {
                continue;
            }

            Styles rowStyles = formatStylingEngine.startStyleable(
                    SyntheticStyleableFormat.SPATIAL_ROW,
                    rowStyleClasses.get(row));

            // Make sure that the row has the correct display.
            setDisplayStyle(rowStyles, DisplayKeywords.TABLE_ROW);
            spatialLayers.setLayer(TableLayers.ROW, rowStyles);

            openSpatialRow(rowStyles);

            for (int column = 0; column < columns; column++) {
                if (!requiredSlices.isSpatialColumnRequired(column)) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("No spatial cell required at [" +
                                column + "," + row + "]");
                    }
                    continue;
                }

                spatialLayers.setLayer(TableLayers.COLUMN,
                        columnStyles[column]);

                Styles cellStyles = formatStylingEngine.startStyleable(
                        SyntheticStyleableFormat.SPATIAL_CELL, null);

                // Make sure that the cell has the correct display.
                setDisplayStyle(cellStyles, DisplayKeywords.TABLE_CELL);

                spatialLayers.setLayer(TableLayers.CELL, cellStyles);

                openSpatialCell(cellStyles, row, column);

                // Map the 2D (row, col) coordinates down onto the
                // 1D sequence of instances.
                int position = converter.getPosition(column, row);

                // Set and store the new child index.
                childIndex = childIndex.setCurrentFormatIndex(position);
                context.setCurrentFormatIndex(childIndex);

                writeChild(childIndex, row, column);

                closeSpatialCell();
View Full Code Here

    /** Create the value for this reference if it does not already exist */
    private void buildValue() {
        if (value==null) {
            StringBuffer buff = new StringBuffer(ref.getStem());
            NDimensionalIndex index = ref.getIndex();
            int[] indicies = index.getIndicies();
            for (int i = 0; i < indicies.length; i++) {
                buff.append('.').append(indicies[i]);
            }
            value = buff.toString();
        }
View Full Code Here

            final SpatialFormatIterator spatial,
            final Styles formatStyles) {

        // Iniitalise the CoordinateConverterChooser so that it can
        // be used to determine the correct CoordinateConverter
        NDimensionalIndex childIndex =
                formatInstance.getIndex().addDimension();
        CoordinateConverterChooser chooser =
                spatial.getCoordinateConverterChooser();
        IteratedFormatInstanceCounter instanceCounter =
                context.getInstanceCounter();
View Full Code Here

                Format format = layoutContext.getFormat(containerName,
                        FormatNamespace.CONTAINER);

                if (format != null) {
                    int dimensions = format.getDimensions();
                    NDimensionalIndex index;
                    if (dimensions > 0) {
                        int[] indeces = new int[dimensions];
                        index = new NDimensionalIndex(indeces);
                    } else {
                        index = NDimensionalIndex.ZERO_DIMENSIONS;
                    }

                    instance = (ContainerInstance) layoutContext.
View Full Code Here

        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

                            (LayoutContentActivator.ContainerPosition) iter.next();
                    final Fragment fragment = position.getFragment();

                    // get the associated fragment instance
                    final int dimensions = fragment.getDimensions();
                    final NDimensionalIndex index;
                    if (dimensions > 0) {
                        index = new NDimensionalIndex(new int[dimensions]);
                    } else {
                        index = NDimensionalIndex.ZERO_DIMENSIONS;
                    }
                    final FragmentInstance fragmentInstance =
                            (FragmentInstance)
View Full Code Here

TOP

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

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.