Class GridPrint

java.lang.Object
net.sf.paperclips.GridPrint
All Implemented Interfaces:
Print

public final class GridPrint extends Object implements Print
A Print which arranges child prints into a grid. A grid is initialized with a series of GridColumns, and child prints are laid out into those columns by invoking the add(...) methods.

GridPrint uses a column sizing algorithm based on the W3C recommendation for automatic layout of tables. GridPrint deviates from the recommendation on one important point: if there is less width available on the print device than the calculated "minimum" size of the grid, the columns will be scaled down to less than their calculated minimum widths. Only when one of the columns goes below its "absolute minimum" will the grid fail to print ( PrintIterator.next(int, int) returns null).

GridPrint offers three basic methods of specifying column size.

  1. Default size. The column will be somewhere between it's minimum and preferred width. GridPrint will determine the optimum widths for all default size columns, using the modified W3C recommendation described above. This is the recommended option for most cases.
  2. Preferred size. The column will be sized to it's preferred width. This option is sometimes appropriate, for example when certain portions of text should not be allowed to line-wrap. In cases where only a few cells in a column need to be prevented from line wrapping, consider wrapping them in a NoBreakPrint instead.
  3. Explicit size. The column will be the size you specify, expressed in points. 72 points = 1".
Example: GridPrint grid = new GridPrint("d, p, 72pts");

In addition, any column can be given a grow attribute. In the event a grid is not as wide as the page, those columns with the grow attribute set will be widened to fill the extra space.

Because GridPrint scales columns according to their minimum sizes in the worst-case scenario, the absolute minimum size of a GridPrint is dependant on its child prints and is not clearly defined.

If a grid has one of more columns with the grow attribute set, the grid is horizontally greedy. Greedy prints take up all the available space on the page.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant cell spacing value indicating that the borders of adjacent cells should overlap.
    static final int
    Constant column size value indicating that the column should be given its preferred size.
    static final int
    Constant colspan value indicating that all remaining columns in the row should be used.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a GridPrint with no columns and a default look.
    GridPrint(String columns)
    Constructs a GridPrint with the given columns and a default look.
    GridPrint(String columns, int spacing)
    Deprecated.
    use GridPrint(String) instead, then set a DefaultGridLook on the grid with the desired cell spacing.
    GridPrint(String columns, int horizontalSpacing, int verticalSpacing)
    Deprecated.
    use GridPrint(String) instead, then set a DefaultGridLook on the grid with the desired cell spacing.
    GridPrint(String columns, GridLook look)
    Constructs a GridPrint with the given columns and look.
    GridPrint(GridColumn[] columns)
    Constructs a GridPrint with the given columns and a default look.
    GridPrint(GridColumn[] columns, int spacing)
    Deprecated.
    use GridPrint(GridColumn[]) instead, then set a DefaultGridLook on the grid with the desired cell spacing.
    GridPrint(GridColumn[] columns, int horizontalSpacing, int verticalSpacing)
    Deprecated.
    use GridPrint(GridColumn[]) instead, then set a DefaultGridLook on the grid with the desired cell spacing.
    GridPrint(GridColumn[] columns, GridLook look)
    Constructs a GridPrint with the given columns and look.
    Constructs a GridPrint with no columns and the given look.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int hAlignment, int vAlignment, Print cell)
    Adds the Print to the grid body, using the given colspan and alignment.
    void
    add(int hAlignment, int vAlignment, Print cell, int colspan)
    Adds the Print to the grid body, using the given colspan and alignment.
    void
    add(int hAlignment, Print cell)
    Adds the Print to the grid body, using the given colspan and alignment.
    void
    add(int hAlignment, Print cell, int colspan)
    Adds the Print to the grid body, using the given colspan and alignment.
    void
    add(Print cell)
    Adds the Print to the grid body, with the default alignment and a colspan of 1.
    void
    add(Print cell, int colspan)
    Adds the Print to the grid body, with the given colspan and the default alignment.
    void
    add(Print cell, int colspan, int hAlignment)
    Deprecated.
    void
    addColumn(int index, String column)
    Inserts the column at the specified position in the grid.
    void
    addColumn(int index, GridColumn column)
    Inserts the column at the specified position in the grid.
    void
    addColumn(String column)
    Adds the column on the right edge of the grid.
    void
    Adds the column on the right edge of the grid.
    void
    addColumns(int index, String columns)
    Inserts the columns at the specified position in the grid.
    void
    addColumns(int index, GridColumn[] columns)
    Inserts the columns at the specified position in the grid.
    void
    addColumns(String columns)
    Adds the columns on the right edge of the grid.
    void
    Adds the columns on the right edge of the grid.
    void
    addFooter(int hAlignment, int vAlignment, Print cell)
    Adds the Print to the grid footer, using the given colspan and alignment.
    void
    addFooter(int hAlignment, int vAlignment, Print cell, int colspan)
    Adds the Print to the grid footer, using the given colspan and alignment.
    void
    addFooter(int hAlignment, Print cell)
    Adds the Print to the grid footer, using the given colspan and alignment.
    void
    addFooter(int hAlignment, Print cell, int colspan)
    Adds the Print to the grid footer, using the given colspan and alignment.
    void
    Adds the Print to the grid footer, with the default alignment and a colspan of 1.
    void
    addFooter(Print cell, int colspan)
    Adds the Print to the grid footer, with the given colspan and the default alignment.
    void
    addFooter(Print cell, int colspan, int hAlignment)
    Deprecated.
    void
    addHeader(int hAlignment, int vAlignment, Print cell)
    Adds the Print to the grid header, using the given alignment.
    void
    addHeader(int hAlignment, int vAlignment, Print cell, int colspan)
    Adds the Print to the grid header, using the given colspan and alignment.
    void
    addHeader(int hAlignment, Print cell)
    Adds the Print to the grid header, using the given alignment.
    void
    addHeader(int hAlignment, Print cell, int colspan)
    Adds the Print to the grid header, using the given colspan and alignment.
    void
    Adds the Print to the grid header, with default alignment and a colspan of 1.
    void
    addHeader(Print cell, int colspan)
    Adds the Print to the grid header, with the given colspan and the default alignment.
    void
    addHeader(Print cell, int colspan, int hAlignment)
    Deprecated.
    boolean
     
    org.eclipse.swt.graphics.RGB
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    Returns an array containing the body cells in the grid.
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    int[][]
    Returns current column groups.
    Returns an array of GridColumns which are the columns in the receiver.
    org.eclipse.swt.graphics.RGB
    Deprecated.
    this functionality has been moved to DefualtGridLook.
    Returns an array containing the footer cells in the grid.
    org.eclipse.swt.graphics.RGB
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    Returns an array containing the header cells in this grid.
    int
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    Returns the grid's look.
    int
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    int
     
    boolean
    Returns whether individual body cells in the grid may be broken across pages.
    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
    setBodyBackground(org.eclipse.swt.graphics.RGB bodyBackground)
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    void
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    void
    setCellClippingEnabled(boolean cellClippingEnabled)
    Sets whether individual body cells in the grid may be broken across pages.
    void
    setColumnGroups(int[][] columnGroups)
    Sets the column groups to the given two-dimension array.
    void
    setFooterBackground(org.eclipse.swt.graphics.RGB footerBackground)
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    void
    setHeaderBackground(org.eclipse.swt.graphics.RGB headerBackground)
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    void
    setHorizontalSpacing(int horizontalSpacing)
    Deprecated.
    this functionality has been moved to DefaultGridLook.
    void
    Sets the grid's look.
    void
    setVerticalSpacing(int verticalSpacing)
    Deprecated.
    this functionality has been moved to DefaultGridLook.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • REMAINDER

      public static final int REMAINDER
      Constant colspan value indicating that all remaining columns in the row should be used.
      See Also:
    • PREFERRED

      public static final int PREFERRED
      Constant column size value indicating that the column should be given its preferred size. (In the context of W3C's autolayout recommendation, this has the effect of setting the columns minimum width to its preferred width. This value is used in the GridColumn constructor.
      See Also:
    • BORDER_OVERLAP

      public static final int BORDER_OVERLAP
      Constant cell spacing value indicating that the borders of adjacent cells should overlap.
      See Also:
  • Constructor Details

    • GridPrint

      public GridPrint()
      Constructs a GridPrint with no columns and a default look.
    • GridPrint

      public GridPrint(GridLook look)
      Constructs a GridPrint with no columns and the given look.
      Parameters:
      look - the look to apply to the constructed grid.
    • GridPrint

      public GridPrint(String columns)
      Constructs a GridPrint with the given columns and a default look.
      Parameters:
      columns - a comma-separated list of parseable column specs.
      See Also:
    • GridPrint

      public GridPrint(String columns, GridLook look)
      Constructs a GridPrint with the given columns and look.
      Parameters:
      columns - a comma-separated list of parseable column specs.
      look - the look to apply to the constructed grid.
      See Also:
    • GridPrint

      public GridPrint(String columns, int spacing)
      Deprecated.
      use GridPrint(String) instead, then set a DefaultGridLook on the grid with the desired cell spacing.
      Constructs a GridPrint with the given columns and spacing.
      Parameters:
      columns - a comma-separated list of column specs.
      spacing - the spacing (in points) between grid cells.
      See Also:
    • GridPrint

      public GridPrint(String columns, int horizontalSpacing, int verticalSpacing)
      Deprecated.
      use GridPrint(String) instead, then set a DefaultGridLook on the grid with the desired cell spacing.
      Constructs a GridPrint with the given columns and spacing.
      Parameters:
      columns - a comma-separated list of column specs.
      horizontalSpacing - the horizontal spacing (in points) between grid cells.
      verticalSpacing - the vertical spacing (in points) between grid cells.
      See Also:
    • GridPrint

      public GridPrint(GridColumn[] columns)
      Constructs a GridPrint with the given columns and a default look.
      Parameters:
      columns - the columns for the new grid.
    • GridPrint

      public GridPrint(GridColumn[] columns, GridLook look)
      Constructs a GridPrint with the given columns and look.
      Parameters:
      columns - the columns for the new grid.
      look - the look to apply to the constructed grid.
    • GridPrint

      public GridPrint(GridColumn[] columns, int spacing)
      Deprecated.
      use GridPrint(GridColumn[]) instead, then set a DefaultGridLook on the grid with the desired cell spacing.
      Constructs a GridPrint with the given columns and spacing.
      Parameters:
      columns - the columns for the new grid.
      spacing - the spacing (in points) between grid cells.
      See Also:
    • GridPrint

      public GridPrint(GridColumn[] columns, int horizontalSpacing, int verticalSpacing)
      Deprecated.
      use GridPrint(GridColumn[]) instead, then set a DefaultGridLook on the grid with the desired cell spacing.
      Construct a GridPrint with the given columns and spacing.
      Parameters:
      columns - the columns for the new grid.
      horizontalSpacing - the horizontal spacing (in points) between grid cells.
      verticalSpacing - the vertical spacing (in points) between grid cells.
      See Also:
  • Method Details

    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • addColumn

      public void addColumn(String column)
      Adds the column on the right edge of the grid. Any cells which have been added to the grid prior to adding the column will be adjusted as follows: the right-hand cell of each completed row will have it's colspan expanded to fill the added column.
      Parameters:
      column - the column to add to the grid.
      See Also:
    • addColumn

      public void addColumn(GridColumn column)
      Adds the column on the right edge of the grid. Any cells which have been added to the grid prior to adding the column will be adjusted as follows: the right-hand cell of each completed row will have it's colspan expanded to fill the added column.
      Parameters:
      column - the column to add to the grid.
    • addColumn

      public void addColumn(int index, String column)
      Inserts the column at the specified position in the grid. Any cells which have been added to the grid prior to adding the column will be adjusted as follows: on each row, the cell which overlaps or whose right edge touches the insert position will be expanded to fill the added column.
      Parameters:
      index - the insert position.
      column - the column to be inserted.
      See Also:
    • addColumn

      public void addColumn(int index, GridColumn column)
      Inserts the column at the specified position in the grid. Any cells which have been added to the grid prior to adding the column will be adjusted as follows: on each row, the cell which overlaps or whose right edge touches the insert position will be expanded to fill the added column.
      Parameters:
      index - the insert position.
      column - the column to be inserted.
    • addColumns

      public void addColumns(String columns)
      Adds the columns on the right edge of the grid. Any cells which have been added to the grid prior to adding the columns will be adjusted as follows: the right-hand cell of each completed row will have it's colspan expanded to fill the added columns.
      Parameters:
      columns - the columns to add to the grid.
      See Also:
    • addColumns

      public void addColumns(GridColumn[] columns)
      Adds the columns on the right edge of the grid. Any cells which have been added to the grid prior to adding the columns will be adjusted as follows: the right-hand cell of each completed row will have it's colspan expanded to fill the added columns.
      Parameters:
      columns - the columns to add to the grid.
    • addColumns

      public void addColumns(int index, String columns)
      Inserts the columns at the specified position in the grid. Any cells which have been added to the grid prior to adding the columns will be adjusted as follows: on each row, the cell which overlaps or whose right edge touches the insert position will be expanded to fill the added columns.
      Parameters:
      index - the insert position.
      columns - the columns to be inserted.
      See Also:
    • addColumns

      public void addColumns(int index, GridColumn[] columns)
      Inserts the columns at the specified position in the grid. Any cells which have been added to the grid prior to adding the columns will be adjusted as follows: on each row, the cell which overlaps or whose right edge touches the insert position will be expanded to fill the added columns.
      Parameters:
      index - the insert position.
      columns - the columns to be inserted.
      See Also:
    • getColumns

      public GridColumn[] getColumns()
      Returns an array of GridColumns which are the columns in the receiver.
      Returns:
      an array of GridColumns which are the columns in the receiver.
    • addHeader

      public void addHeader(Print cell)
      Adds the Print to the grid header, with default alignment and a colspan of 1.
      Parameters:
      cell - the print to add.
    • addHeader

      public void addHeader(int hAlignment, Print cell)
      Adds the Print to the grid header, using the given alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      cell - the print to add.
    • addHeader

      public void addHeader(int hAlignment, int vAlignment, Print cell)
      Adds the Print to the grid header, using the given alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      vAlignment - the vertical alignment of the print within the grid cell. One of SWT.DEFAULT, SWT.TOP, SWT.CENTER, SWT.BOTTOM, or SWT.FILL. A value of FILL indicates that the cell is vertically greedy, so GridPrint will limit the cell's height to the tallest non-FILL cell in the row.
      cell - the print to add.
    • addHeader

      public void addHeader(Print cell, int colspan)
      Adds the Print to the grid header, with the given colspan and the default alignment.
      Parameters:
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • addHeader

      public void addHeader(int hAlignment, Print cell, int colspan)
      Adds the Print to the grid header, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • addHeader

      public void addHeader(int hAlignment, int vAlignment, Print cell, int colspan)
      Adds the Print to the grid header, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      vAlignment - the vertical alignment of the print within the grid cell. One of SWT.DEFAULT, SWT.TOP, SWT.CENTER, SWT.BOTTOM, or SWT.FILL. A value of FILL indicates that the cell is vertically greedy, so GridPrint will limit the cell's height to the tallest non-FILL cell in the row.
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • addHeader

      public void addHeader(Print cell, int colspan, int hAlignment)
      Deprecated.
      Use addHeader(int, Print, int) instead. GridPrint's addHeader method signatures have been rearranged to coincide with the GridColumn column spec format: [alignment]:content:[colspan]
      Adds the Print to the grid header, using the given colspan and alignment.
      Parameters:
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
    • getHeaderCells

      public GridCell[][] getHeaderCells()
      Returns an array containing the header cells in this grid. Each inner array represents one row in the header.
      Returns:
      an array containing the header cells in this grid.
    • getBodyCells

      public GridCell[][] getBodyCells()
      Returns an array containing the body cells in the grid. Each inner array represents one row in the body.
      Returns:
      an array containing the body cells in the grid.
    • getFooterCells

      public GridCell[][] getFooterCells()
      Returns an array containing the footer cells in the grid. Each inner array represents one row in the footer.
      Returns:
      an array containing the footer cells in the grid.
    • getHeaderBackground

      public org.eclipse.swt.graphics.RGB getHeaderBackground()
      Deprecated.
      this functionality has been moved to DefaultGridLook.
      Returns the background color of the header cells (defaults to the body background if null).
      Returns:
      the background color of the header cells (defaults to the body background if null).
    • setHeaderBackground

      public void setHeaderBackground(org.eclipse.swt.graphics.RGB headerBackground)
      Deprecated.
      this functionality has been moved to DefaultGridLook. Set a DefaultGridLook on the grid, then call setHeaderBackground on the grid look.
      Sets the background color of the header cells.
      Parameters:
      headerBackground - the new background color (defaults to the body background if null).
    • add

      public void add(Print cell)
      Adds the Print to the grid body, with the default alignment and a colspan of 1.
      Parameters:
      cell - the print to add.
    • add

      public void add(int hAlignment, Print cell)
      Adds the Print to the grid body, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      cell - the print to add.
    • add

      public void add(int hAlignment, int vAlignment, Print cell)
      Adds the Print to the grid body, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      vAlignment - the vertical alignment of the print within the grid cell. One of SWT.DEFAULT, SWT.TOP, SWT.CENTER, SWT.BOTTOM, or SWT.FILL. A value of FILL indicates that the cell is vertically greedy, so GridPrint will limit the cell's height to the tallest non-FILL cell in the row.
      cell - the print to add.
    • add

      public void add(Print cell, int colspan)
      Adds the Print to the grid body, with the given colspan and the default alignment.
      Parameters:
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • add

      public void add(int hAlignment, Print cell, int colspan)
      Adds the Print to the grid body, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • add

      public void add(int hAlignment, int vAlignment, Print cell, int colspan)
      Adds the Print to the grid body, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      vAlignment - the vertical alignment of the print within the grid cell. One of SWT.DEFAULT, SWT.TOP, SWT.CENTER, SWT.BOTTOM, or SWT.FILL. A value of FILL indicates that the cell is vertically greedy, so GridPrint will limit the cell's height to the tallest non-FILL cell in the row.
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • add

      public void add(Print cell, int colspan, int hAlignment)
      Deprecated.
      Use add(int, Print, int) instead. GridPrint's add method signatures have been rearranged to coincide with the GridColumn column spec format: [alignment]:content:[colspan]
      Adds the Print to the grid body, using the given colspan and alignment.
      Parameters:
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
    • getBodyBackground

      public org.eclipse.swt.graphics.RGB getBodyBackground()
      Deprecated.
      this functionality has been moved to DefaultGridLook.
      Returns the background color of the body cells (no background color if null).
      Returns:
      the background color of the body cells (no background color if null).
    • setBodyBackground

      public void setBodyBackground(org.eclipse.swt.graphics.RGB bodyBackground)
      Deprecated.
      this functionality has been moved to DefaultGridLook. Set a DefaultGridLook on the grid, then call setBodyBackground on the grid look.
      Sets the background color of the body cells.
      Parameters:
      bodyBackground - the new background color (no background is drawn if null).
    • isCellClippingEnabled

      public boolean isCellClippingEnabled()
      Returns whether individual body cells in the grid may be broken across pages. Defaults to true.
      Returns:
      whether individual body cells in the grid may be broken across pages.
    • setCellClippingEnabled

      public void setCellClippingEnabled(boolean cellClippingEnabled)
      Sets whether individual body cells in the grid may be broken across pages.
      Parameters:
      cellClippingEnabled - whether to enabled cell clipping.
    • addFooter

      public void addFooter(Print cell)
      Adds the Print to the grid footer, with the default alignment and a colspan of 1.
      Parameters:
      cell - the print to add.
    • addFooter

      public void addFooter(int hAlignment, Print cell)
      Adds the Print to the grid footer, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      cell - the print to add.
    • addFooter

      public void addFooter(int hAlignment, int vAlignment, Print cell)
      Adds the Print to the grid footer, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      vAlignment - the vertical alignment of the print within the grid cell. One of SWT.DEFAULT, SWT.TOP, SWT.CENTER, SWT.BOTTOM, or SWT.FILL. A value of FILL indicates that the cell is vertically greedy, so GridPrint will limit the cell's height to the tallest non-FILL cell in the row.
      cell - the print to add.
    • addFooter

      public void addFooter(Print cell, int colspan)
      Adds the Print to the grid footer, with the given colspan and the default alignment.
      Parameters:
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • addFooter

      public void addFooter(int hAlignment, Print cell, int colspan)
      Adds the Print to the grid footer, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • addFooter

      public void addFooter(int hAlignment, int vAlignment, Print cell, int colspan)
      Adds the Print to the grid footer, using the given colspan and alignment.
      Parameters:
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
      vAlignment - the vertical alignment of the print within the grid cell. One of SWT.DEFAULT, SWT.TOP, SWT.CENTER, SWT.BOTTOM, or SWT.FILL. A value of FILL indicates that the cell is vertically greedy, so GridPrint will limit the cell's height to the tallest non-FILL cell in the row.
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
    • addFooter

      public void addFooter(Print cell, int colspan, int hAlignment)
      Deprecated.
      Use addFooter(int, Print, int) instead. GridPrint's addFooter method signatures have been rearranged to coincide with the GridColumn column spec format: [alignment]:content:[colspan]
      Adds the Print to the grid footer, using the given colspan and alignment.
      Parameters:
      cell - the print to add.
      colspan - the number of columns to span, or REMAINDER to span the rest of the row.
      hAlignment - the horizontal alignment of the print within the grid cell. One of SWT.DEFAULT , SWT.LEFT, SWT.CENTER or SWT.RIGHT.
    • getFooterBackground

      public org.eclipse.swt.graphics.RGB getFooterBackground()
      Deprecated.
      this functionality has been moved to DefualtGridLook.
      Returns the background color of the footer cells.
      Returns:
      the background color of the footer cells (defaults to body background if null).
    • setFooterBackground

      public void setFooterBackground(org.eclipse.swt.graphics.RGB footerBackground)
      Deprecated.
      this functionality has been moved to DefaultGridLook. Set a DefaultGridLook on the grid, then call setFooterBackground on the grid look.
      Sets the background color of the footer cells.
      Parameters:
      footerBackground - the new background color (defaults to body background if null).
    • getColumnGroups

      public int[][] getColumnGroups()
      Returns current column groups. The returned array may be modified without affecting this GridPrint.
      Returns:
      the column groups.
    • setColumnGroups

      public void setColumnGroups(int[][] columnGroups)
      Sets the column groups to the given two-dimension array. Each int[] array is a group. Columns in a group will be the same size when laid out on the print device.

      The following statement causes columns 0 and 2 to be the same size, and columns 1 and 3 to be the same size.

       grid.setColumnGroups(new int[][] { { 0, 2 }, { 1, 3 } });
       

      The behavior of this property is undefined when a column belongs to more than one group.

      Note: Column grouping is enforced before column weights. Therefore, columns in the same group should be given the same weight to ensure they are laid out at the same width.

      Parameters:
      columnGroups - the new column groups.
    • getCellBorder

      public Border getCellBorder()
      Deprecated.
      this functionality has been moved to DefaultGridLook.
      Returns the border used around each cell.
      Returns:
      the border used around each cell.
    • setCellBorder

      public void setCellBorder(Border border)
      Deprecated.
      this functionality has been moved to DefaultGridLook. Set a DefaultGridLook on the grid, then call setCellBorder on the grid look.
      Sets the border around each of the grid's cells to the argument.
      Parameters:
      border - the new body cell border.
    • getHorizontalSpacing

      public int getHorizontalSpacing()
      Deprecated.
      this functionality has been moved to DefaultGridLook.
      Returns the horizontal spacing between grid cells.
      Returns:
      the horizontal spacing between grid cells.
    • setHorizontalSpacing

      public void setHorizontalSpacing(int horizontalSpacing)
      Deprecated.
      this functionality has been moved to DefaultGridLook. Set a DefaultGridLook on the grid, then call setCellSpacing(Point) on the grid look.
      Sets the horizontal spacing between grid cells.
      Parameters:
      horizontalSpacing - the new horizontal spacing. A value of BORDER_OVERLAP indicates that the borders should be overlapped instead of spaced.
    • getVerticalSpacing

      public int getVerticalSpacing()
      Deprecated.
      this functionality has been moved to DefaultGridLook.
      Returns the vertical spacing between grid cells.
      Returns:
      the vertical spacing between grid cells.
    • setVerticalSpacing

      public void setVerticalSpacing(int verticalSpacing)
      Deprecated.
      this functionality has been moved to DefaultGridLook. Set a DefaultGridLook on the grid, then call setCellSpacing(Point) on the grid look.
      Sets the vertical spacing between grid cells.
      Parameters:
      verticalSpacing - the new vertical spacing. A value of BORDER_OVERLAP indicates that the borders should be overlapped instead of spaced.
    • getLook

      public GridLook getLook()
      Returns the grid's look. A GridLook determines what decorations will appear around the grid's contents. Default is a DefaultGridLook with no cell spacing, no cell borders, and no background colors.
      Returns:
      the look of this grid.
    • setLook

      public void setLook(GridLook look)
      Sets the grid's look.
      Parameters:
      look - the new look.
    • 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.