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: * FinishedRenderNode.java
027: * ------------
028: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029: */package org.jfree.report.layout.model;
030:
031: import org.jfree.report.layout.style.SimpleStyleSheet;
032:
033: /**
034: * A box replacement. It has a predefined width and height and does not change
035: * those. It is a placeholder for all already printed content.
036: * <p/>
037: * If you see this node inside an inline box, you can be sure you've shot
038: * yourself in the foot.
039: *
040: * @author Thomas Morgner
041: */
042: public class FinishedRenderNode extends RenderNode {
043: private long layoutedWidth;
044: private long layoutedHeight;
045: private long marginsTop;
046: private long marginsBottom;
047: private boolean breakAfter;
048:
049: public FinishedRenderNode(final long layoutedWidth,
050: final long layoutedHeight, final long marginsTop,
051: final long marginsBottom, final boolean breakAfter) {
052: super (SimpleStyleSheet.EMPTY_STYLE);
053: if (layoutedWidth <= 0) {
054: throw new IllegalStateException(
055: "Layouted Width is less than zero: "
056: + layoutedWidth);
057: }
058: if (layoutedHeight < 0) {
059: throw new IllegalStateException(
060: "Layouted Height is less than zero: "
061: + layoutedHeight);
062: }
063:
064: this .breakAfter = breakAfter;
065: this .layoutedWidth = layoutedWidth;
066: this .layoutedHeight = layoutedHeight;
067: this .marginsBottom = marginsBottom;
068: this .marginsTop = marginsTop;
069: setFinished(true);
070: }
071:
072: public boolean isBreakAfter() {
073: return breakAfter;
074: }
075:
076: public long getLayoutedWidth() {
077: return layoutedWidth;
078: }
079:
080: public long getLayoutedHeight() {
081: return layoutedHeight;
082: }
083:
084: public long getMarginsTop() {
085: return marginsTop;
086: }
087:
088: public long getMarginsBottom() {
089: return marginsBottom;
090: }
091:
092: /**
093: * If that method returns true, the element will not be used for rendering.
094: * For the purpose of computing sizes or performing the layouting (in the
095: * validate() step), this element will treated as if it is not there.
096: * <p/>
097: * If the element reports itself as non-empty, however, it will affect the
098: * margin computation.
099: *
100: * @return
101: */
102: public boolean isIgnorableForRendering() {
103: // Finished rows affect the margins ..
104: return false;
105: }
106:
107: public void updateParent(final RenderBox parent) {
108: super.setParent(parent);
109: }
110:
111: }
|