Source for org.jfree.report.modules.misc.autotable.AutoTableElement

   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: AutoTableElement.java 3525 2007-10-16 11:43:48Z tmorgner $
  27:  * ------------
  28:  * (C) Copyright 2000-2005, by Object Refinery Limited.
  29:  * (C) Copyright 2005-2007, by Pentaho Corporation.
  30:  */
  31: 
  32: package org.jfree.report.modules.misc.autotable;
  33: 
  34: import java.util.ArrayList;
  35: 
  36: import org.jfree.report.structure.Element;
  37: import org.jfree.report.structure.Section;
  38: 
  39: /**
  40:  * Creation-Date: Dec 9, 2006, 5:46:48 PM
  41:  *
  42:  * @author Thomas Morgner
  43:  */
  44: public class AutoTableElement extends Element
  45: {
  46:   private ArrayList headerCells;
  47:   private ArrayList contentCells;
  48:   private ArrayList footerCells;
  49: 
  50:   public AutoTableElement()
  51:   {
  52:     headerCells = new ArrayList();
  53:     footerCells = new ArrayList();
  54:     contentCells = new ArrayList();
  55:   }
  56: 
  57:   public void addHeader (final Section headerCellElement)
  58:   {
  59:     headerCellElement.updateParent(this);
  60:     headerCells.add(headerCellElement);
  61:   }
  62: 
  63:   public void addFooter (final Section footerCellElement)
  64:   {
  65:     footerCellElement.updateParent(this);
  66:     footerCells.add(footerCellElement);
  67:   }
  68: 
  69:   public void addContent (final Section cellElement)
  70:   {
  71:     cellElement.updateParent(this);
  72:     contentCells.add(cellElement);
  73:   }
  74: 
  75:   public int getHeaderCount ()
  76:   {
  77:     return headerCells.size();
  78:   }
  79: 
  80:   public int getFooterCount ()
  81:   {
  82:     return footerCells.size();
  83:   }
  84: 
  85:   public int getContentCount ()
  86:   {
  87:     return contentCells.size();
  88:   }
  89: 
  90:   public Section getHeaderCell (final int index)
  91:   {
  92:     return (Section) headerCells.get(index);
  93:   }
  94: 
  95:   public Section getFooterCell (final int index)
  96:   {
  97:     return (Section) footerCells.get(index);
  98:   }
  99: 
 100:   public Section getContentCell (final int index)
 101:   {
 102:     return (Section) contentCells.get(index);
 103:   }
 104: }