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: AutoTableElement.java 3525 2007-10-16 11:43:48Z tmorgner $
027     * ------------
028     * (C) Copyright 2000-2005, by Object Refinery Limited.
029     * (C) Copyright 2005-2007, by Pentaho Corporation.
030     */
031    
032    package org.jfree.report.modules.misc.autotable;
033    
034    import java.util.ArrayList;
035    
036    import org.jfree.report.structure.Element;
037    import org.jfree.report.structure.Section;
038    
039    /**
040     * Creation-Date: Dec 9, 2006, 5:46:48 PM
041     *
042     * @author Thomas Morgner
043     */
044    public class AutoTableElement extends Element
045    {
046      private ArrayList headerCells;
047      private ArrayList contentCells;
048      private ArrayList footerCells;
049    
050      public AutoTableElement()
051      {
052        headerCells = new ArrayList();
053        footerCells = new ArrayList();
054        contentCells = new ArrayList();
055      }
056    
057      public void addHeader (final Section headerCellElement)
058      {
059        headerCellElement.updateParent(this);
060        headerCells.add(headerCellElement);
061      }
062    
063      public void addFooter (final Section footerCellElement)
064      {
065        footerCellElement.updateParent(this);
066        footerCells.add(footerCellElement);
067      }
068    
069      public void addContent (final Section cellElement)
070      {
071        cellElement.updateParent(this);
072        contentCells.add(cellElement);
073      }
074    
075      public int getHeaderCount ()
076      {
077        return headerCells.size();
078      }
079    
080      public int getFooterCount ()
081      {
082        return footerCells.size();
083      }
084    
085      public int getContentCount ()
086      {
087        return contentCells.size();
088      }
089    
090      public Section getHeaderCell (final int index)
091      {
092        return (Section) headerCells.get(index);
093      }
094    
095      public Section getFooterCell (final int index)
096      {
097        return (Section) footerCells.get(index);
098      }
099    
100      public Section getContentCell (final int index)
101      {
102        return (Section) contentCells.get(index);
103      }
104    }