001: /**
002: * ===========================================
003: * JFreeReport : a free Java reporting library
004: * ===========================================
005: *
006: * Project Info: http://reporting.pentaho.org/
007: *
008: * (C) Copyright 2001-2007, by Object Refinery Ltd, 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: * MinorAxisParagraphBreakState.java
027: * ------------
028: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029: */package org.jfree.report.layout.process;
030:
031: import org.jfree.report.layout.model.ParagraphRenderBox;
032: import org.jfree.report.layout.model.RenderNode;
033: import org.jfree.report.layout.process.layoutrules.InlineNodeSequenceElement;
034: import org.jfree.report.layout.process.layoutrules.InlineSequenceElement;
035: import org.jfree.report.layout.process.layoutrules.ReplacedContentSequenceElement;
036: import org.jfree.report.layout.process.layoutrules.SequenceList;
037: import org.jfree.report.layout.process.layoutrules.TextSequenceElement;
038:
039: /**
040: * Creation-Date: 12.07.2007, 14:47:54
041: *
042: * @author Thomas Morgner
043: */
044: public final class MinorAxisParagraphBreakState {
045: private Object suspendItem;
046: private SequenceList primarySequence;
047: private ParagraphRenderBox paragraph;
048: private boolean containsContent;
049:
050: public MinorAxisParagraphBreakState() {
051: this .primarySequence = new SequenceList();
052: }
053:
054: public void init(final ParagraphRenderBox paragraph) {
055: if (paragraph == null) {
056: throw new NullPointerException();
057: }
058: this .paragraph = paragraph;
059: this .primarySequence.clear();
060: this .suspendItem = null;
061: this .containsContent = false;
062: }
063:
064: public void deinit() {
065: this .paragraph = null;
066: this .primarySequence.clear();
067: this .suspendItem = null;
068: this .containsContent = false;
069: }
070:
071: public boolean isActive() {
072: return paragraph != null;
073: }
074:
075: public ParagraphRenderBox getParagraph() {
076: return paragraph;
077: }
078:
079: public Object getSuspendItem() {
080: return suspendItem;
081: }
082:
083: public void setSuspendItem(final Object suspendItem) {
084: this .suspendItem = suspendItem;
085: }
086:
087: public void add(final InlineSequenceElement element,
088: final RenderNode node) {
089: primarySequence.add(element, node);
090: if (element instanceof TextSequenceElement
091: || element instanceof InlineNodeSequenceElement
092: || element instanceof ReplacedContentSequenceElement) {
093: containsContent = true;
094: }
095: }
096:
097: public boolean isContainsContent() {
098: return containsContent;
099: }
100:
101: public boolean isSuspended() {
102: return suspendItem != null;
103: }
104:
105: public SequenceList getSequence() {
106: return primarySequence;
107: }
108:
109: public void clear() {
110: primarySequence.clear();
111: containsContent = false;
112: }
113: }
|