001: /**
002: * ========================================
003: * JFreeReport : a free Java report library
004: * ========================================
005: *
006: * Project Info: http://reporting.pentaho.org/
007: *
008: * (C) Copyright 2000-2007, by Object Refinery Limited, 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: * $Id: DataRow.java 3048 2007-07-28 18:02:42Z tmorgner $
027: * ------------
028: * (C) Copyright 2000-2005, by Object Refinery Limited.
029: * (C) Copyright 2005-2007, by Pentaho Corporation.
030: */package org.jfree.report;
031:
032: /**
033: * This is the base interface for all data access collectors. A data-row adds a
034: * certain order to the elements in the dataset. It also allows statefull
035: * comparisions and data attributes using DataFlags.
036: * <p/>
037: * The data-row is an internal concept of JFreeReport. The report engine will be
038: * responsible for creating and maintaining these implementations. Authors of
039: * functions and expressions usually dont have to care where a datarow comes
040: * from or at which particular instance they are looking right now.
041: * <p/>
042: * Note: Do not attempt to cache the datarow outside the core engine. This can
043: * have funny sideeffects and might trigger the end of the world.
044: *
045: * @author Thomas Morgner
046: */
047: public interface DataRow extends DataSet {
048: /**
049: * Returns the value of the expression or column in the tablemodel using the
050: * given column number as index. For functions and expressions, the
051: * <code>getValue()</code> method is called and for columns from the
052: * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
053: * called.
054: *
055: * @param col the item index.
056: * @return the value.
057: * @throws IllegalStateException if the datarow detected a deadlock.
058: * @throws DataSourceException if an error occured.
059: */
060: public Object get(int col) throws DataSourceException;
061:
062: /**
063: * Returns the value of the function, expression or column using its specific
064: * name. The given name is translated into a valid column number and the the
065: * column is queried. For functions and expressions, the
066: * <code>getValue()</code> method is called and for columns from the
067: * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
068: * called.
069: *
070: * @param col the item index.
071: * @return the value.
072: * @throws IllegalStateException if the datarow detected a deadlock.
073: * @throws DataSourceException if an error occured.
074: */
075: public Object get(String col) throws DataSourceException;
076:
077: /**
078: * Returns the name of the column, expression or function. For columns from
079: * the tablemodel, the tablemodels <code>getColumnName</code> method is
080: * called. For functions, expressions and report properties the assigned name
081: * is returned.
082: *
083: * @param col the item index.
084: * @return the name.
085: * @throws DataSourceException if an error occured.
086: */
087: public String getColumnName(int col) throws DataSourceException;
088:
089: /**
090: * Returns the number of columns, expressions and functions and marked
091: * ReportProperties in the report.
092: *
093: * @return the item count.
094: * @throws DataSourceException if an error occured.
095: */
096: public int getColumnCount() throws DataSourceException;
097:
098: /**
099: * Queries lowlevel meta-data for the current value of the specified column.
100: *
101: * @param col the colum for which to query the meta-data flags
102: * @return the dataflag collection for the value in the named column
103: * @throws DataSourceException if an error occured.
104: */
105: public DataFlags getFlags(String col) throws DataSourceException;
106:
107: /**
108: * Queries lowlevel meta-data for the current value of the specified column.
109: *
110: * @param col the colum for which to query the meta-data flags
111: * @return the dataflag collection for the value in the specified column
112: * @throws DataSourceException if an error occured.
113: */
114: public DataFlags getFlags(int col) throws DataSourceException;
115: }
|