grendel.widgets
Interface ColumnModel

All Known Implementing Classes:
ColumnModelImp

public abstract interface ColumnModel

An interface for the data model that stores the layout of a set of columns. This interface is shared by the ColumnHeaders and the TreeTable to provide a common column layout for both.


Method Summary
 void addColumn(Column aColumn)
          Add a column to the model.
 void addColumnAt(Column aColumn, int aIndex)
          Add a column to the model at a specified index.
 void addColumnModelListener(ColumnModelListener aListener)
          Adds a ColumnModelListener.
 Column getColumn(int aIndex)
           
 Column getColumn(java.lang.Object aID)
           
 int getColumnCount()
           
 int getColumnIndex(Column aColumn)
           
 int getColumnIndexAtX(int aX)
           
 int getColumnMargin()
           
 java.util.Enumeration getColumns()
           
 java.lang.String getPrefString()
           
 Column getSelectedColumn()
           
 int getTotalColumnWidth()
           
 void moveColumn(int aSource, int aDest)
          Moves a column at the source index to the destination index.
 void removeColumn(Column aColumn)
          Removes a column from the model.
 void removeColumnModelListener(ColumnModelListener aListener)
          Removes a ColumnModelListener.
 void setColumnMargin(int aMargin)
          Sets the margin (gap) between columns.
 void setPrefString(java.lang.String aString)
          Restores a column layout that was obtained from getPrefString().
 void setSelectedColumn(Column aColumn)
          Sets the currently selected column.
 

Method Detail

addColumn

public void addColumn(Column aColumn)
Add a column to the model. The column is added at the end.

addColumnAt

public void addColumnAt(Column aColumn,
                        int aIndex)
Add a column to the model at a specified index. An exception may be if the index is invalid.

removeColumn

public void removeColumn(Column aColumn)
Removes a column from the model.

moveColumn

public void moveColumn(int aSource,
                       int aDest)
Moves a column at the source index to the destination index. Columns in between may be shifted. An exception may be thrown if either index is invalid.

getColumnCount

public int getColumnCount()
Returns:
The total number of columns in this model.

getColumn

public Column getColumn(int aIndex)
Returns:
The column at the given index. Returns null if index is invalid.

getColumn

public Column getColumn(java.lang.Object aID)
Returns:
The column with the given ID. Returns null if a column with the given ID is not in the model.

getColumns

public java.util.Enumeration getColumns()
Returns:
An enumeration of all the columns in the model.

getColumnIndex

public int getColumnIndex(Column aColumn)
Returns:
The index of the column in the model. Returns -1 if the column is not in the model.

getColumnIndexAtX

public int getColumnIndexAtX(int aX)
Returns:
The index of the column at the given X location. Returns -1 if the given X does not fall over a column.

getColumnMargin

public int getColumnMargin()
Returns:
The margin (gap) between columns.

setColumnMargin

public void setColumnMargin(int aMargin)
Sets the margin (gap) between columns.

getTotalColumnWidth

public int getTotalColumnWidth()
Returns:
The sum of all column widths and margins.

addColumnModelListener

public void addColumnModelListener(ColumnModelListener aListener)
Adds a ColumnModelListener.

removeColumnModelListener

public void removeColumnModelListener(ColumnModelListener aListener)
Removes a ColumnModelListener.

getSelectedColumn

public Column getSelectedColumn()
Returns:
The currently selected column.

setSelectedColumn

public void setSelectedColumn(Column aColumn)
Sets the currently selected column. Currently only single selection is supported.

getPrefString

public java.lang.String getPrefString()
Returns:
A string representing the layout (order and widths) of the columns.

setPrefString

public void setPrefString(java.lang.String aString)
Restores a column layout that was obtained from getPrefString().