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 */
023package com.jcoverage.reporting;
024
025import java.util.*;
026
027/**
028 * A page containing information at the same report level.
029 */
030public interface Page extends Closeable {
031
032  /**
033   * Create a new line in the page.  Lines can fall into categories,
034   * used for tables and sectioning.  This information is used by
035   * formats, so they can request lines by category.
036   */
037  Line createLine(LineCategory category);
038
039  /**
040   * Add a reference to a line. Unlike the {@link
041   * #createLine(LineCategory)} method, no connections are made
042   * between this page and line.
043   */
044  void addLineReference(Line line,LineCategory category);
045
046  Line lookupLineByField(LineCategory category,Column column,Object value);
047
048  /**
049   * The page can 'contain' any number of categories (tables) which,
050   * in turn, contain any number of lines.  This method provides
051   * access to those lines.
052   * @return the lines stored in this page against the category, or an
053   * empty set. Should never return null.
054   */
055  Set getLines(LineCategory category);
056
057  void setReport(Report report);
058
059  /**
060   * @return the line that summarizes this detail page, null if this
061   * is not a detail page. The terminology of master and detail comes
062   * from the database world where heirarchical reports which show
063   * information in a parent-child format are often referred to as
064   * master-detail reports.
065   */
066  Line getMasterLine();
067
068  /**
069   * @see #getMasterLine()
070   */
071  void setMasterLine(Line masterLine);
072
073  /**
074   * Get the line categories that are valid for this page.
075   */
076  LineCategory[] getCategories();
077
078  /*
079   * TODO: This isn't optimal in terms of memory usage - categories
080   * are common to all pages of a particular type, so a PageDefinition
081   * class or similar should be invented.
082   */
083  void addCategory(LineCategory category);
084
085  String getLabel();
086
087}