001: /**
002: * ===========================================
003: * JFreeReport : a free Java reporting library
004: * ===========================================
005: *
006: * Project Info: http://reporting.pentaho.org/
007: *
008: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
009: *
010: * This library is free software; you can redistribute it and/or modify it under the terms
011: * of the GNU Lesser General Public License as published by the Free Software Foundation;
012: * either version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: * See the GNU Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public License along with this
019: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020: * Boston, MA 02111-1307, USA.
021: *
022: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023: * in the United States and other countries.]
024: *
025: * ------------
026: * LayoutExpressionRuntime.java
027: * ------------
028: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029: */package org.jfree.report.layout.output;
030:
031: import javax.swing.table.TableModel;
032:
033: import org.jfree.report.DataRow;
034: import org.jfree.report.ResourceBundleFactory;
035: import org.jfree.report.function.ExpressionRuntime;
036: import org.jfree.report.function.ProcessingContext;
037: import org.jfree.util.Configuration;
038:
039: /**
040: * Creation-Date: Jan 22, 2007, 12:09:32 PM
041: *
042: * @author Thomas Morgner
043: */
044: public class LayoutExpressionRuntime implements ExpressionRuntime {
045: private DataRow dataRow;
046: private int currentRow;
047: private TableModel data;
048: private ProcessingContext processingContext;
049:
050: public LayoutExpressionRuntime(final DataRow dataRow,
051: final int currentRow, final TableModel data,
052: final ProcessingContext processingContext) {
053: this .processingContext = processingContext;
054: this .dataRow = dataRow;
055: this .currentRow = currentRow;
056: this .data = data;
057: }
058:
059: public ProcessingContext getProcessingContext() {
060: return processingContext;
061: }
062:
063: public Configuration getConfiguration() {
064: return getProcessingContext().getConfiguration();
065: }
066:
067: public DataRow getDataRow() {
068: return dataRow;
069: }
070:
071: /**
072: * Access to the tablemodel was granted using report properties, now direct.
073: */
074: public TableModel getData() {
075: return data;
076: }
077:
078: /**
079: * Where are we in the current processing.
080: */
081: public int getCurrentRow() {
082: return currentRow;
083: }
084:
085: public ResourceBundleFactory getResourceBundleFactory() {
086: return getProcessingContext().getResourceBundleFactory();
087: }
088:
089: /**
090: * The output descriptor is a simple string collections consisting of the
091: * following components: exportclass/type/subtype
092: * <p/>
093: * For example, the PDF export would be: pageable/pdf The StreamHTML export
094: * would return table/html/stream
095: *
096: * @return the export descriptor.
097: */
098: public String getExportDescriptor() {
099: return getProcessingContext().getExportDescriptor();
100: }
101: }
|