Package net.sf.paperclips
Class ColumnPrint
java.lang.Object
net.sf.paperclips.ColumnPrint
- All Implemented Interfaces:
Print
A wrapper Print which splits its child print into multiple columns.
This class is horizontally greedy. Greedy prints take up all the available space on the page.
ColumnPrint attempts to use the minimum possible vertical space on the page if isCompressed() returns true (the default). This behavior can be disabled by calling setCompressed(false).
- Author:
- Matthew Hall
-
Constructor Summary
ConstructorsConstructorDescriptionColumnPrint
(Print target, int columns, int spacing) Constructs a ColumnPrint with the given target, number of columns, and column spacing (expressed in points).ColumnPrint
(Print target, int columns, int spacing, boolean compressed) Constructs a ColumnPrint with the given target, column count, column spacing, and compression. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
Returns the number of columns per page.int
Returns the spacing between columns, in points.Returns the target print being split into columns.int
hashCode()
boolean
Returns whether the columns are compressed to the smallest possible height on the last page.iterator
(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc) Returns a PrintIterator for laying out the contents of this Print.void
setCompressed
(boolean compressed) Sets whether the columns are compressed to the smallest possible height on the last page.
-
Constructor Details
-
ColumnPrint
Constructs a ColumnPrint with the given target, number of columns, and column spacing (expressed in points). 72 points = 1".- Parameters:
target
- the print which will be split into columns.columns
- the number of columns to displayspacing
- the spacing between each column.
-
ColumnPrint
Constructs a ColumnPrint with the given target, column count, column spacing, and compression.- Parameters:
target
- the print to display in columns.columns
- the number of columns to display.spacing
- the spacing between each column, expressed in points. 72 points = 1".compressed
- whether the columns on the final page are to be
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getTarget
Returns the target print being split into columns.- Returns:
- the target print being split into columns.
-
getColumnCount
public int getColumnCount()Returns the number of columns per page.- Returns:
- the number of columns per page.
-
getColumnSpacing
public int getColumnSpacing()Returns the spacing between columns, in points. 72 points = 1".- Returns:
- the spacing between columns, in points.
-
isCompressed
public boolean isCompressed()Returns whether the columns are compressed to the smallest possible height on the last page.- Returns:
- whether the columns are compressed to the smallest possible height on the last page.
-
setCompressed
public void setCompressed(boolean compressed) Sets whether the columns are compressed to the smallest possible height on the last page.- Parameters:
compressed
- whether to compress the columns.
-
iterator
public PrintIterator iterator(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc) Description copied from interface:Print
Returns a PrintIterator for laying out the contents of this Print. The iterator uses a snapshot of the print at the time this method is invoked, so subsequent changes to the Print will not affect the output of the iterator.
-