Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table
Class GroupTableColumn

java.lang.Object
  extended by javax.swing.table.TableColumn
      extended by com.sciapp.table.GroupTableColumn
All Implemented Interfaces:
Serializable

public class GroupTableColumn
extends TableColumn

GroupTableColumn is a TableColumn subclass that contains a collection of 'children' columns and a group column parent.

See Also:
Serialized Form

Field Summary
protected  Vector children
          the vector of this group table column children.
protected  int height
          the height of the group column
protected  int margin
          this group table column's margin.
protected  GroupTableColumn parent
          this group table column's parent.
protected  boolean showChildren
          boolean that controls the visibility of the columns underneath this group column.
 
Fields inherited from class javax.swing.table.TableColumn
CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, COLUMN_WIDTH_PROPERTY, HEADER_RENDERER_PROPERTY, HEADER_VALUE_PROPERTY, headerRenderer, headerValue, identifier, isResizable, maxWidth, minWidth, modelIndex, resizedPostingDisableCount, width
 
Constructor Summary
GroupTableColumn(Object headerValue)
          Constructs a GroupTableColumn.
GroupTableColumn(Object headerValue, int width)
          Constructs a GroupTableColumn.
GroupTableColumn(Object headerValue, int width, TableCellRenderer cellRenderer, TableCellEditor cellEditor)
          Constructs a GroupTableColumn.
 
Method Summary
 void addColumn(TableColumn aColumn)
          Appends aColumn to the end of the children vector.
 void clear()
          Removes all columns from the children vector.
 int getDepth()
          Returns the depth of the model rooted at this group column: the longest distance from this group column that ends to a simple TableColumn.
 int getHeight()
          Retrieves the height of the group column, as it appears in the header.
 int getLevel()
          Returns the number of levels above this group column: the distance from the root column to this column.
 GroupTableColumn getParent()
          Returns this group column's parent or null if this group column has no parent.
 int getPreferredWidth()
          Returns the preferred width of the TableColumn.
 boolean getShowChildren()
          Determines the visibility of the columns underneath this group column.
 TableColumn getTableColumnAt(int index)
          Returns the table column at index.
 int getTableColumnCount()
          Returns the number of this group column's children.
 Enumeration getTableColumns()
          Returns an enumeration of this group column's children.
 int getTrueTableColumnCount()
          Returns the number of children table columns that are not instances of GroupTableColumn.
 Enumeration getTrueTableColumns()
          Returns an enumeration of all table columns that are not instances of GroupTableColumn.
 Vector getTrueTableColumnsArray()
          Returns a list of all table columns that are not instances of GroupTableColumn.
 int getWidth()
          Returns the width of the TableColumn.
 int getWidth(int endIndex)
          Returns the total width of the columns up to and NOT including the column at endIndex.
 int indexOfColumn(TableColumn aColumn)
          Returns the index at which the supplied table column is found in the vector of children.
 void insertColumn(TableColumn aColumn, int index)
          Inserts aColumn to the children vector at index.
 void moveColumn(int fromIndex, int toIndex)
          Moves a child column.
 void removeColumn(int columnIndex)
          Removes the column specified by columnIndex from the children vector.
 void removeColumn(TableColumn aColumn)
          Removes aColumn from the children vector.
 void setColumnMargin(int newMargin)
          Sets the column margin to newMargin.
 void setParent(GroupTableColumn parent)
          Assigns a new parent group column.
 void setShowChildren(boolean showChildren)
          Assigns the visibility behaviour of the columns underneath this group column.
 
Methods inherited from class javax.swing.table.TableColumn
addPropertyChangeListener, createDefaultHeaderRenderer, disableResizedPosting, enableResizedPosting, getCellEditor, getCellRenderer, getHeaderRenderer, getHeaderValue, getIdentifier, getMaxWidth, getMinWidth, getModelIndex, getPropertyChangeListeners, getResizable, removePropertyChangeListener, setCellEditor, setCellRenderer, setHeaderRenderer, setHeaderValue, setIdentifier, setMaxWidth, setMinWidth, setModelIndex, setPreferredWidth, setResizable, setWidth, sizeWidthToFit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected Vector children
the vector of this group table column children.


parent

protected GroupTableColumn parent
this group table column's parent.


margin

protected int margin
this group table column's margin.


showChildren

protected boolean showChildren
boolean that controls the visibility of the columns underneath this group column.


height

protected int height
the height of the group column

Constructor Detail

GroupTableColumn

public GroupTableColumn(Object headerValue)
Constructs a GroupTableColumn.


GroupTableColumn

public GroupTableColumn(Object headerValue,
                        int width)
Constructs a GroupTableColumn.


GroupTableColumn

public GroupTableColumn(Object headerValue,
                        int width,
                        TableCellRenderer cellRenderer,
                        TableCellEditor cellEditor)
Constructs a GroupTableColumn.

Method Detail

addColumn

public void addColumn(TableColumn aColumn)
Appends aColumn to the end of the children vector.

Parameters:
aColumn - the column to add.

clear

public void clear()
Removes all columns from the children vector.


getDepth

public int getDepth()
Returns the depth of the model rooted at this group column: the longest distance from this group column that ends to a simple TableColumn. If this group column has no children, returns 0.

Returns:
the depth of the group table column model whose root is this group column.

getHeight

public int getHeight()
Retrieves the height of the group column, as it appears in the header.

Returns:
the group column's height

getLevel

public int getLevel()
Returns the number of levels above this group column: the distance from the root column to this column. If this column is the root, returns 0.

Returns:
the number of levels above this group column.

getParent

public GroupTableColumn getParent()
Returns this group column's parent or null if this group column has no parent.

Returns:
this group column's parent, or null if this group column has no parent.

getPreferredWidth

public int getPreferredWidth()
Returns the preferred width of the TableColumn. The default preferred width is 75.

Overrides:
getPreferredWidth in class TableColumn
Returns:
the preferredWidth property
See Also:
TableColumn.setPreferredWidth(int)

getShowChildren

public boolean getShowChildren()
Determines the visibility of the columns underneath this group column.

Returns:
true if the children columns will be visible, false otherwise.

getTableColumnAt

public TableColumn getTableColumnAt(int index)
Returns the table column at index.

Parameters:
index - the index of the table column to retrieve.
Returns:
the table column at index.

getTableColumnCount

public int getTableColumnCount()
Returns the number of this group column's children.

Returns:
the children table column count.

getTableColumns

public Enumeration getTableColumns()
Returns an enumeration of this group column's children.

Returns:
an enumeration of this group column's children.

getTrueTableColumnCount

public int getTrueTableColumnCount()
Returns the number of children table columns that are not instances of GroupTableColumn.

Returns:
the column count of children table columns, excluding GroupTableColumns

getTrueTableColumns

public Enumeration getTrueTableColumns()
Returns an enumeration of all table columns that are not instances of GroupTableColumn.

Returns:
an enumeration of all table columns that are not instances of GroupTableColumn.

getTrueTableColumnsArray

public Vector getTrueTableColumnsArray()
Returns a list of all table columns that are not instances of GroupTableColumn.

Returns:
a list of all table columns that are not instances of GroupTableColumn.

getWidth

public int getWidth()
Returns the width of the TableColumn. The default width is 75.

Overrides:
getWidth in class TableColumn
Returns:
the width property
See Also:
TableColumn.setWidth(int)

getWidth

public int getWidth(int endIndex)
Returns the total width of the columns up to and NOT including the column at endIndex.

Parameters:
endIndex - the index of the column up to which the total width is retrieved.
Returns:
the total width of the columns up to and NOT including the column at endIndex.

indexOfColumn

public int indexOfColumn(TableColumn aColumn)
Returns the index at which the supplied table column is found in the vector of children.

Parameters:
aColumn - the table column to find.
Returns:
the index at which the column was found, or -1 if it was not found.

insertColumn

public void insertColumn(TableColumn aColumn,
                         int index)
Inserts aColumn to the children vector at index.

Parameters:
aColumn - the column to insert
index - the position to insert the column at

moveColumn

public void moveColumn(int fromIndex,
                       int toIndex)
Moves a child column.

Parameters:
fromIndex - the column index to move from
toIndex - the column index to move to

removeColumn

public void removeColumn(int columnIndex)
Removes the column specified by columnIndex from the children vector.

Parameters:
columnIndex - the index of the column to remove.

removeColumn

public void removeColumn(TableColumn aColumn)
Removes aColumn from the children vector.

Parameters:
aColumn - the column to remove.

setColumnMargin

public void setColumnMargin(int newMargin)
Sets the column margin to newMargin. This method also sets the margin for the group column's children.

Parameters:
newMargin - the new margin to set.

setParent

public void setParent(GroupTableColumn parent)
Assigns a new parent group column.

Parameters:
parent - the new parent group column to assign.

setShowChildren

public void setShowChildren(boolean showChildren)
Assigns the visibility behaviour of the columns underneath this group column.

Parameters:
showChildren - true if the children columns will be visible, false otherwise.

Copyright © 2005 Scientific Applications. All Rights Reserved.