class DebugIterator extends java.lang.Object implements PrintIterator
Constructor and Description |
---|
DebugIterator(PrintIterator target) |
Modifier and Type | Method and Description |
---|---|
PrintIterator |
copy()
Returns a copy of this PrintIterator, with all relevant internal states.
|
boolean |
hasNext()
Identifies whether any PrintPieces remain.
|
org.eclipse.swt.graphics.Point |
minimumSize()
Returns the minimum size PrintPiece that this Print should be broken
into.
|
PrintPiece |
next(int width,
int height)
Returns the next PrintPiece for the Print.
|
org.eclipse.swt.graphics.Point |
preferredSize()
Returns the smallest size PrintPiece that this Print would be broken into
if print space was unlimited.
|
DebugIterator(PrintIterator target)
public PrintIterator copy()
PrintIterator
next(int, int)
on
them. The containing iterator can then safely attempt iterating its
child(ren) in a variety of ways before selecting which way is the most
appropriate.copy
in interface PrintIterator
public boolean hasNext()
PrintIterator
hasNext
in interface PrintIterator
public org.eclipse.swt.graphics.Point minimumSize()
PrintIterator
Note that the size calculated by this method is a "preferred minimum," or the smallest size that the Print should normally be broken into. For a TextPrint, this is the size of the widest individual word, in pixels.
This is distinct from the "absolute minimum," which is the smallest size that a Print could possibly be broken into. For a TextPrint, this is the size of the widest individual letter, in pixels.
minimumSize
in interface PrintIterator
public PrintPiece next(int width, int height)
PrintIterator
If all of the remaining contents of the Print will fit in the given
space, the returned PrintPiece will include all remaining contents, and
subsequent calls to PrintIterator.hasNext()
will return
false
.
If some, but not all of the remaining contents will fit in the given
space, the returned PrintPiece will contain as much of the contents as
possible, and subsequent calls to PrintIterator.hasNext()
will
return true
.
If there is insufficient space for any of the remaining contents in the
given space, null
is returned, and subsequent calls to
PrintIterator.hasNext()
will return true
.
If subsequent calls to PrintIterator#hasNext() return true
,
this PrintIterator cannot fit any more in the given print area. Future
calls to this method should provide a fresh print area. At the top level,
each returned PrintPiece contains an entire page.
Note: PrintIterator classes should call
PaperClips.next(PrintIterator, int, int)
instead of calling this
method directly, to gain automatic results checking to ensure all Print
classes are well-behaved.
next
in interface PrintIterator
width
- the width available on the graphics device for this iteration.height
- the height available on the graphics device for this
iteration.public org.eclipse.swt.graphics.Point preferredSize()
PrintIterator
For a TextPrint, this is the size of the widest line (or the whole TextPrint, if there are no line breaks), in pixels.
preferredSize
in interface PrintIterator