Class ColumnPrint

  • All Implemented Interfaces:
    Print

    public class ColumnPrint
    extends java.lang.Object
    implements 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).

    • Constructor Summary

      Constructors 
      Constructor Description
      ColumnPrint​(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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int getColumnCount()
      Returns the number of columns per page.
      int getColumnSpacing()
      Returns the spacing between columns, in points.
      Print getTarget()
      Returns the target print being split into columns.
      int hashCode()  
      boolean isCompressed()
      Returns whether the columns are compressed to the smallest possible height on the last page.
      PrintIterator 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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ColumnPrint

        public ColumnPrint​(Print target,
                           int columns,
                           int spacing)
        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 display
        spacing - the spacing between each column.
      • ColumnPrint

        public ColumnPrint​(Print target,
                           int columns,
                           int spacing,
                           boolean compressed)
        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 Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getTarget

        public Print 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.
        Specified by:
        iterator in interface Print
        Parameters:
        device - the graphics device this Print will be drawn onto.
        gc - the graphics context to be used for calculating layout and drawing the Print's contents.
        Returns:
        a PrintIterator for laying out the contents of this Print.