| 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: FlowControlOperation.java 10756 2009-12-02 15:58:24Z tmorgner $ |
| 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; |
| 32 |
|
| 33 |
/** |
| 34 |
* These objects define, how the iteration over the report definition affects |
| 35 |
* the data source. |
| 36 |
* |
| 37 |
* @author Thomas Morgner |
| 38 |
*/ |
| 39 |
public class FlowControlOperation |
| 40 |
{ |
| 41 |
/** |
| 42 |
* Stores the current datarow state for a later recall. Markpoints from different |
| 43 |
* sources can be nested. Marking does not change the user datasource. |
| 44 |
*/ |
| 45 |
public static final FlowControlOperation MARK = |
| 46 |
new FlowControlOperation("mark"); |
| 47 |
/** |
| 48 |
* Requests that the datasource should be moved to the next row. An advance |
| 49 |
* operation does not change the current cursor position. The cursor is not |
| 50 |
* moved until a 'COMMIT' operation has been reached. |
| 51 |
* |
| 52 |
* Repeatable sections will perform an auto-commit based on the group in which |
| 53 |
* they are in. |
| 54 |
*/ |
| 55 |
public static final FlowControlOperation ADVANCE = |
| 56 |
new FlowControlOperation("advance"); |
| 57 |
/** Recalls a marked position. */ |
| 58 |
public static final FlowControlOperation RECALL = |
| 59 |
new FlowControlOperation("recall"); |
| 60 |
|
| 61 |
/** Do nothing. */ |
| 62 |
public static final FlowControlOperation NO_OP = |
| 63 |
new FlowControlOperation("no-op"); |
| 64 |
|
| 65 |
/** |
| 66 |
* Finishes (and closes) the currently open context. If the last mark has been |
| 67 |
* closed, the datasource is also closed. |
| 68 |
* <p/> |
| 69 |
* If all datasources have been closes, the empty datasource is used. This |
| 70 |
* datasource cannot be closed (closing has no effect on it). |
| 71 |
*/ |
| 72 |
public static final FlowControlOperation DONE = |
| 73 |
new FlowControlOperation("done"); |
| 74 |
|
| 75 |
|
| 76 |
private final String myName; // for debug only |
| 77 |
|
| 78 |
/** |
| 79 |
* A commit checks for an pending advance request and commites that request |
| 80 |
* by moving the cursor of the currend datarow forward by one row. |
| 81 |
*/ |
| 82 |
public static final FlowControlOperation COMMIT = |
| 83 |
new FlowControlOperation("commit"); |
| 84 |
|
| 85 |
protected FlowControlOperation(String name) |
| 86 |
{ |
| 87 |
if (name == null) |
| 88 |
{ |
| 89 |
throw new NullPointerException(); |
| 90 |
} |
| 91 |
myName = name; |
| 92 |
} |
| 93 |
|
| 94 |
public String toString() |
| 95 |
{ |
| 96 |
return myName; |
| 97 |
} |
| 98 |
|
| 99 |
public boolean equals(final Object o) |
| 100 |
{ |
| 101 |
if (this == o) |
| 102 |
{ |
| 103 |
return true; |
| 104 |
} |
| 105 |
if (o == null || getClass() != o.getClass()) |
| 106 |
{ |
| 107 |
return false; |
| 108 |
} |
| 109 |
|
| 110 |
final FlowControlOperation that = (FlowControlOperation) o; |
| 111 |
|
| 112 |
return myName.equals(that.myName); |
| 113 |
} |
| 114 |
|
| 115 |
public int hashCode() |
| 116 |
{ |
| 117 |
return myName.hashCode(); |
| 118 |
} |
| 119 |
} |