JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.table
Class JCCellLayout

java.lang.Object
  |
  +--com.klg.jclass.table.JCCellLayout
All Implemented Interfaces:
CellLayoutModel, Serializable

public class JCCellLayout
extends Object
implements CellLayoutModel, Serializable

Maintain row/column heights and widths in a "chain" or array of runs. An individual chain keeps track of row heights or column widths.

See Also:
Serialized Form

Nested Class Summary
 class JCCellLayout.Chain
          The Chain class encodes a List of row heights or column widths as a sequence of Runs.
 class JCCellLayout.Run
          A Run is a series of items with the same value.
 
Field Summary
protected  int column_label_height
           
protected  JCCellLayout.Chain heights
           
protected  int row_label_width
           
protected  com.klg.jclass.table.JCTable table
           
protected  JCCellLayout.Chain widths
           
 
Constructor Summary
JCCellLayout()
           
 
Method Summary
 void addColumns(int start_column, int num_columns)
          Inserts the given number of columns.
 void addRows(int start_row, int num_rows)
          Inserts the given number of rows.
 void deleteColumns(int start_column, int num_columns)
          Deletes the given number of columns.
 void deleteRows(int start_row, int num_rows)
          Deletes the given number of rows.
 Rectangle getBounds(int row, int column)
          Returns the bounds of the given cell or label.
 Rectangle getBounds(int start_row, int start_column, int end_row, int end_column)
          Returns the bounds of a cell range.
 Rectangle getBounds(int start_row, int start_column, int end_row, int end_column, Rectangle r)
          Gets the bounds of a cell range using the given Rectangle.
 Rectangle getBounds(int row, int column, Rectangle r)
          Gets the bounds of the given cell or label using the given Rectangle.
 int getColumn(int x, int y)
          Determines the column that contains the given (x,y) coordinate.
 int getColumnPosition(int column)
          Returns the start position of a column.
 int getHeight(int row)
          Returns the height of a row.
 int getRow(int x, int y)
          Determines the row that contains the given (x,y) coordinate.
 int getRowPosition(int row)
          Returns the start position of a row.
 com.klg.jclass.table.JCTable getTable()
          Returns the JCTable.
 int getWidth(int column)
          Returns the width of a column.
static void main(String[] args)
           
 void moveColumns(int start_column, int num_columns, int destination)
          Moves a set of columns to a position left of the destination.
 void moveRows(int start_row, int num_rows, int destination)
          Moves a set of rows to a position above the destination.
 void remapColumns(int[] current_map, int[] new_map)
          Remaps widths after the column map changes.
 void remapRows(int[] current_map, int[] new_map)
          Remaps heights after the row map changes.
 void resetColumns()
          Removes cached width information.
 void resetRows()
          Removes cached height information.
 void setHeight(int row, int value)
          Sets the height of a row.
 void setHeight(int start_row, int end_row, int value)
          Sets the height of a range of rows.
 void setTable(com.klg.jclass.table.JCTable table)
          Sets the JCTable.
 void setWidth(int column, int value)
          Sets the width of a column.
 void setWidth(int start_column, int end_column, int value)
          Sets the width of a range of columns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected com.klg.jclass.table.JCTable table

column_label_height

protected int column_label_height

row_label_width

protected int row_label_width

widths

protected JCCellLayout.Chain widths

heights

protected JCCellLayout.Chain heights
Constructor Detail

JCCellLayout

public JCCellLayout()
Method Detail

getTable

public com.klg.jclass.table.JCTable getTable()
Returns the JCTable.

Specified by:
getTable in interface CellLayoutModel
Returns:
JCTable

setTable

public void setTable(com.klg.jclass.table.JCTable table)
Sets the JCTable.

Specified by:
setTable in interface CellLayoutModel
Parameters:
table -

getHeight

public int getHeight(int row)
Returns the height of a row.

Specified by:
getHeight in interface CellLayoutModel
Parameters:
row -
Returns:
height of a row

setHeight

public void setHeight(int row,
                      int value)
Sets the height of a row.

Specified by:
setHeight in interface CellLayoutModel
Parameters:
row -
value -

setHeight

public void setHeight(int start_row,
                      int end_row,
                      int value)
Sets the height of a range of rows.

Specified by:
setHeight in interface CellLayoutModel
Parameters:
end_row -
start_row -
value -

getWidth

public int getWidth(int column)
Returns the width of a column.

Specified by:
getWidth in interface CellLayoutModel
Parameters:
column -
Returns:
width of a column

setWidth

public void setWidth(int column,
                     int value)
Sets the width of a column.

Specified by:
setWidth in interface CellLayoutModel
Parameters:
column -
value -

setWidth

public void setWidth(int start_column,
                     int end_column,
                     int value)
Sets the width of a range of columns.

Specified by:
setWidth in interface CellLayoutModel
Parameters:
end_column -
start_column -
value -

getColumn

public int getColumn(int x,
                     int y)
Determines the column that contains the given (x,y) coordinate.

Specified by:
getColumn in interface CellLayoutModel
Parameters:
x -
y -
Returns:

getRow

public int getRow(int x,
                  int y)
Determines the row that contains the given (x,y) coordinate.

Specified by:
getRow in interface CellLayoutModel
Parameters:
x -
y -
Returns:

getColumnPosition

public int getColumnPosition(int column)
Returns the start position of a column.

Specified by:
getColumnPosition in interface CellLayoutModel
Parameters:
column -
Returns:
start position of a column

getRowPosition

public int getRowPosition(int row)
Returns the start position of a row.

Specified by:
getRowPosition in interface CellLayoutModel
Parameters:
row -
Returns:
start position of a row

getBounds

public Rectangle getBounds(int row,
                           int column)
Returns the bounds of the given cell or label.

Specified by:
getBounds in interface CellLayoutModel
Parameters:
row -
column -
Returns:
bounds of the given cell or label

getBounds

public Rectangle getBounds(int row,
                           int column,
                           Rectangle r)
Gets the bounds of the given cell or label using the given Rectangle.

Specified by:
getBounds in interface CellLayoutModel
Parameters:
column -
r -
row -
Returns:
bounds of the given cell or label

getBounds

public Rectangle getBounds(int start_row,
                           int start_column,
                           int end_row,
                           int end_column)
Returns the bounds of a cell range.

Specified by:
getBounds in interface CellLayoutModel
Parameters:
end_column -
end_row -
start_column -
start_row -
Returns:
bounds of a cell range

getBounds

public Rectangle getBounds(int start_row,
                           int start_column,
                           int end_row,
                           int end_column,
                           Rectangle r)
Gets the bounds of a cell range using the given Rectangle.

Specified by:
getBounds in interface CellLayoutModel
Parameters:
end_column -
end_row -
r -
start_column -
start_row -
Returns:
bounds of a cell range

moveRows

public void moveRows(int start_row,
                     int num_rows,
                     int destination)
Moves a set of rows to a position above the destination. To move rows to the end, use JCTableEnum.MAXINT.

Specified by:
moveRows in interface CellLayoutModel
Parameters:
start_row - the first row
num_rows - the number of rows to move
destination - the row before which the moved rows are inserted

moveColumns

public void moveColumns(int start_column,
                        int num_columns,
                        int destination)
Moves a set of columns to a position left of the destination. To move columns to the end, use JCTableEnum.MAXINT.

Specified by:
moveColumns in interface CellLayoutModel
Parameters:
start_column - the first column
num_columns - the number of columns to move
destination - the column before which the moved columns are inserted

addRows

public void addRows(int start_row,
                    int num_rows)
Inserts the given number of rows.

Specified by:
addRows in interface CellLayoutModel
Parameters:
start_row - the first row
num_rows - the number of rows to insert

addColumns

public void addColumns(int start_column,
                       int num_columns)
Inserts the given number of columns.

Specified by:
addColumns in interface CellLayoutModel
Parameters:
start_column - the first column
num_columns - the number of columns to insert

deleteRows

public void deleteRows(int start_row,
                       int num_rows)
Deletes the given number of rows.

Specified by:
deleteRows in interface CellLayoutModel
Parameters:
start_row - the first row
num_rows - the number of rows to delete

deleteColumns

public void deleteColumns(int start_column,
                          int num_columns)
Deletes the given number of columns.

Specified by:
deleteColumns in interface CellLayoutModel
Parameters:
start_column - the first column
num_columns - the number of columns to delete

remapRows

public void remapRows(int[] current_map,
                      int[] new_map)
Remaps heights after the row map changes.

Specified by:
remapRows in interface CellLayoutModel
Parameters:
current_map -
new_map -

remapColumns

public void remapColumns(int[] current_map,
                         int[] new_map)
Remaps widths after the column map changes.

Specified by:
remapColumns in interface CellLayoutModel
Parameters:
current_map -
new_map -

resetRows

public void resetRows()
Removes cached height information.

Specified by:
resetRows in interface CellLayoutModel

resetColumns

public void resetColumns()
Removes cached width information.

Specified by:
resetColumns in interface CellLayoutModel

main

public static void main(String[] args)

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