JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.page
Class JCPageTable

java.lang.Object
  |
  +--com.klg.jclass.page.JCPageTable

public class JCPageTable
extends Object

JCPageTable provides methods for creating and customizing tables into which data is flowed. Content may be added in the form of formatted, flowed text, or it can be added as content Objects to the underlying TableDataModel, in which case the appropriate CellRenderers are used to render/layout the content.

A JCPageTable consists of an ordered set of JCPageTable.Columns which define the columns of the table and their attributes and an ordered set of JCPageTable.Rows. A Row contains both the row attributes and the list of JCPageTable.Cell objects defined in that row. Headers are implemented using a nested JCPageTable object.

Attributes such as background colour, cell margins, and border styles can be set on any object in the table heirarchy (JCPageTable, Row, Column or Cell). The most specific setting available in a particular cell is used when the table is drawn, according to the inheritance order. The standard accessor methods (for example, Cell.getBackgroundColor()) will return the setting that will be applied at that object, even if the value is inherited from a higher-level object. All get() methods for inheritable attributes are shadowed by a method which determines if the value returned by the get method is inherited (versus being locally specified). (for example, Cell.isBackgroundColorInherited())

Because of the ambiguity created by inheriting Cell attributes from both the Row and Column, the method setRowColumnDominance(int) takes the constants ROW_DOMINANCE and COLUMN_DOMINANCE to define whether or values are inherited first from the Row or the Column, respectively.


Nested Class Summary
 class JCPageTable.Cell
          The Cell object describes a single cell of a JCPageTable.
 class JCPageTable.Column
          The Column object describes a single column of a JCPageTable.
 class JCPageTable.Row
          The Row object describes a single row of a JCPageTable.
 
Field Summary
protected  int alignment
          Tables use the paragraph alignment options for horizontal alignment.
static int BORDER_USE_EXTERNAL
           
static int BORDER_USE_INTERNAL
           
protected  int borderMode
          Controls the borders drawn on the perimeter of a table range.
static int CELL_ALIGNMENT_BOTTOM
           
static int CELL_ALIGNMENT_CENTER
           
static int CELL_ALIGNMENT_NONE
           
static int CELL_ALIGNMENT_TOP
           
static int COLUMN_DOMINANCE
           
protected  int columnCount
          Number of columns in the table.
protected  List columnList
          The column list is an ordered list of columns in the table.
protected  JCPageTable.Cell defaultCell
          A template cell to use as a source of default cell attributes.
protected  com.klg.jclass.page.JCDocument document
          The document to which this table belongs.
protected  int dominance
          Specifies which of a conflicting row or column attribute has dominance.
protected  com.klg.jclass.page.JCPageTable header
          The header table describes the table row displayed as a header.
protected  boolean isComplete
          True if this table has had all frames completed and heights calculated.
protected  boolean isHeader
          True if this table is created as the header of another table.
protected  com.klg.jclass.page.JCPageTable mainTable
          The main table is the body of the table.
static int OVERFLOW_CLIP_COLUMNS
          Clips table columns to page.
static int OVERFLOW_TEAROFF_COLUMNS
          Internal use only.
static int OVERFLOW_WRAP_COLUMNS
          Wraps table columns to same page.
static int OVERFLOW_WRAP_COLUMNS_NEXT
          Wraps table columns to next frame column or flow frame.
protected  int overflowMode
          Controls where extra columns in a too-wide table appear in the flow.
static int ROW_DOMINANCE
           
protected  int rowCount
          Number of rows in the table.
protected  List rowList
          The row list is an ordered list of rows in the table.
protected  com.klg.jclass.table.EditableTableDataModel tableData
          This stores data associated with cells on the table.
protected  com.klg.jclass.page.JCTableStyle tableStyle
          The predefined table style for this table.
static JCPageTable.Cell UNINITIALISED_CELL
           
static JCPageTable.Row UNINITIALISED_ROW
           
 
Constructor Summary
  JCPageTable(com.klg.jclass.page.JCDocument doc, int columnCount)
          Creates a new table with the number of columns specified where each column is the default width.
  JCPageTable(com.klg.jclass.page.JCDocument doc, int columnCount, com.klg.jclass.page.JCTableStyle tableStyle)
          Creates a new table with the number of columns specified where each column is the default width.
  JCPageTable(com.klg.jclass.page.JCDocument doc, int columnCount, JCUnit.Measure columnWidth)
          Creates a new table with the number of columns specified, where each column is a specified width.
  JCPageTable(com.klg.jclass.page.JCDocument doc, int columnCount, JCUnit.Measure columnWidth, com.klg.jclass.page.JCTableStyle tableStyle)
          Creates a new table with the number of columns specified where each column is a specified width.
protected JCPageTable(com.klg.jclass.page.JCDocument doc, com.klg.jclass.page.JCPageTable mainTable, com.klg.jclass.page.JCTableStyle tableStyle)
          Creates a new table with unset columns.
  JCPageTable(com.klg.jclass.page.JCDocument doc, JCUnit.Measure[] columnWidths)
          Creates a new table with columns as specified in the list of widths.
protected JCPageTable(com.klg.jclass.page.JCDocument doc, JCUnit.Measure[] columnWidths, com.klg.jclass.page.JCPageTable mainTable, com.klg.jclass.page.JCTableStyle tableStyle)
          Creates a new table with columns as specified in the list of widths.
  JCPageTable(com.klg.jclass.page.JCDocument doc, JCUnit.Measure[] columnWidths, com.klg.jclass.page.JCTableStyle tableStyle)
          Creates a new table with columns as specified in the list of widths.
  JCPageTable(com.klg.jclass.page.JCDocument doc, List columnWidths)
          Creates a new table with columns as specified in the list of widths.
protected JCPageTable(com.klg.jclass.page.JCDocument doc, List columnWidths, com.klg.jclass.page.JCPageTable mainTable, com.klg.jclass.page.JCTableStyle tableStyle)
          Creates a new table with columns as specified in the list of widths.
  JCPageTable(com.klg.jclass.page.JCDocument doc, List columnWidths, com.klg.jclass.page.JCTableStyle tableStyle)
          Creates a new table with columns as specified in the list of widths.
protected JCPageTable(com.klg.jclass.page.JCDocument doc, Object[] columnWidths, com.klg.jclass.page.JCPageTable mainTable, com.klg.jclass.page.JCTableStyle tableStyle)
          Creates a new table with columns as specified in the list of widths.
 
Method Summary
 void addRow(int rowNumber, int columnNumber, Object[] cellValues)
          Adds a row of cell values (or as many values as are provided) to the table starting at a given position.
 void addRow(int rowNumber, int columnNumber, String[] cellText)
          Adds a row of cells (or as many cells as are provided) to the table starting at a given position.
 void addRow(int rowNumber, Object[] cellValues)
          Adds a row of cell values (or as many values as are provided) to the table in the given position.
 void addRow(int rowNumber, String[] cellText)
          Adds a row of cells (or as many cells as are provided) to the table, given the row number.
 void addRow(com.klg.jclass.page.JCTextStyle style, String[] cellText)
          Adds a row of cells (or as many cells as are provided) to the table.
 void addRow(Object[] cellValues)
          Adds a row of cell values (or as many values as are provided on one line) to the end of the table.
 void addRow(String[] cellText)
          Adds a row of cells (or as many cells as are provided) to the table.
 void completeLayout()
          Completes the layout tasks for a table, such as computing frame and row heights.
protected  void createColumn(JCUnit.Measure width, int ordinal)
          Creates a Column and adds it to the column list.
 com.klg.jclass.page.JCPageTable createHeaders()
          Creates a header table for this table.
 void drawTablePart(com.klg.jclass.page.JCFrame frame, int startRow, int startColumn, int endRow, int endColumn, JCUnit.Measure headerH, JCUnit.Measure tableH, JCUnit.Measure tableW)
          This method is used internally by JClass PageLayout and should not be used by applications.
 void fitToFrame(com.klg.jclass.page.JCFrame frame, com.klg.jclass.page.JCTextStyle style)
          Fits the table into the specified frame, scaling the columns in proportion to their original widths.
 int getAlignment()
          Gets the alignment of the table within its frame/column.
 Color getBackgroundColor()
          Gets the color specified for painting the table background.
 int getBorderMode()
          Determines the mode of selecting perimeter borders for a range of cells.
 com.klg.jclass.page.JCDrawStyle getBottomBorder()
          Gets the draw style used for the bottom border.
 JCPageTable.Cell getCell(int row, int column)
          Gets a particular cell from the table, instantiating it if necessary.
 com.klg.jclass.page.JCFrame getCellFrame(int row, int column)
          Gets the frame that holds the contents of a given cell.
 JCPageTable.Column getColumn(int column)
          Gets a column object corresponding to a column number.
 com.klg.jclass.page.JCDrawStyle getColumnBorder()
          Gets the draw style used for the column border.
protected  JCUnit.Measure getColumnBorderWidth()
          Gets the width of the default column border based on consideration both of this table and any header or parent table it may have.
 int getColumnCount()
          Gives the number of columns in the table.
 List getColumnList()
          Returns the list of columns.
 JCUnit.Measure getColumnRangeWidth(int first_column, int last_column)
          Determines the width required for a given range of columns.
 int getColumnSet(int startColumn, JCUnit.Measure available, JCUnit.Measure consumed)
          Determines the range of columns that fits in a space, given the start column.
 JCUnit.Measure getDefaultBottomMargin()
          Gets the default width of the bottom margin.
 int getDefaultCellAlignment()
          Gets the vertical alignment of the cells in this table.
 JCUnit.Measure getDefaultLeftMargin()
          Gets the default width of the left margin.
 JCUnit.Measure getDefaultRightMargin()
          Gets the default width of the right margin.
 com.klg.jclass.page.JCTextStyle getDefaultStyle()
          Gets the default cell text style.
 JCUnit.Measure getDefaultTopMargin()
          Gets the default width of the top margin.
 com.klg.jclass.page.JCDocument getDocument()
          Gets the document to which this table belongs.
 com.klg.jclass.page.JCDrawStyle getHeaderBorder()
          Gets the draw style used for the header border.
 com.klg.jclass.page.JCPageTable getHeaders()
          Gets the table which defines the header of this table.
 JCPageTable.Column getHeadersColumn(int columnIndex)
          Returns the header table's columnIndex column.
 com.klg.jclass.page.JCDrawStyle getLeftBorder()
          Gets the draw style used for the left border.
protected  JCUnit.Measure getLeftBorderWidth()
          Gets the width of the left side border based on consideration both of this table and any header or parent table it may have.
 int getOverflowMode()
          Gets the mode switch which controls the placement of columns that do not fit.
 com.klg.jclass.page.JCDrawStyle getRightBorder()
          Gets the draw style used for the right border.
protected  JCUnit.Measure getRightBorderWidth()
          Gets the width of the right side border based on consideration both of this table and any header or parent table it may have.
 JCPageTable.Row getRow(int row)
          Gets a row from the table, creating it if it doesn't exist.
 com.klg.jclass.page.JCDrawStyle getRowBorder()
          Gets the draw style used for the row border.
 int getRowColumnDominance()
          Gets the dominant direction for precedence of row and column attributes.
 int getRowCount()
          Gives the number of rows in the table.
 List getRowList()
          Returns the list of rows.
 JCUnit.Measure getRowRangeHeight(int first_row, int last_row)
          Determines the height required for a given range of rows.
 int getRowSet(int startRow, JCUnit.Measure available, JCUnit.Measure consumed)
          Determines the range of rows that fits in a certain space, given a start row.
 com.klg.jclass.table.TableDataModel getTableData()
          Gets the table data which stores values associated with the table.
 com.klg.jclass.page.JCDrawStyle getTopBorder()
          Gets the draw style used for the top border.
 boolean hasHeaders()
          Determines if this table has a header.
 boolean isBackgroundColorInherited()
          Determines if the background color is inherited from a higher-level table.
 boolean isBottomBorderInherited()
          Determines if the value reported for the bottom border is inherited.
 boolean isColumnBorderInherited()
          Determines if the value reported for the column border is inherited.
 boolean isDefaultBottomMarginInherited()
          Determines if the default bottom margin is inherited.
 boolean isDefaultCellAlignmentInherited()
          Determines if the vertical cell alignment is inherited.
 boolean isDefaultLeftMarginInherited()
          Determines if the default left margin is inherited.
 boolean isDefaultRightMarginInherited()
          Determines if the default right margin is inherited.
 boolean isDefaultStyleInherited()
          Determines if the default style is inherited.
 boolean isDefaultTopMarginInherited()
          Determines if the default top margin is inherited.
 boolean isHeader()
          Determines if this table forms the header of another table.
 boolean isHeaderBorderInherited()
          Determines if the value being reported for the header border is inherited.
 boolean isLeftBorderInherited()
          Determines if the value reported for the left border is inherited.
 boolean isRightBorderInherited()
          Determines if the value reported for the right border is inherited.
 boolean isRowBorderInherited()
          Determines if the value being reported for the row border is inherited.
 boolean isTopBorderInherited()
          Determines if the value reported for the top border is inherited.
 void printToCell(int row, int column, com.klg.jclass.page.JCTextStyle style, String text)
          Prints the given text to a specified cell using the given style.
 void printToCell(int row, int column, String text)
          Prints the given text to a specified cell, using the cell's style.
 void setAlignment(int alignment)
          Sets the alignment of the table within its frame/column.
 void setAllBorders(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for all table borders.
 void setBackgroundColor(Color color)
          Sets the color specified for painting the table background.
 void setBorderMode(int mode)
          Specifies the mode of selecting perimeter borders for a range of cells.
 void setBottomBorder(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the bottom border.
 void setColumnBorder(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the column border.
 void setColumnWidth(int columnIndex, JCUnit.Measure width)
          Sets the width of a particular column.
 void setColumnWidths(JCUnit.Measure[] columnWidths)
          Sets the width of a particular column.
 void setColumnWidths(List columnWidths)
          Sets the width of a particular column.
protected  void setColumnWidths(Object[] widths)
           
 void setDefaultBottomMargin(JCUnit.Measure width)
          Sets the default width of a cell's bottom margin.
 void setDefaultCellAlignment(int alignment)
          Sets the vertical alignment of the cells in this table.
 void setDefaultLeftMargin(JCUnit.Measure width)
          Sets the default width of a cell's left margin.
 void setDefaultRightMargin(JCUnit.Measure width)
          Sets the default width of a cell's right margin.
 void setDefaultStyle(com.klg.jclass.page.JCTextStyle style)
          Sets the default cell text style.
 void setDefaultTopMargin(JCUnit.Measure width)
          Sets the default width of a cell's top margin.
 void setDocument(com.klg.jclass.page.JCDocument doc)
          Sets the document to which this table belongs.
 void setEdgeBorders(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for all borders in the table's perimeter.
 void setHeaderBorder(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the header border.
 void setHorizontalBorders(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the table's horizontal borders.
 void setInternalBorders(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the table's internal borders.
 void setLeftBorder(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the left border.
 void setOverflowMode(int overflow_mode)
          Sets the mode switch which controls the placement of columns that do not fit.
 void setRightBorder(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the right border.
 void setRowBorder(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the row border.
 void setRowColumnDominance(int dominance)
          Sets the dominant direction for precedence of row and column attributes.
 void setTopBorder(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the top border.
 void setVerticalBorders(com.klg.jclass.page.JCDrawStyle border)
          Sets the draw style used for the table's vertical borders.
 void spanCells(int startRow, int startColumn, int rows, int columns)
          Creates a span across the given range of cells.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

document

protected com.klg.jclass.page.JCDocument document
The document to which this table belongs.


header

protected com.klg.jclass.page.JCPageTable header
The header table describes the table row displayed as a header.


mainTable

protected com.klg.jclass.page.JCPageTable mainTable
The main table is the body of the table. It is associated with a header table row.


rowList

protected List rowList
The row list is an ordered list of rows in the table.


columnList

protected List columnList
The column list is an ordered list of columns in the table.


tableStyle

protected com.klg.jclass.page.JCTableStyle tableStyle
The predefined table style for this table.


defaultCell

protected JCPageTable.Cell defaultCell
A template cell to use as a source of default cell attributes.


alignment

protected int alignment
Tables use the paragraph alignment options for horizontal alignment.


borderMode

protected int borderMode
Controls the borders drawn on the perimeter of a table range.


dominance

protected int dominance
Specifies which of a conflicting row or column attribute has dominance.


overflowMode

protected int overflowMode
Controls where extra columns in a too-wide table appear in the flow.


columnCount

protected int columnCount
Number of columns in the table.


rowCount

protected int rowCount
Number of rows in the table.


isHeader

protected boolean isHeader
True if this table is created as the header of another table.


isComplete

protected boolean isComplete
True if this table has had all frames completed and heights calculated.


tableData

protected com.klg.jclass.table.EditableTableDataModel tableData
This stores data associated with cells on the table.


OVERFLOW_CLIP_COLUMNS

public static final int OVERFLOW_CLIP_COLUMNS
Clips table columns to page.

See Also:
Constant Field Values

OVERFLOW_WRAP_COLUMNS

public static final int OVERFLOW_WRAP_COLUMNS
Wraps table columns to same page.

See Also:
Constant Field Values

OVERFLOW_TEAROFF_COLUMNS

public static final int OVERFLOW_TEAROFF_COLUMNS
Internal use only.

See Also:
Constant Field Values

OVERFLOW_WRAP_COLUMNS_NEXT

public static final int OVERFLOW_WRAP_COLUMNS_NEXT
Wraps table columns to next frame column or flow frame.

See Also:
Constant Field Values

BORDER_USE_INTERNAL

public static final int BORDER_USE_INTERNAL
See Also:
Constant Field Values

BORDER_USE_EXTERNAL

public static final int BORDER_USE_EXTERNAL
See Also:
Constant Field Values

ROW_DOMINANCE

public static final int ROW_DOMINANCE
See Also:
Constant Field Values

COLUMN_DOMINANCE

public static final int COLUMN_DOMINANCE
See Also:
Constant Field Values

CELL_ALIGNMENT_NONE

public static final int CELL_ALIGNMENT_NONE
See Also:
Constant Field Values

CELL_ALIGNMENT_TOP

public static final int CELL_ALIGNMENT_TOP
See Also:
Constant Field Values

CELL_ALIGNMENT_CENTER

public static final int CELL_ALIGNMENT_CENTER
See Also:
Constant Field Values

CELL_ALIGNMENT_BOTTOM

public static final int CELL_ALIGNMENT_BOTTOM
See Also:
Constant Field Values

UNINITIALISED_ROW

public static final JCPageTable.Row UNINITIALISED_ROW

UNINITIALISED_CELL

public static final JCPageTable.Cell UNINITIALISED_CELL
Constructor Detail

JCPageTable

public JCPageTable(com.klg.jclass.page.JCDocument doc,
                   List columnWidths)
Creates a new table with columns as specified in the list of widths.

Parameters:
doc - the document to which this table belongs
columnWidths - a List of column widths of which the table is composed

JCPageTable

public JCPageTable(com.klg.jclass.page.JCDocument doc,
                   List columnWidths,
                   com.klg.jclass.page.JCTableStyle tableStyle)
Creates a new table with columns as specified in the list of widths.

Parameters:
doc - the document to which this table belongs
columnWidths - a List of column widths of which the table is composed
tableStyle - a JCTableStyle which predefines the table style

JCPageTable

public JCPageTable(com.klg.jclass.page.JCDocument doc,
                   JCUnit.Measure[] columnWidths)
Creates a new table with columns as specified in the list of widths.

Parameters:
doc - the document to which this table belongs
columnWidths - an array of column widths of which the table is composed

JCPageTable

public JCPageTable(com.klg.jclass.page.JCDocument doc,
                   JCUnit.Measure[] columnWidths,
                   com.klg.jclass.page.JCTableStyle tableStyle)
Creates a new table with columns as specified in the list of widths.

Parameters:
doc - the document to which this table belongs
columnWidths - an array of column widths of which the table is composed
tableStyle - a JCTableStyle which predefines the table style

JCPageTable

public JCPageTable(com.klg.jclass.page.JCDocument doc,
                   int columnCount,
                   JCUnit.Measure columnWidth)
Creates a new table with the number of columns specified, where each column is a specified width.

Parameters:
doc - the document to which this table belongs
columnCount - the number of columns in this table
columnWidth - a JCUnit.Measure for the width of the columns

JCPageTable

public JCPageTable(com.klg.jclass.page.JCDocument doc,
                   int columnCount,
                   JCUnit.Measure columnWidth,
                   com.klg.jclass.page.JCTableStyle tableStyle)
Creates a new table with the number of columns specified where each column is a specified width.

Parameters:
doc - the document to which this table belongs
columnCount - the number of columns in this table
columnWidth - a JCUnit.Measure for the width of the columns
tableStyle - a JCTableStyle which predefines the table style

JCPageTable

public JCPageTable(com.klg.jclass.page.JCDocument doc,
                   int columnCount)
Creates a new table with the number of columns specified where each column is the default width.

Parameters:
doc - the document to which this table belongs
columnCount - the number of columns in this table

JCPageTable

public JCPageTable(com.klg.jclass.page.JCDocument doc,
                   int columnCount,
                   com.klg.jclass.page.JCTableStyle tableStyle)
Creates a new table with the number of columns specified where each column is the default width.

Parameters:
doc - the document to which this table belongs
columnCount - the number of columns in this table
tableStyle - a JCTableStyle which predefines the table style

JCPageTable

protected JCPageTable(com.klg.jclass.page.JCDocument doc,
                      List columnWidths,
                      com.klg.jclass.page.JCPageTable mainTable,
                      com.klg.jclass.page.JCTableStyle tableStyle)
Creates a new table with columns as specified in the list of widths.

Parameters:
doc - the document to which this table belongs
columnWidths - a List of column widths of which the table is composed
mainTable - null if the table being created is a full (main) table
tableStyle - a JCTableStyle which predefines the table style

JCPageTable

protected JCPageTable(com.klg.jclass.page.JCDocument doc,
                      JCUnit.Measure[] columnWidths,
                      com.klg.jclass.page.JCPageTable mainTable,
                      com.klg.jclass.page.JCTableStyle tableStyle)
Creates a new table with columns as specified in the list of widths.

Parameters:
doc - the document to which this table belongs
columnWidths - a List of column widths of which the table is composed
mainTable - true if the table being created is a full (main) table
tableStyle - a JCTableStyle which predefines the table style

JCPageTable

protected JCPageTable(com.klg.jclass.page.JCDocument doc,
                      Object[] columnWidths,
                      com.klg.jclass.page.JCPageTable mainTable,
                      com.klg.jclass.page.JCTableStyle tableStyle)
Creates a new table with columns as specified in the list of widths.

Parameters:
doc - the document to which this table belongs
columnWidths - a list of column widths of which the table is composed
mainTable - true if the table being created is a full (main) table
tableStyle - a JCTableStyle which predefines the table style

JCPageTable

protected JCPageTable(com.klg.jclass.page.JCDocument doc,
                      com.klg.jclass.page.JCPageTable mainTable,
                      com.klg.jclass.page.JCTableStyle tableStyle)
Creates a new table with unset columns.

Parameters:
doc - the document to which this table belongs
mainTable - true if the table being created is a full (main) table
tableStyle - a JCTableStyle which predefines the table style
Method Detail

fitToFrame

public void fitToFrame(com.klg.jclass.page.JCFrame frame,
                       com.klg.jclass.page.JCTextStyle style)
Fits the table into the specified frame, scaling the columns in proportion to their original widths.
Note: This method should be called before "printing" to any of the cells or the header.

Parameters:
frame - the frame into which the table must fit; if the frame is multi-column, then the table will be sized to the width of a column
style - style to be used to render the table (needed to get the margins used so that the constructor can accurately calculate the width of the table)

getHeadersColumn

public JCPageTable.Column getHeadersColumn(int columnIndex)
Returns the header table's columnIndex column.

Parameters:
columnIndex -
Returns:
header table's columnIndex

setColumnWidth

public void setColumnWidth(int columnIndex,
                           JCUnit.Measure width)
Sets the width of a particular column.
Note: This method should be called before "printing" to any of the cells or the header.

Parameters:
columnIndex -
width -

setColumnWidths

public void setColumnWidths(List columnWidths)
Sets the width of a particular column.
Note: This method should be called before "printing" to any of the cells or the header.

Parameters:
columnWidths -

setColumnWidths

public void setColumnWidths(JCUnit.Measure[] columnWidths)
Sets the width of a particular column.
Note: This method should be called before "printing" to any of the cells or the header.

Parameters:
columnWidths -

setColumnWidths

protected void setColumnWidths(Object[] widths)

addRow

public void addRow(String[] cellText)
Adds a row of cells (or as many cells as are provided) to the table.

Parameters:
cellText - an array of Strings that contain the cell text

addRow

public void addRow(com.klg.jclass.page.JCTextStyle style,
                   String[] cellText)
Adds a row of cells (or as many cells as are provided) to the table.

Parameters:
style - the style to use for the text
cellText - an array of Strings that contain the cell text

addRow

public void addRow(int rowNumber,
                   String[] cellText)
Adds a row of cells (or as many cells as are provided) to the table, given the row number.

Parameters:
rowNumber - the row the cells are to be added in
cellText - an array of Strings that contain the cell text

addRow

public void addRow(int rowNumber,
                   int columnNumber,
                   String[] cellText)
Adds a row of cells (or as many cells as are provided) to the table starting at a given position. All cells must be on the given line.

Parameters:
rowNumber - the row in which to add the cells
columnNumber - the first column in which to place cell text
cellText - an array of Strings that contain the cell text

addRow

public void addRow(Object[] cellValues)
Adds a row of cell values (or as many values as are provided on one line) to the end of the table.

Parameters:
cellValues - an array of Objects which contain the cell values

addRow

public void addRow(int rowNumber,
                   Object[] cellValues)
Adds a row of cell values (or as many values as are provided) to the table in the given position.

Parameters:
rowNumber - the row in which to add the cell values
cellValues - an array of Objects which contain the cell values

addRow

public void addRow(int rowNumber,
                   int columnNumber,
                   Object[] cellValues)
Adds a row of cell values (or as many values as are provided) to the table starting at a given position. All cells must be on the given line.

Parameters:
rowNumber - the row in which to add the cell values
columnNumber - the first column in which to place a cell value
cellValues - an array of Objects which contain the cell values

getAlignment

public int getAlignment()
Gets the alignment of the table within its frame/column.

Returns:
the horizontal alignment (justification) of the table

setAlignment

public void setAlignment(int alignment)
Sets the alignment of the table within its frame/column.

Parameters:
alignment - the horizontal alignment (justification) of the table

isBackgroundColorInherited

public boolean isBackgroundColorInherited()
Determines if the background color is inherited from a higher-level table.

Returns:
true if the background color is inherited

getBackgroundColor

public Color getBackgroundColor()
Gets the color specified for painting the table background.

Returns:
the table's background color

setBackgroundColor

public void setBackgroundColor(Color color)
Sets the color specified for painting the table background.

Parameters:
color - the table's background color

getBorderMode

public int getBorderMode()
Determines the mode of selecting perimeter borders for a range of cells.

Returns:
the border mode (whether cell or table borders are used)

setBorderMode

public void setBorderMode(int mode)
Specifies the mode of selecting perimeter borders for a range of cells.

Parameters:
mode - the border mode (whether cell or table borders are used)

getTopBorder

public com.klg.jclass.page.JCDrawStyle getTopBorder()
Gets the draw style used for the top border.

Returns:
the draw style which controls the appearance of the top border

isTopBorderInherited

public boolean isTopBorderInherited()
Determines if the value reported for the top border is inherited.

Returns:
true if the top border style is inherited from a higher level

setTopBorder

public void setTopBorder(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the top border.

Parameters:
border - the draw style to apply to the table's top border

getBottomBorder

public com.klg.jclass.page.JCDrawStyle getBottomBorder()
Gets the draw style used for the bottom border.

Returns:
the draw style which controls the appearance of the bottom border

isBottomBorderInherited

public boolean isBottomBorderInherited()
Determines if the value reported for the bottom border is inherited.

Returns:
true if the bottom border style is inherited from a higher level

setBottomBorder

public void setBottomBorder(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the bottom border.

Parameters:
border - the draw style to apply to the table's bottom border

getLeftBorder

public com.klg.jclass.page.JCDrawStyle getLeftBorder()
Gets the draw style used for the left border.

Returns:
the draw style which controls the appearance of the left border

isLeftBorderInherited

public boolean isLeftBorderInherited()
Determines if the value reported for the left border is inherited.

Returns:
true if the left border style is inherited from a higher level

setLeftBorder

public void setLeftBorder(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the left border.

Parameters:
border - the draw style to apply to the table's left border

getRightBorder

public com.klg.jclass.page.JCDrawStyle getRightBorder()
Gets the draw style used for the right border.

Returns:
the draw style which controls the appearance of the right border

isRightBorderInherited

public boolean isRightBorderInherited()
Determines if the value reported for the right border is inherited.

Returns:
true if the right border style is inherited from a higher level

setRightBorder

public void setRightBorder(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the right border.

Parameters:
border - the draw style to apply to the table's right border

getRowBorder

public com.klg.jclass.page.JCDrawStyle getRowBorder()
Gets the draw style used for the row border.

Returns:
the draw style which controls the appearance of the row border

isRowBorderInherited

public boolean isRowBorderInherited()
Determines if the value being reported for the row border is inherited.

Returns:
true if the row border style is inherited from a higher level

setRowBorder

public void setRowBorder(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the row border.

Parameters:
border - the draw style to apply to the table's row border

getColumnBorder

public com.klg.jclass.page.JCDrawStyle getColumnBorder()
Gets the draw style used for the column border.

Returns:
the draw style which controls the appearance of the column border

isColumnBorderInherited

public boolean isColumnBorderInherited()
Determines if the value reported for the column border is inherited.

Returns:
true if the column border style is inherited from a higher level

setColumnBorder

public void setColumnBorder(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the column border.

Parameters:
border - the draw style to apply to the table's column border

getHeaderBorder

public com.klg.jclass.page.JCDrawStyle getHeaderBorder()
Gets the draw style used for the header border.

Returns:
the draw style which controls the appearance of the header border

isHeaderBorderInherited

public boolean isHeaderBorderInherited()
Determines if the value being reported for the header border is inherited.

Returns:
true if the header border style is inherited from a higher level

setHeaderBorder

public void setHeaderBorder(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the header border.

Parameters:
border - the draw style to apply to the table's header border

setAllBorders

public void setAllBorders(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for all table borders.

Parameters:
border - the draw style to apply to all the table's borders

setEdgeBorders

public void setEdgeBorders(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for all borders in the table's perimeter.

Parameters:
border - the draw style to apply to all the table's edge borders

setHorizontalBorders

public void setHorizontalBorders(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the table's horizontal borders.

Parameters:
border - the draw style to apply to all horizontal borders

setInternalBorders

public void setInternalBorders(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the table's internal borders.

Parameters:
border - the draw style to apply internally between rows and columns

setVerticalBorders

public void setVerticalBorders(com.klg.jclass.page.JCDrawStyle border)
Sets the draw style used for the table's vertical borders.

Parameters:
border - the draw style to apply to all vertical borders

getCell

public JCPageTable.Cell getCell(int row,
                                int column)
Gets a particular cell from the table, instantiating it if necessary.

Parameters:
row - the row in which to find or create the cell
column - the column that holds the cell
Returns:
the table cell that occupies or obscures (spans) this cell

getCellFrame

public com.klg.jclass.page.JCFrame getCellFrame(int row,
                                                int column)
Gets the frame that holds the contents of a given cell.

Parameters:
row - the cell's row
column - the cell's column
Returns:
the frame object owned by the target cell

printToCell

public void printToCell(int row,
                        int column,
                        String text)
Prints the given text to a specified cell, using the cell's style.

Parameters:
row - the cell's row
column - the cell's column
text - the text to be printed in the cell

printToCell

public void printToCell(int row,
                        int column,
                        com.klg.jclass.page.JCTextStyle style,
                        String text)
Prints the given text to a specified cell using the given style.

Parameters:
row - the cell's row
column - the cell's column
style - the style to use to print the text
text - the text to be printed in the cell

isDefaultCellAlignmentInherited

public boolean isDefaultCellAlignmentInherited()
Determines if the vertical cell alignment is inherited.

Returns:
true if the table is examined to get the cell alignment

getDefaultCellAlignment

public int getDefaultCellAlignment()
Gets the vertical alignment of the cells in this table.

Returns:
the alignment of each cell with respect to its row

setDefaultCellAlignment

public void setDefaultCellAlignment(int alignment)
Sets the vertical alignment of the cells in this table.

Parameters:
alignment - the alignment of each cell with respect to its row

getColumn

public JCPageTable.Column getColumn(int column)
Gets a column object corresponding to a column number.

Parameters:
column - the number of the column to retrieve
Returns:
the column object that represents this column

getColumnCount

public int getColumnCount()
Gives the number of columns in the table.

Returns:
a count of the number of columns in the table

getColumnList

public List getColumnList()
Returns the list of columns.

Returns:
an ordered list of the columns of the table

isDefaultStyleInherited

public boolean isDefaultStyleInherited()
Determines if the default style is inherited.

Returns:
true if there is a parent table from which to get the default style

getDefaultStyle

public com.klg.jclass.page.JCTextStyle getDefaultStyle()
Gets the default cell text style.

Returns:
the default text style used in cell text

setDefaultStyle

public void setDefaultStyle(com.klg.jclass.page.JCTextStyle style)
Sets the default cell text style.

Parameters:
style - a text style to apply to printing in table cells

isDefaultBottomMarginInherited

public boolean isDefaultBottomMarginInherited()
Determines if the default bottom margin is inherited.

Returns:
true if there is a parent to provide the default bottom margin

getDefaultBottomMargin

public JCUnit.Measure getDefaultBottomMargin()
Gets the default width of the bottom margin.

Returns:
a measure of the width of the default bottom margin for all cells

setDefaultBottomMargin

public void setDefaultBottomMargin(JCUnit.Measure width)
Sets the default width of a cell's bottom margin.

Parameters:
width - the size of the bottom margin for table cells

isDefaultTopMarginInherited

public boolean isDefaultTopMarginInherited()
Determines if the default top margin is inherited.

Returns:
true if there is a parent to get the default top margin from

getDefaultTopMargin

public JCUnit.Measure getDefaultTopMargin()
Gets the default width of the top margin.

Returns:
a measure of the width of the default top margin for all cells

setDefaultTopMargin

public void setDefaultTopMargin(JCUnit.Measure width)
Sets the default width of a cell's top margin.

Parameters:
width - the size of the top margin for table cells

isDefaultLeftMarginInherited

public boolean isDefaultLeftMarginInherited()
Determines if the default left margin is inherited.

Returns:
true if there is a parent to get the default left margin from

getDefaultLeftMargin

public JCUnit.Measure getDefaultLeftMargin()
Gets the default width of the left margin.

Returns:
a measure of the width of the default left margin for all cells

setDefaultLeftMargin

public void setDefaultLeftMargin(JCUnit.Measure width)
Sets the default width of a cell's left margin.

Parameters:
width - the size of the left margin for table cells

isDefaultRightMarginInherited

public boolean isDefaultRightMarginInherited()
Determines if the default right margin is inherited.

Returns:
true if there is a parent to provide the default right margin

getDefaultRightMargin

public JCUnit.Measure getDefaultRightMargin()
Gets the default width of the right margin.

Returns:
a measure of the width of the default right margin for all cells

setDefaultRightMargin

public void setDefaultRightMargin(JCUnit.Measure width)
Sets the default width of a cell's right margin.

Parameters:
width - the size of the right margin for table cells

getTableData

public com.klg.jclass.table.TableDataModel getTableData()
Gets the table data which stores values associated with the table.

Returns:
a TableDataModel which can store values and expressions

getDocument

public com.klg.jclass.page.JCDocument getDocument()
Gets the document to which this table belongs.

Returns:
the document which owns this table

setDocument

public void setDocument(com.klg.jclass.page.JCDocument doc)
Sets the document to which this table belongs.

Parameters:
doc - the document which is to own this table

getRowColumnDominance

public int getRowColumnDominance()
Gets the dominant direction for precedence of row and column attributes.

Returns:
the direction to give dominance for attributes

setRowColumnDominance

public void setRowColumnDominance(int dominance)
Sets the dominant direction for precedence of row and column attributes.

Parameters:
dominance - the direction to give dominance for attributes

getHeaders

public com.klg.jclass.page.JCPageTable getHeaders()
Gets the table which defines the header of this table.

Returns:
the table which contains the rows of this table's header

createHeaders

public com.klg.jclass.page.JCPageTable createHeaders()
Creates a header table for this table.
NOTE: This table can't be a header table already.

Returns:

hasHeaders

public boolean hasHeaders()
Determines if this table has a header.

Returns:
true if this table is associated with a header table

isHeader

public boolean isHeader()
Determines if this table forms the header of another table.

Returns:
true if this table's rows are the header for another table

getOverflowMode

public int getOverflowMode()
Gets the mode switch which controls the placement of columns that do not fit.

Returns:
the overflow mode of the table

setOverflowMode

public void setOverflowMode(int overflow_mode)
Sets the mode switch which controls the placement of columns that do not fit.

Parameters:
overflow_mode - the overflow mode of the table

getRow

public JCPageTable.Row getRow(int row)
Gets a row from the table, creating it if it doesn't exist.

Parameters:
row - the number of the row to retrieve
Returns:
the selected row of the table

getRowCount

public int getRowCount()
Gives the number of rows in the table.

Returns:
a count of the number of rows in the table

getRowList

public List getRowList()
Returns the list of rows.

Returns:
an ordered list of table rows

spanCells

public void spanCells(int startRow,
                      int startColumn,
                      int rows,
                      int columns)
Creates a span across the given range of cells.

Parameters:
startRow - the row index of the upper-left cell of the span
startColumn - the column index of the upper-left cell of the span
rows - the number of rows to span downward
columns - the number of columns to span to the right

getRowRangeHeight

public JCUnit.Measure getRowRangeHeight(int first_row,
                                        int last_row)
Determines the height required for a given range of rows.

Parameters:
first_row - the number of the first row in the range
last_row - the number of the last row in the range
Returns:
the total height of the given range of rows, including border space

getColumnRangeWidth

public JCUnit.Measure getColumnRangeWidth(int first_column,
                                          int last_column)
Determines the width required for a given range of columns.

Parameters:
first_column - the number of the first column in the range
last_column - the number of the last column in the range
Returns:
the total width of the given range of columns, including border space

getRowSet

public int getRowSet(int startRow,
                     JCUnit.Measure available,
                     JCUnit.Measure consumed)
Determines the range of rows that fits in a certain space, given a start row.

Parameters:
startRow - the first row of the range
available - the space in which to fit the range of rows
consumed - this is set to the amount of space actually used
Returns:
the last row of the range (inclusive)

getColumnSet

public int getColumnSet(int startColumn,
                        JCUnit.Measure available,
                        JCUnit.Measure consumed)
Determines the range of columns that fits in a space, given the start column.

Parameters:
startColumn - the first column of the range
available - the space in which to fit the range of columns
consumed - this is set to the amount of space actually used
Returns:
the last column of the range (inclusive)

completeLayout

public void completeLayout()
Completes the layout tasks for a table, such as computing frame and row heights.


drawTablePart

public void drawTablePart(com.klg.jclass.page.JCFrame frame,
                          int startRow,
                          int startColumn,
                          int endRow,
                          int endColumn,
                          JCUnit.Measure headerH,
                          JCUnit.Measure tableH,
                          JCUnit.Measure tableW)
This method is used internally by JClass PageLayout and should not be used by applications.

Draws a set (rectangular row/column range) of cells from a table.

Parameters:
frame - the frame in which the table is being constructed
startRow - the first row of the table from which to paste cells
startColumn - the first column of the table from which to paste cells
endRow - the last row of the table from which to paste cells
endColumn - the last column of the table from which to paste cells
headerH - the amount of vertical space required for headers
tableH - the amount of vertical space computed for the table
tableW - the amount of horizontal space allocated to the table part

createColumn

protected void createColumn(JCUnit.Measure width,
                            int ordinal)
Creates a Column and adds it to the column list.

Parameters:
width - the width for this column
ordinal - the position of this column

getLeftBorderWidth

protected JCUnit.Measure getLeftBorderWidth()
Gets the width of the left side border based on consideration both of this table and any header or parent table it may have.

Returns:
the width required for the left side border

getRightBorderWidth

protected JCUnit.Measure getRightBorderWidth()
Gets the width of the right side border based on consideration both of this table and any header or parent table it may have.

Returns:
the width required for the right side border

getColumnBorderWidth

protected JCUnit.Measure getColumnBorderWidth()
Gets the width of the default column border based on consideration both of this table and any header or parent table it may have.

Returns:
the width required for the default column border

Copyright © 2004 Quest Software Inc..
All rights reserved.