Source for org.jfree.report.DataRow

   1: /**
   2:  * ========================================
   3:  * JFreeReport : a free Java report library
   4:  * ========================================
   5:  *
   6:  * Project Info:  http://reporting.pentaho.org/
   7:  *
   8:  * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
   9:  *
  10:  * This library is free software; you can redistribute it and/or modify it under the terms
  11:  * of the GNU Lesser General Public License as published by the Free Software Foundation;
  12:  * either version 2.1 of the License, or (at your option) any later version.
  13:  *
  14:  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  15:  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16:  * See the GNU Lesser General Public License for more details.
  17:  *
  18:  * You should have received a copy of the GNU Lesser General Public License along with this
  19:  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  20:  * Boston, MA 02111-1307, USA.
  21:  *
  22:  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  23:  * in the United States and other countries.]
  24:  *
  25:  * ------------
  26:  * $Id: DataRow.java 2725 2007-04-01 18:49:29Z taqua $
  27:  * ------------
  28:  * (C) Copyright 2000-2005, by Object Refinery Limited.
  29:  * (C) Copyright 2005-2007, by Pentaho Corporation.
  30:  */
  31: package org.jfree.report;
  32: 
  33: /**
  34:  * This is the base interface for all data access collectors. A data-row adds a
  35:  * certain order to the elements in the dataset. It also allows statefull
  36:  * comparisions and data attributes using DataFlags.
  37:  * <p/>
  38:  * The data-row is an internal concept of JFreeReport. The report engine will be
  39:  * responsible for creating and maintaining these implementations. Authors of
  40:  * functions and expressions usually dont have to care where a datarow comes
  41:  * from or at which particular instance they are looking right now.
  42:  * <p/>
  43:  * Note: Do not attempt to cache the datarow outside the core engine. This can
  44:  * have funny sideeffects and might trigger the end of the world.
  45:  *
  46:  * @author Thomas Morgner
  47:  */
  48: public interface DataRow extends DataSet
  49: {
  50:   /**
  51:    * Returns the value of the expression or column in the tablemodel using the
  52:    * given column number as index. For functions and expressions, the
  53:    * <code>getValue()</code> method is called and for columns from the
  54:    * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
  55:    * called.
  56:    *
  57:    * @param col the item index.
  58:    * @return the value.
  59:    * @throws IllegalStateException if the datarow detected a deadlock.
  60:    * @throws DataSourceException   if an error occured.
  61:    */
  62:   public Object get(int col) throws DataSourceException;
  63: 
  64:   /**
  65:    * Returns the value of the function, expression or column using its specific
  66:    * name. The given name is translated into a valid column number and the the
  67:    * column is queried. For functions and expressions, the
  68:    * <code>getValue()</code> method is called and for columns from the
  69:    * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
  70:    * called.
  71:    *
  72:    * @param col the item index.
  73:    * @return the value.
  74:    * @throws IllegalStateException if the datarow detected a deadlock.
  75:    * @throws DataSourceException   if an error occured.
  76:    */
  77:   public Object get(String col) throws DataSourceException;
  78: 
  79:   /**
  80:    * Returns the name of the column, expression or function. For columns from
  81:    * the tablemodel, the tablemodels <code>getColumnName</code> method is
  82:    * called. For functions, expressions and report properties the assigned name
  83:    * is returned.
  84:    *
  85:    * @param col the item index.
  86:    * @return the name.
  87:    * @throws DataSourceException if an error occured.
  88:    */
  89:   public String getColumnName(int col) throws DataSourceException;
  90: 
  91:   /**
  92:    * Returns the number of columns, expressions and functions and marked
  93:    * ReportProperties in the report.
  94:    *
  95:    * @return the item count.
  96:    * @throws DataSourceException if an error occured.
  97:    */
  98:   public int getColumnCount() throws DataSourceException;
  99: 
 100:   /**
 101:    * Queries lowlevel meta-data for the current value of the specified column.
 102:    *
 103:    * @param col the colum for which to query the meta-data flags
 104:    * @return the dataflag collection for the value in the named column
 105:    * @throws DataSourceException if an error occured.
 106:    */
 107:   public DataFlags getFlags(String col) throws DataSourceException;
 108: 
 109:   /**
 110:    * Queries lowlevel meta-data for the current value of the specified column.
 111:    *
 112:    * @param col the colum for which to query the meta-data flags
 113:    * @return the dataflag collection for the value in the specified column
 114:    * @throws DataSourceException if an error occured.
 115:    */
 116:   public DataFlags getFlags(int col) throws DataSourceException;
 117: }