001    /**
002     * www.jcoverage.com
003     * Copyright (C)2003 jcoverage ltd.
004     *
005     * This file is part of jcoverage.
006     *
007     * jcoverage is free software; you can redistribute it and/or modify
008     * it under the terms of the GNU General Public License as published
009     * by the Free Software Foundation; either version 2 of the License,
010     * or (at your option) any later version.
011     *
012     * jcoverage is distributed in the hope that it will be useful, but
013     * WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015     * General Public License for more details.
016     *
017     * You should have received a copy of the GNU General Public License
018     * along with jcoverage; if not, write to the Free Software
019     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020     * USA
021     *
022     */
023    package com.jcoverage.reporting;
024    
025    import java.util.Collection;
026    
027    /**
028     * A line of information in a page of a report.
029     */
030    public interface Line extends Closeable {
031        
032      /**
033       * This method signifies more detail is available for this line in a
034       * separate page.
035       * @return a new page, ready for lines of more detailed information
036       * to be added.
037       */
038      Page openDetailPage();
039    
040      /**
041       * Get the detail page if one exists. This method does not create a
042       * detail page, if you want to do this you should use {@link
043       * #openDetailPage()}.
044       */
045      Page getDetailPage();
046    
047      void setOwner(Page page);
048      Page getOwner();
049      void setReport(Report report);
050    
051      /**
052       * Fields can be set on a line.
053       * @param fieldtype the name of the field type. This must be a valid type
054       * with respect to this instance's {@link LineCategory}.
055       * @param value the value of the field. Again, this must be of
056       * the correct type as determined by the category.
057       */
058      void setField(Column col,Object value) throws IllegalArgumentException;
059    
060      void setField(Column col,int value) throws IllegalArgumentException;
061    
062      void setField(Column col,double value) throws IllegalArgumentException;
063    
064      void setField(Column col,boolean value) throws IllegalArgumentException;
065    
066      /**
067       * @param col the given column.
068       * @return the value of the given column, the type of which is
069       * determined by the {@link LineCategory}.
070       */
071      Object getField(Column col);
072    
073      /**
074       * Instances of this class should record their {@linkplain
075       * LineCategory category} if they want to validate values of fields
076       * set with the {@link #setField(Column,Object) setField()} methods.
077       * 
078       * <p>
079       *
080       * Reports that are not derived from {@link AbstractPage}, or
081       * override {@link AbstractPage#createLine(LineCategory)} should
082       * always call this method on newly created {@link Line} instances
083       * they create.
084       */
085      void setCategory(LineCategory category);
086    
087        
088    }