if (!instance.isEmpty()) {
if (logger.isDebugEnabled()) {
logger.debug("TemporalFormatIterator.writeOutput");
}
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