Frames | No Frames |
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: LayoutController.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.flow.layoutprocessor; 32: 33: import org.jfree.report.DataSourceException; 34: import org.jfree.report.ReportDataFactoryException; 35: import org.jfree.report.ReportProcessingException; 36: import org.jfree.report.flow.FlowController; 37: import org.jfree.report.flow.ReportTarget; 38: 39: /** 40: * The layout controller iterates over the report layout. It uses a flow 41: * controller to query the data. 42: * 43: * @author Thomas Morgner 44: */ 45: public interface LayoutController extends Cloneable 46: { 47: /** 48: * Retrieves the parent of this layout controller. This allows childs to query 49: * their context. 50: * 51: * @return the layout controller's parent to <code>null</code> if there is no 52: * parent. 53: */ 54: public LayoutController getParent(); 55: 56: /** 57: * Initializes the layout controller. This method is called exactly once. It 58: * is the creators responsibility to call this method. 59: * <p/> 60: * Calling initialize after the first advance must result in a 61: * IllegalStateException. 62: * 63: * @param node the currently processed object or layout node. 64: * @param flowController the current flow controller. 65: * @param parent the parent layout controller that was responsible for 66: * instantiating this controller. 67: * @throws DataSourceException if there was a problem reading data from 68: * the datasource. 69: * @throws ReportProcessingException if there was a general problem during 70: * the report processing. 71: * @throws ReportDataFactoryException if a query failed. 72: */ 73: public void initialize(final Object node, 74: final FlowController flowController, 75: final LayoutController parent) 76: throws DataSourceException, ReportDataFactoryException, 77: ReportProcessingException; 78: 79: /** 80: * Advances the processing position. 81: * 82: * @param target the report target that receives generated events. 83: * @return the new layout controller instance representing the new state. 84: * 85: * @throws DataSourceException if there was a problem reading data from 86: * the datasource. 87: * @throws ReportProcessingException if there was a general problem during 88: * the report processing. 89: * @throws ReportDataFactoryException if a query failed. 90: */ 91: public LayoutController advance(ReportTarget target) 92: throws DataSourceException, ReportDataFactoryException, 93: ReportProcessingException; 94: 95: /** 96: * Checks, whether the layout controller would be advanceable. If this method 97: * returns true, it is generally safe to call the 'advance()' method. 98: * 99: * @return true, if the layout controller is advanceable, false otherwise. 100: */ 101: public boolean isAdvanceable(); 102: 103: /** 104: * Joins with a delegated process flow. This is generally called from a child 105: * flow and should *not* (I mean it!) be called from outside. If you do, 106: * you'll suffer. 107: * 108: * @param flowController the flow controller of the parent. 109: * @return the joined layout controller that incorperates all changes from 110: * the delegate. 111: */ 112: public LayoutController join(FlowController flowController) 113: throws DataSourceException, ReportDataFactoryException, 114: ReportProcessingException; 115: 116: /** 117: * Creates a copy of this layout controller. 118: * 119: * @return a copy. 120: */ 121: public Object clone(); 122: 123: /** 124: * Derives a copy of this controller that is suitable to perform a 125: * precomputation. The returned layout controller must be independent from 126: * the it's anchestor controller. 127: * 128: * @param fc a new flow controller for the precomputation. 129: * @return a copy that is suitable for precomputation. 130: */ 131: public LayoutController createPrecomputeInstance(FlowController fc); 132: 133: public FlowController getFlowController(); 134: public Object getNode(); 135: }