Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## be.fgov.ehealth.ehvalidator.gui
Class XTableColumnModel

    java.lang.Object
      javax.swing.table.DefaultTableColumnModel
          be.fgov.ehealth.ehvalidator.gui.XTableColumnModel

All Implemented Interfaces:
  PropertyChangeListener, Serializable, EventListener, ListSelectionListener, TableColumnModel

    public class XTableColumnModel

extends DefaultTableColumnModel

`XTableColumnModel` extends the DefaultTableColumnModel . It provides a comfortable way to hide/show columns. Columns keep their positions when hidden and shown again. In order to work with JTable it cannot add any events to `TableColumnModelListener`. Therefore hiding a column will result in `columnRemoved` event and showing it again will notify listeners of a `columnAdded`, and possibly a `columnMoved` event. For the same reason the following methods still deal with visible columns only: getColumnCount(), getColumns(), getColumnIndex(), getColumn() There are overloaded versions of these methods that take a parameter `onlyVisible` which let's you specify wether you want invisible columns taken into account.

Version:
  0.9 04/03/01
Author:
  Stephen Kelvin, mail@StephenKelvin.de
See Also:
  `DefaultTableColumnModel`, Serialized Form

Field Summary
`protected Vector` | `allTableColumns` Array of TableColumn objects in this model.

Fields inherited from class javax.swing.table.DefaultTableColumnModel
`changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth`

Method Summary
`void` | `addColumn(TableColumn column)` Append `column` to the right of exisiting columns.
`TableColumn` | `getColumn(int columnIndex, boolean onlyVisible)` Returns the `TableColumn` object for the column at `columnIndex`.
`TableColumn` | `getColumnByModelIndex(int modelColumnIndex)` Maps the index of the column in the table model at `modelColumnIndex` to the TableColumn object.
`int` | `getColumnCount(boolean onlyVisible)` Returns the total number of columns in this model.
`int` | `getColumnIndex(Object identifier, boolean onlyVisible)` Returns the position of the first column whose identifier equals `identifier`.
`Enumeration` | `getColumns(boolean onlyVisible)` Returns an `Enumeration` of all the columns in the model.
`boolean` | `isColumnVisible(TableColumn aColumn)` Checks wether the specified column is currently visible.
`void` | `moveColumn(int oldIndex, int newIndex)` Moves the column from `oldIndex` to `newIndex`.
`void` | `removeColumn(TableColumn column)` Removes `column` from this column model.
`void` | `setAllColumnsVisible()` Makes all columns in this model visible
`void` | `setColumnVisible(TableColumn column, boolean visible)` Sets the visibility of the specified TableColumn.

Methods inherited from class javax.swing.table.DefaultTableColumnModel
`addColumnModelListener, createSelectionModel, fireColumnAdded, fireColumnMarginChanged, fireColumnMoved, fireColumnRemoved, fireColumnSelectionChanged, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnModelListeners, getColumns, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, propertyChange, recalcWidthCache, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel, valueChanged`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### allTableColumns

    protected Vector allTableColumns

  Array of TableColumn objects in this model. Holds all column objects, regardless of their visibility

Method Detail

### setColumnVisible

    public void setColumnVisible(TableColumn column,
                                 boolean visible)

  Sets the visibility of the specified TableColumn. The call is ignored if the TableColumn is not found in this column model or its visibility status did not change.

  Parameters:
    `aColumn` - the column to show/hide
    `visible` - its new visibility status

### setAllColumnsVisible

    public void setAllColumnsVisible()

  Makes all columns in this model visible

### getColumnByModelIndex

    public TableColumn getColumnByModelIndex(int modelColumnIndex)

  Maps the index of the column in the table model at `modelColumnIndex` to the TableColumn object. There may me multiple TableColumn objects showing the same model column, though this is uncommon. This method will always return the first visible or else the first invisible column with the specified index.

  Parameters:
    `modelColumnIndex` - index of column in table model
  Returns:
    table column object or null if no such column in this column model

### isColumnVisible

    public boolean isColumnVisible(TableColumn aColumn)

  Checks wether the specified column is currently visible.

  Parameters:
    `aColumn` - column to check
  Returns:
    visibility of specified column (false if there is no such column at all. [It's not visible, right?])

### addColumn

    public void addColumn(TableColumn column)

  Append `column` to the right of exisiting columns. Posts `columnAdded` event.

  Specified by:
    `addColumn` in interface `TableColumnModel`
  Overrides:
    `addColumn` in class `DefaultTableColumnModel`
  Parameters:
    `column` - The column to be added
  Throws:
    `IllegalArgumentException` - if `column` is `null`
  See Also:
    `removeColumn(javax.swing.table.TableColumn)`

### removeColumn

    public void removeColumn(TableColumn column)

  Removes `column` from this column model. Posts `columnRemoved` event. Will do nothing if the column is not in this model.

  Specified by:
    `removeColumn` in interface `TableColumnModel`
  Overrides:
    `removeColumn` in class `DefaultTableColumnModel`
  Parameters:
    `column` - the column to be added
  See Also:
    `addColumn(javax.swing.table.TableColumn)`

### moveColumn

    public void moveColumn(int oldIndex,
                           int newIndex)

  Moves the column from `oldIndex` to `newIndex`. Posts `columnMoved` event. Will not move any columns if `oldIndex` equals `newIndex`.

  Specified by:
    `moveColumn` in interface `TableColumnModel`
  Overrides:
    `moveColumn` in class `DefaultTableColumnModel`
  Parameters:
    `oldIndex` - index of column to be moved
    `newIndex` - new index of the column
  Throws:
    `IllegalArgumentException` - if either `oldIndex` or `newIndex` are not in [0, getColumnCount() - 1]

### getColumnCount

    public int getColumnCount(boolean onlyVisible)

  Returns the total number of columns in this model.

  Parameters:
    `onlyVisible` - if set only visible columns will be counted
  Returns:
    the number of columns in the `tableColumns` array
  See Also:
    `getColumns(boolean)`

### getColumns

    public Enumeration getColumns(boolean onlyVisible)

  Returns an `Enumeration` of all the columns in the model.

  Parameters:
    `onlyVisible` - if set all invisible columns will be missing from the enumeration.
  Returns:
    an `Enumeration` of the columns in the model

### getColumnIndex

    public int getColumnIndex(Object identifier,
                              boolean onlyVisible)

  Returns the position of the first column whose identifier equals `identifier`. Position is the the index in all visible columns if `onlyVisible` is true or else the index in all columns.

  Parameters:
    `identifier` - the identifier object to search for
    `onlyVisible` - if set searches only visible columns
  Returns:
    the index of the first column whose identifier equals `identifier`
  Throws:
    `IllegalArgumentException` - if `identifier` is `null`, or if no `TableColumn` has this `identifier`
  See Also:
    `getColumn(int, boolean)`

### getColumn

    public TableColumn getColumn(int columnIndex,
                                 boolean onlyVisible)

  Returns the `TableColumn` object for the column at `columnIndex`.

  Parameters:
    `columnIndex` - the index of the column desired
    `onlyVisible` - if set columnIndex is meant to be relative to all visible columns only else it is the index in all columns
  Returns:
    the `TableColumn` object for the column at `columnIndex`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

eHealth Validator Master project 1.1.0 API
Copyright © 2010 Smals. All Rights Reserved.