ReportCat 1.1

li.netcat.print.util
Class GridPrintConstraints

java.lang.Object
  extended byli.netcat.print.util.GridPrintConstraints

public class GridPrintConstraints
extends java.lang.Object

This immutable class defines the constraints that are associated with each cell in a GridPrint. It defines

The properties of a column are typically calculated by applying the maximum function over all cells in that column. e.g. if one cell in a column defines a weigth of 1.5 and another cell in the same column defines a weight of 2.0, the wieght of that column is calculated to 2.0. A cell that spans more than one column belongs to it's first column it occupies.

Author:
Arthur Marxer

Field Summary
static int COL_WIDTH_PREFERRED
          This constant defines the column width to be the preferred width of the print.
static int COL_WIDTH_RELATIVE
          This constant defines the column width to be relative, i.e. the widths of the columns are distributed according to their weights.
static GridPrintConstraints DEFAULT
          The default constraints object with a horizontal alignment of left, a colSpan of REMAINDER, a weight of 1.0f and a relative columnWidth.
static int REMAINDER
          The REMAINDER is a colSpan value that fills all remaining columns.
 
Constructor Summary
GridPrintConstraints(int hAlign, int colSpan, float colWeight, int colWidth)
          Constructs a new GridPrintConstraints object using the given values.
 
Method Summary
 GridPrintConstraints colSpan(int colSpan)
          Returns a clone of the target with a modified colSpan value.
 GridPrintConstraints colWeight(float colWeight)
          Returns a clone of the target with a modified colWeight value.
 GridPrintConstraints colWidth(int colWidth)
          Returns a clone of the target with a modified colWidth value.
 GridPrintConstraints colWidthPreferred()
          Returns a clone of the target that defines the width of the column to be the preffered width of the cell associated with that constraint.
 GridPrintConstraints colWidthRelative()
          Returns a clone of the target that defines the width of the column to be relative according to it's weight.
 int getColSpan()
          Returns the column span.
 float getColWeight()
          Returns the weight of a column.
 int getColWidth()
          Returns the columnWidth of a cell.
 int getHAlign()
          Returns the horizontal alignment of the cell, one of LEFT, RIGHT or CENTER (see PrintConstants).
 GridPrintConstraints hAlign(int hAlign)
          Returns a clone of the target with a modified hAlign value.
 GridPrintConstraints hAlignCenter()
          Returns a clone of the target with a hAlign value of CENTER.
 GridPrintConstraints hAlignLeft()
          Returns a clone of the target with a hAlign value of LEFT.
 GridPrintConstraints hAlignRight()
          Returns a clone of the target with a hAlign value of RIGHT.
 boolean isRemainder()
          Returns true if columnSpan is REMAINDER.
 GridPrintConstraints remainder()
          Returns a clone of the target with a colSpan value of REMAINDER.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final GridPrintConstraints DEFAULT
The default constraints object with a horizontal alignment of left, a colSpan of REMAINDER, a weight of 1.0f and a relative columnWidth.


REMAINDER

public static final int REMAINDER
The REMAINDER is a colSpan value that fills all remaining columns.

See Also:
Constant Field Values

COL_WIDTH_RELATIVE

public static final int COL_WIDTH_RELATIVE
This constant defines the column width to be relative, i.e. the widths of the columns are distributed according to their weights.

See Also:
Constant Field Values

COL_WIDTH_PREFERRED

public static final int COL_WIDTH_PREFERRED
This constant defines the column width to be the preferred width of the print.

See Also:
Constant Field Values
Constructor Detail

GridPrintConstraints

public GridPrintConstraints(int hAlign,
                            int colSpan,
                            float colWeight,
                            int colWidth)
Constructs a new GridPrintConstraints object using the given values. Please notice the DEFAULT static variable and the clone methods for an easy to read construction of GridPrintConstraints, e.g.
   GridPrint gp = ...;
   Print p = ...;
   GridPrintConstraints c = GridPrintConstraints.DEFAULT;
   gp.add(p, c.colSpan(1).colWeight(2.0f));
 

Parameters:
hAlign - The horizontal alignment of the cell, one of LEFT, RIGHT or CENTER (see PrintConstants).
colSpan - The columnSpan of a cell. It must be a positive value or REMAINDER.
colWeight - The weight of a column. The default value is 1.0f. It is used for the relative distribution of the width to all columns. It must be >= 1.0f.
colWidth - The columnWidth can be specified to define an absolute width of a column. This parameter must be >= 0 or COL_WIDTH_RELATIVE or COL_WIDTH_PREFERRED.
Method Detail

getColSpan

public final int getColSpan()
Returns the column span.

Returns:
The columnSpan of a cell. It is a positive value or REMAINDER.

isRemainder

public final boolean isRemainder()
Returns true if columnSpan is REMAINDER.

Returns:
true if columnSpan is REMAINDER.

getHAlign

public final int getHAlign()
Returns the horizontal alignment of the cell, one of LEFT, RIGHT or CENTER (see PrintConstants).

Returns:
The horizontal alignment of the cell.

getColWeight

public final float getColWeight()
Returns the weight of a column. It is used for the relative distribution of the width to all columns. It must be >= 1.0f.

Returns:
The weight of a column.

getColWidth

public final int getColWidth()
Returns the columnWidth of a cell. It can be specified to define an absolute width of a column. This parameter is >= 0 or COL_WIDTH_RELATIVE or COL_WIDTH_PREFERRED.

Returns:
The absolute width of a cell or COL_WIDTH_RELATIVE or COL_WIDTH_PREFERRED.

colSpan

public GridPrintConstraints colSpan(int colSpan)
Returns a clone of the target with a modified colSpan value.

Parameters:
colSpan - The columnSpan of a cell. It must be a positive value or REMAINDER.
Returns:
A clone of the target with a modified colSpan value.

remainder

public GridPrintConstraints remainder()
Returns a clone of the target with a colSpan value of REMAINDER.

Returns:
A clone of the target with a colSpan value of REMAINDER.

hAlign

public GridPrintConstraints hAlign(int hAlign)
Returns a clone of the target with a modified hAlign value.

Parameters:
hAlign - The horizontal alignment of the cell, one of LEFT, RIGHT or CENTER (see PrintConstants).
Returns:
A clone of the target with a modified hAlign value.

hAlignRight

public GridPrintConstraints hAlignRight()
Returns a clone of the target with a hAlign value of RIGHT.

Returns:
A clone of the target with a hAlign value of RIGHT.

hAlignCenter

public GridPrintConstraints hAlignCenter()
Returns a clone of the target with a hAlign value of CENTER.

Returns:
A clone of the target with a hAlign value of CENTER.

hAlignLeft

public GridPrintConstraints hAlignLeft()
Returns a clone of the target with a hAlign value of LEFT.

Returns:
A clone of the target with a hAlign value of LEFT.

colWeight

public GridPrintConstraints colWeight(float colWeight)
Returns a clone of the target with a modified colWeight value.

Parameters:
colWeight - The weight of a column. It is used for the relative distribution of the width to all columns. It must be >= 1.0f.
Returns:
A clone of the target with a modified colWeight value.

colWidth

public GridPrintConstraints colWidth(int colWidth)
Returns a clone of the target with a modified colWidth value.

Parameters:
colWidth - The columnWidth can be specified to define an absolute width of a column. This parameter must be >= 0 or COL_WIDTH_RELATIVE or COL_WIDTH_PREFERRED.
Returns:
A clone of the target with a modified colWidth value.

colWidthPreferred

public GridPrintConstraints colWidthPreferred()
Returns a clone of the target that defines the width of the column to be the preffered width of the cell associated with that constraint.

Returns:
A clone of the target with colWidth set to COL_WIDTH_PREFERRED.

colWidthRelative

public GridPrintConstraints colWidthRelative()
Returns a clone of the target that defines the width of the column to be relative according to it's weight.

Returns:
A clone of the target with colWidth set to COL_WIDTH_RELATIVE.

ReportCat 1.1

Copyright © 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation, Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation, Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation