com.pcauto.gui.table
Class EntityTable

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.pcauto.gui.table.EntityTable
All Implemented Interfaces:
javax.accessibility.Accessible, EntityListListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.event.TableColumnModelListener

public class EntityTable
extends javax.swing.JPanel
implements EntityListListener, javax.swing.event.TableColumnModelListener

EntityTable is a full-featured swing-based GUI component that represents a list of entities in a table with each row representing a different entity. This component can be used to provide users with the ability to edit specific properties of entities and/or to just manage the list of entities.

EntityTable conforms to the model/delegate framework and is driven by two different types of models. The EntityList is an interface for the container being used to manage the entity objects. The EntityTableColumnModel defines the column representation of the entity properties. Once these two classes have been provided, the table can be rendered.

The following is a brief feature list of the EntityTable:

Detailed Features of the EntityTable

Focus Modes

Three modes of focus are permitted: Table, Row, and Cell. The focus modes are specified in EntityTableFocusType.
 
Table Focus

Table focus allows the entire table to be manipulated at once. Clicking on the top left corner of the table when the virtual column is enabled will result in the selection of the entire table regardless of the current focus mode. Selecting the entire table provides a quick way to delete all the rows from the table.

Row Focus

Row focus allows individual or groups of rows to be selected. If row focus is the currently selected focus mode and the user double clicks on a cell, the cell is placed into edit mode (the user can change the value of the cell if cell editing is enabled), and the focus mode is automatically changed to cell focus.

When in row focus mode, the arrow keys can be used to move the focus from row to row and to pan across columns of the table.

Cell Focus

Cell focus allows one or more cells to be selected. If the user is in cell focus and clicks on a cell in the virtual column, the corresponding row will be highlighted and the focus mode will change to row focus. See the "virtual column" section below for more information about virtual columns. Cell navigation can be performed using the keyboard as well as the mouse. If cell focus is enabled and a cell is highlighted or being edited, then the user can use the up or down arrows on the keyboard to move up or down one cell respectively. The tab key can be used along with the shift key to traverse cells horizontally. Pressing tab will move one cell to the right, and pressing shift+tab will move one cell to the left. While a cell is being edited it is possible to undo the changes made while editing by pressing the escape key. To commit the change to the cell value, either another cell must be clicked using the mouse, or the enter key must be pressed. Pressing the enter key also moves the focus to the cell in the next column in the table. If the cell being edited was in the rightmost column, then the cell in the leftmost column in the next row is given the focus.

Focus modes can also be enabled or disabled by using the following functions: setTableFocusAllowed(boolean), setRowFocusAllowed(boolean), and setCellFocusAllowed(boolean). setCurrentFocusMode(EntityTableFocusType) can be called to change or set the currently used focus mode. The change will only take affect if the specified focus mode is allowed (see the functions mentioned above).

To further manage the behaviour of the selection modes, a ListSelectionModel can also be provided. It allows the following selection attributes to be specified (in order of increasing restrictions):

Sorting

The row sorting function is accessible to users by double clicking on the header of the column to drive the sort operation. Repeated double clicking on the column header alternates sorting between ascending and descending order. In addition to this, two different sorting methods can be specified.
The two sorting methods are: Sorting by multiple columns is also possible using the sortByColumns(Vector) method. This method will sort by all the columns specified.

Since sorting changes the order of the displayed rows, the user can decide if the change to the displayed row order affects the underlying EntityList order. Two functions are provided for this purpouse: setListToTableOrder(), and setTableToListOrder(). The first updates the order of the entities in the underlying EntityList to match the order displayed in the EntityTable. The second function does the reverse, it updates the display order to match the order of the entities in the underlying EntityList.

This distinction between the displayed and underlying/logical EntityList order allows the user to have an ordering of the displayed entities that is different from that of the underlying EntityList order. It allows greater user customization without impacting the actual data order. Two methods are provided for retrieving the EntityList associated with the display order and the underlying EntityList order. The getDisplayEntityList() function returns an EntityList that holds the entities in display order. The getEntityList() function returns an EntityList that holds the entities in the underlying data order. Both returned EntityLists are equivalent except possibly for the order of the entities. See setListToTableOrder() and setTableToListOrder() for more information. If order locking is turned on by calling setOrderLockedToList(boolean) then both functions above will return equivalent EntityLists where the order of the entities will also match. Row sorting will also be disabled since the display order will match the underlying EntityList order.

Table Column Properties

The EntityTableColumnModel specifies the columns that will be displayed in this EntityTable and defines the mapping between an entity and all columns. It can be used to specify the following properties for the columns displayed in this EntityTable: The EntityTable also allows the user to change the order of the columns by dragging the column in the table to a different location. Locked, and unlocked columns can both have their order changed with the restriction that all the locked columns must be together, and all the unlocked columns must be together.

EntityList

The EntityList stores the entities that make up this table. It allows listeners to be notified of any changes to the EntityList. It also provides the functionality to manage the entities.

The setDefaultEntity(Object) method of EntityList can be used to set the desirable values of an entity. The values in the entity provided to the setDefaultEntity(Object) method are used to set the default values that will be displayed in the virtual row before user modification.

Virtual Row

A virtual row, displayed at the bottom of the table, allows the user to add another entity to the table. Whenever the user modifies a value in the virtual row and stops editing the row, a new row is added to the table matching the values in the virtual row. The virtual row can be enabled or disabled using the setVirtualRowEnabled(boolean) function.

Virtual Column

The virtual column is a column that is displayed on the left side of the table before any other columns. It can be used to select rows if row selection is enabled, or to display useful information to the user such as the row number or the row index. The virtual column is always visible if enabled, even when the user pans across the columns in the table.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
EntityTable()
          Constructs a new EntityTable.
EntityTable(EntityList eList, EntityTableColumnModel cModel)
          Constructs a new EntityTable with the given EntityList to manage the entities and the EntityTableColumnModel to define the columns of the table.
 
Method Summary
 void columnAdded(javax.swing.event.TableColumnModelEvent e)
          Updates the table after a column has been added.
 int columnAtPoint(java.awt.Point p)
          Returns the index of the column at the given Point.
 void columnMarginChanged(javax.swing.event.ChangeEvent e)
          Updates the table after a change to the column margins.
 void columnMoved(javax.swing.event.TableColumnModelEvent e)
          Updates the table after a column has been moved.
 void columnRemoved(javax.swing.event.TableColumnModelEvent e)
          Updates the table after removing a column.
 void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
          Updates the table after a change in the column selection.
 java.awt.Color getBackground()
          Returns the background colour of table cells which are not highlighted/selected.
 EntityTableColumnModel getColumnModel()
          Returns the EntityTableColumnModel which defines the table columns.
 EntityTableFocusType getCurrentFocusMode()
          Returns the currently used focus mode.
 EntityTableFocusType getDefaultFocusMode()
          Returns the default focus mode, this is one of EntityTableFocusType.ROW_FOCUS, EntityTableFocusType.CELL_FOCUS, or EntityTableFocusType.TABLE_FOCUS.
 int getDisplayedEntityIndexAtPoint(java.awt.Point p)
          Returns the index of the entity at the given point.
 EntityList getDisplayEntityList()
          Returns the EntityList in which all the entities are ordered in their display order.
 javax.swing.ListSelectionModel getDisplaySelectionModel()
          Returns the selection model associated with the display EntityList.
 java.lang.Object getEntityAtPoint(java.awt.Point p)
          Returns the entity in the EntityList displayed at the given point.
 int getEntityIndexAtPoint(java.awt.Point p)
          Returns the index of the entity in the EntityList displayed at the point specified on the screen.
 EntityList getEntityList()
          Returns the EntityList containing all the entities of the table.
 int getRowHeight()
          Returns the height of a table row, in pixels.
 java.awt.Color getSelectionBackground()
          Returns the selection background colour displayed for selected cells.
 int getSelectionMode()
          Returns the selection method for the table.
 javax.swing.ListSelectionModel getSelectionModel()
          Returns the selection model used to handle selections associated with the EntityList.
 boolean isCellFocusAllowed()
          Returns true if focusing on a cell is allowed, false otherwise.
 boolean isEntityIndexDisplayed()
          Returns true if the entity index is displayed in the virtual column, false otherwise.
 boolean isOrderLockedToList()
          Returns true if the changes in displayed row order affect the order in the driving EntityList.
 boolean isReadOnly()
          Returns true if the table is readOnly, false otherwise.
 boolean isRowFocusAllowed()
          Returns true if focusing on an entire row is allowed, false otherwise.
 boolean isRowNumberDisplayed()
          Returns true if row numbers are displayed in the virtual column, false otherwise.
 boolean isRowSortingAllowed()
          Returns true if row sorting is allowed, false otherwise.
 boolean isTableFocusAllowed()
          Returns true if focusing on the entire table is allowed, false otherwise.
 boolean isVirtualColumnEnabled()
          Returns true if the virtual column is enabled, false otherwise.
 boolean isVirtualRowEnabled()
          Returns true if this table has the virtual row enabled, false otherwise.
 boolean isWidthAutoCalculated()
          Returns true if the width is auto calculated, false otherwise.
 void listChanged(EntityListEvent e)
          Fires a table change event.
 void refresh()
          Updates the EntityTable with any changes made to the column model.
 void revalidate()
          Updates the EntityTable with any changes made to the column model.
 int rowAtPoint(java.awt.Point p)
          Returns the index of the row at the given Point.
 void setBackground(java.awt.Color c)
          Sets the background colour of the table.
 void setCellFocusAllowed(boolean a)
          Enables or disables focusing on a cell.
 void setColumnModel(EntityTableColumnModel cModel)
          Sets the EntityTableColumnModel that defines the table columns and the mapping between an entity and the table columns.
 void setCurrentFocusMode(EntityTableFocusType f)
          Sets the currently used focus mode.
 void setDefaultFocusMode(EntityTableFocusType f)
          Sets the default focus mode.
 void setDisplaySelectionModel(javax.swing.ListSelectionModel l)
          Sets the selection model used to select table data.
 void setEntityIndexDisplayed(boolean d)
          Enables or disables display of the entity indices in the virtual column.
 void setEntityList(EntityList eList)
          Sets the EntityList for this table, replacing the current EntityList.
 void setListToTableOrder()
          Sets the order of the entities in the EntityList to match the displayed order of the EntityTable.
 void setMaximumSize(java.awt.Dimension p)
          Sets the maximum size of the table.
 void setMinimumSize(java.awt.Dimension p)
          Sets the minimum size of the table.
 void setOrderLockedToList(boolean b)
          Enables or disables Order Locking.
 void setPreferredSize(java.awt.Dimension p)
          Sets the preferred size of the table.
 void setReadOnly(boolean r)
          Makes the table readOnly or enables editing of the table.
 void setRowFocusAllowed(boolean a)
          Enables or disables forcusing on an entire row.
 void setRowHeight(int rowHeight)
           
 void setRowNumberDisplayed(boolean d)
          Enables or disables displaying of the row numbers in the virtual column.
 void setRowSortingAllowed(boolean b)
          Enables or disables row sorting.
 void setSelectionBackground(java.awt.Color c)
          Sets the background colour displayed for cells which are selected.
 void setSelectionMode(int mode)
          Sets the selection method for the table.
 void setSelectionModel(javax.swing.ListSelectionModel l)
          Sets the selection model which is used to handle selections in the table.
 void setTableFocusAllowed(boolean a)
          Enables or disables focusing on the entire table.
 void setTableToListOrder()
          Sets the display order of the table entities to be that of the driving EntityList.
 void setVirtualColumnEnabled(boolean v)
          Enables or disables the virtual column.
 void setVirtualRowEnabled(boolean v)
          Enables or disables the virtual row at the bottom of the table.
 void setWidthAutoCalculated(boolean b)
          Enables or disables auto calculation of the table width.
 void sortByColumns(java.util.Vector columns)
          Sorts the rows according to the columns specified.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EntityTable

public EntityTable()
Constructs a new EntityTable.


EntityTable

public EntityTable(EntityList eList,
                   EntityTableColumnModel cModel)
Constructs a new EntityTable with the given EntityList to manage the entities and the EntityTableColumnModel to define the columns of the table.

Parameters:
eList - the EntityList managing all the entities in the table
cModel - the EntityTableColumnModel defining the table columns
Method Detail

getRowHeight

public int getRowHeight()
Returns the height of a table row, in pixels.

Returns:
the height in pixel of a table row

setRowHeight

public void setRowHeight(int rowHeight)

columnAtPoint

public int columnAtPoint(java.awt.Point p)
Returns the index of the column at the given Point. The index returned can be used with the EntityTableColumnModel to retrieve the actual column or adjust column properties. The virtual column is not counted. The Point x and y values start at 0 and represent a location on the screen in pixels.

Parameters:
p - Point on the table
Returns:
int the index of the column. The first column has index 0.

rowAtPoint

public int rowAtPoint(java.awt.Point p)
Returns the index of the row at the given Point. The index returned can be used with the EntityList to retrieve the actual row. The Point x and y values start at 0 and represent a location on the screen in pixels.

Parameters:
p - Point on the table
Returns:
int index of the row. The first row has index 0.

getDisplayedEntityIndexAtPoint

public int getDisplayedEntityIndexAtPoint(java.awt.Point p)
Returns the index of the entity at the given point. The index returned can be used with the displayed EntityList to retrieve the actual row. The point x and y values start at 0 and represent a location on the screen in pixels.

Parameters:
p - Point on the table
Returns:
int index of the row. The first row has index 0.

getEntityIndexAtPoint

public int getEntityIndexAtPoint(java.awt.Point p)
Returns the index of the entity in the EntityList displayed at the point specified on the screen. The first entity has index 0. Since an entity corresponds to a row of table data, this actually returns the row index. The point x and y values start at 0 and represent a location on the screen.

Parameters:
p - Point on the table
Returns:
int the index of the entity

getEntityAtPoint

public java.lang.Object getEntityAtPoint(java.awt.Point p)
Returns the entity in the EntityList displayed at the given point. The first entity has index 0. The point x and y values start at 0 and represent a location on the screen.

Parameters:
p - Point on the table
Returns:
Object the entity at the given location

getEntityList

public EntityList getEntityList()
Returns the EntityList containing all the entities of the table. The EntityList can be null and manages the entities that represent the table data.

Returns:
the EntityList containing the table data

setEntityList

public void setEntityList(EntityList eList)
Sets the EntityList for this table, replacing the current EntityList. This is a quick way to replace the entire table data.

Parameters:
eList - the EntityList which stores the entitites in this table

getColumnModel

public EntityTableColumnModel getColumnModel()
Returns the EntityTableColumnModel which defines the table columns.

Returns:
the EntityTableColumnModel describing columns and the mapping between an entity and the table columns

setColumnModel

public void setColumnModel(EntityTableColumnModel cModel)
Sets the EntityTableColumnModel that defines the table columns and the mapping between an entity and the table columns.

Parameters:
cModel - the EntityTableColumnModel describing the table columns

setWidthAutoCalculated

public void setWidthAutoCalculated(boolean b)
Enables or disables auto calculation of the table width. If enabled, the table will resize itself so that all columns will be visible.

Parameters:
b - enabled if true, disabled otherwise

isWidthAutoCalculated

public boolean isWidthAutoCalculated()
Returns true if the width is auto calculated, false otherwise. If enabled, the table will resize itself so that all columns will be visible.

Returns:
true if enabled, false otherwise

isVirtualRowEnabled

public boolean isVirtualRowEnabled()
Returns true if this table has the virtual row enabled, false otherwise. See the class description for this EntityTable for more information.

Returns:
true if the virtual row is enabled, false otherwise

setVirtualRowEnabled

public void setVirtualRowEnabled(boolean v)
Enables or disables the virtual row at the bottom of the table. By bringing focus to, editing, then leaving any cell within the virtual row, the user implicitly adds another row to this EntityTable. The virtual entity is actually added to the table if the virtual row loses focus (after being edited) or if the user presses the Enter key when the cell-editor for the right-most editable column in the virtual entity has the focus. Disabling the virtual row will prevent users from adding new rows to the table by using the table user interface. Rows can still be added using method calls.

Parameters:
v - enables the virtual row if true, disables otherwise

isVirtualColumnEnabled

public boolean isVirtualColumnEnabled()
Returns true if the virtual column is enabled, false otherwise. The virtual column is an extra column that appears to the left of any normal columns and is always visible, even when the user scrolls the columns of the EntityTable. It can be used to select rows, if row selection is enabled and to display useful information about the row, such as the row number or the row index.

Returns:
returns true if the virtual column is enabled, false otherwise

setVirtualColumnEnabled

public void setVirtualColumnEnabled(boolean v)
Enables or disables the virtual column. The virtual column is an extra column that appears to the left of any normal columns and is always visible, even when the user scrolls the columns of the Entitytable. It can be used to select rows, if row selection is enabled and to display useful information about the row, such as the row number or the row index.

Parameters:
v - enabled if true, disabled otherwise

isRowNumberDisplayed

public boolean isRowNumberDisplayed()
Returns true if row numbers are displayed in the virtual column, false otherwise. This displays the number of the visible row in the virtual column. Row numbers start at one for the topmost row. Note: the virtual row will have an '*' to distinguish it from any other row, and thus will not have a row number.

Returns:
true if row numbers are displayed, false otherwise

setRowNumberDisplayed

public void setRowNumberDisplayed(boolean d)
Enables or disables displaying of the row numbers in the virtual column. This displays the number of the visible row in the virtual column. Row numbers start at one for the topmost row. Note: the virtual row will have an '*' to distinguish it from any other row, and thus will not have a row number.

Parameters:
d - enabled if true, disabled otherwise

isEntityIndexDisplayed

public boolean isEntityIndexDisplayed()
Returns true if the entity index is displayed in the virtual column, false otherwise. This displays a number for each row representing the order in which the rows were added to the table. Note: the virtual row will have an '*' to distinguish it from any other row, and thus will not have a number.

Returns:
true if entity index is displayed, false otherwise

setEntityIndexDisplayed

public void setEntityIndexDisplayed(boolean d)
Enables or disables display of the entity indices in the virtual column. This displays a number for each row representing the order in which the rows were added to the table. Note: the virtual row will have an '*' to distinguish it from any other row, and thus will not have a number.

Parameters:
d - enabled if true, disabled otherwise

isReadOnly

public boolean isReadOnly()
Returns true if the table is readOnly, false otherwise. If enabled it prevents editing of the table data, if disabled it allows editing.

Returns:
true if the table is read only, false otherwise

setReadOnly

public void setReadOnly(boolean r)
Makes the table readOnly or enables editing of the table. If enabled it prevents editing of the table data, if disabled it allows editing.

Parameters:
r - makes the table readOnly if true, editable otherwise

isOrderLockedToList

public boolean isOrderLockedToList()
Returns true if the changes in displayed row order affect the order in the driving EntityList. If enabled then the order of the table data matches the order of the table data in the EntityList. If enabled then rows can't be sorted by double clicking on column headers.

Returns:
true if the order is locked, false otherwise

setOrderLockedToList

public void setOrderLockedToList(boolean b)
Enables or disables Order Locking. If enabled then the order of the table data matches the order of the table data in the EntityList. If enabled then rows can't be sorted by double clicking on column headers.

Parameters:
b - order locked if true, not locked otherwise

isRowSortingAllowed

public boolean isRowSortingAllowed()
Returns true if row sorting is allowed, false otherwise. If enabled then rows can be sorted by double clicking on the column headers. By repeated double clicking, sorting is switched between ascending and descending order.

Returns:
true if row sorting is allowed, false otherwise

setRowSortingAllowed

public void setRowSortingAllowed(boolean b)
Enables or disables row sorting. If enabled then rows can be sorted by double clicking on the column headers. By repeated double clicking, sorting is switched between ascending and descending order.

Parameters:
b - enabled if true, disabled otherwise

sortByColumns

public void sortByColumns(java.util.Vector columns)
Sorts the rows according to the columns specified. The Vector holds column index Integers. The rows will be sorted according to all the columns specified.

Parameters:
columns - the Vector containing the indices of the columns to sort by

setListToTableOrder

public void setListToTableOrder()
Sets the order of the entities in the EntityList to match the displayed order of the EntityTable.


setTableToListOrder

public void setTableToListOrder()
Sets the display order of the table entities to be that of the driving EntityList.


getDefaultFocusMode

public EntityTableFocusType getDefaultFocusMode()
Returns the default focus mode, this is one of EntityTableFocusType.ROW_FOCUS, EntityTableFocusType.CELL_FOCUS, or EntityTableFocusType.TABLE_FOCUS. The default focus mode determines what method will be used when the user is navigating through the table.

Returns:
the EntityTableFocusType representing the default mode of focus

setDefaultFocusMode

public void setDefaultFocusMode(EntityTableFocusType f)
Sets the default focus mode. This can be one of EntityTableFocusType.ROW_FOCUS, EntityTableFocusType.CELL_FOCUS, or EntityTableFocusType.TABLE_FOCUS. The property should only be set to a focus mode if that focus mode is enabled. For example, setting the default focus mode to row, when the row focus mode has been disabled should be avoided. Setting the default focus mode to one which is not enabled is ignored. To enable or disable focus modes call the following methods: setRowFocusAllowed(boolean), setCellFocusAllowed(boolean), and setTableFocusAllowed(boolean).

Parameters:
f - the new focus mode

getSelectionMode

public int getSelectionMode()
Returns the selection method for the table. Valid selection methods are:
See ListSelectionModel for more details.

Returns:
the symbolic identifier indicationg which selection mode is currently being used

setSelectionMode

public void setSelectionMode(int mode)
Sets the selection method for the table. Valid selection methods are:
See ListSelectionModel for more details.

Parameters:
mode - the new selection method

setSelectionBackground

public void setSelectionBackground(java.awt.Color c)
Sets the background colour displayed for cells which are selected.

Parameters:
c - the new colour of the selection background

getSelectionBackground

public java.awt.Color getSelectionBackground()
Returns the selection background colour displayed for selected cells.

Returns:
the selection background colour

setBackground

public void setBackground(java.awt.Color c)
Sets the background colour of the table. This is the colour displayed for the background of every cell that is not highlighted/selected.

Parameters:
c - the new colour to set the background to

getBackground

public java.awt.Color getBackground()
Returns the background colour of table cells which are not highlighted/selected.

Returns:
the background colour

getCurrentFocusMode

public EntityTableFocusType getCurrentFocusMode()
Returns the currently used focus mode. Only one method of focus is allowed at any one time. This returns the one being used currently. This is the method by which a user can select/highlight cells. See getSelectionMode function for information about selection. Valid values are EntityTableFocusType.ROW_FOCUS, EntityTableFocusType.CELL_FOCUS, or EntityTableFocusType.TABLE_FOCUS.

Returns:
the focus mode

setCurrentFocusMode

public void setCurrentFocusMode(EntityTableFocusType f)
Sets the currently used focus mode. Only one method of focus is allowed at any one time. This sets the one being used currently. This is the method by which a user can select/highlight cells. See getSelectionMode function for information about selection. Valid values are EntityTableFocusType.ROW_FOCUS, EntityTableFocusType.CELL_FOCUS, or EntityTableFocusType.TABLE_FOCUS.

Parameters:
f - the new focus mode

isTableFocusAllowed

public boolean isTableFocusAllowed()
Returns true if focusing on the entire table is allowed, false otherwise. See setCurrentFocusMode for more details.

Returns:
true if table focus is allowed, false otherwise

setTableFocusAllowed

public void setTableFocusAllowed(boolean a)
Enables or disables focusing on the entire table. See setCurrentFocusMode for more details.

Parameters:
a - enabled if true, disabled otherwise

isRowFocusAllowed

public boolean isRowFocusAllowed()
Returns true if focusing on an entire row is allowed, false otherwise. See setCurrentFocusMode for more details.

Returns:
true if row focus is allowed, false otherwise

setRowFocusAllowed

public void setRowFocusAllowed(boolean a)
Enables or disables forcusing on an entire row. See setCurrentFocusMode for more details.

Parameters:
a - enabled if true, disabled otherwise

isCellFocusAllowed

public boolean isCellFocusAllowed()
Returns true if focusing on a cell is allowed, false otherwise. See setCurrentFocusMode for more details.

Returns:
true if cell focus is allowed, false otherwise

setCellFocusAllowed

public void setCellFocusAllowed(boolean a)
Enables or disables focusing on a cell. See setCurrentFocusMode method for more details.

Parameters:
a - enabled if true, disabled otherwise

getDisplayEntityList

public EntityList getDisplayEntityList()
Returns the EntityList in which all the entities are ordered in their display order. See the class description of EntityList for more information.

Returns:
the entity list

getDisplaySelectionModel

public javax.swing.ListSelectionModel getDisplaySelectionModel()
Returns the selection model associated with the display EntityList. The ListSelectionModel is the model which controls selection in the table. Some valid selection modes are:
See ListSelectionModel for more information.

Returns:
the ListSelectionModel used to select information in the table

setDisplaySelectionModel

public void setDisplaySelectionModel(javax.swing.ListSelectionModel l)
Sets the selection model used to select table data. The ListSelectionModel is the model which controls selection in the table. Some valid selection modes are:
See ListSelectionModel for more information.

Parameters:
l - the new ListSelectionModel

getSelectionModel

public javax.swing.ListSelectionModel getSelectionModel()
Returns the selection model used to handle selections associated with the EntityList.

Returns:
the ListSelectionModel which handles selection

setSelectionModel

public void setSelectionModel(javax.swing.ListSelectionModel l)
Sets the selection model which is used to handle selections in the table.

Parameters:
l - the new ListSelectionModel which handles selection in the table

refresh

public void refresh()
Updates the EntityTable with any changes made to the column model. This method must be called after certain operations such as showing and hiding columns, and locking or unlocking columns. The revalidate and refresh methods perform the same function.


revalidate

public void revalidate()
Updates the EntityTable with any changes made to the column model. This method must be called after certain operations such as showing and hiding columns, and locking or unlocking columns. The revalidate and refresh methods perform the same function.


setMinimumSize

public void setMinimumSize(java.awt.Dimension p)
Sets the minimum size of the table. This is the smallest size the table is allowed to be. The dimension is given as a width and height.

Parameters:
p - the Dimension which represents the new size

setMaximumSize

public void setMaximumSize(java.awt.Dimension p)
Sets the maximum size of the table. This is the largest size the table is allowed to be. The dimension is given as a width and height.

Parameters:
p - the Dimension which represents the new size

setPreferredSize

public void setPreferredSize(java.awt.Dimension p)
Sets the preferred size of the table. This is the size the table will try to be. The dimension is given as a width and height.

Parameters:
p - the new size

listChanged

public void listChanged(EntityListEvent e)
Fires a table change event. This method is called when the table data has changed.

Specified by:
listChanged in interface EntityListListener
Parameters:
e - the EntityListEvent providing information about the event

columnAdded

public void columnAdded(javax.swing.event.TableColumnModelEvent e)
Updates the table after a column has been added. This method is called whenever a new column is added to the table.

Specified by:
columnAdded in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the TableColumnModelEvent that contains the details about the event

columnMarginChanged

public void columnMarginChanged(javax.swing.event.ChangeEvent e)
Updates the table after a change to the column margins. This method must be called whenever the column width changes so that that Table can update it's column sizes and resize appropriately. If this method is not called then when the user changes the column size by moving the mouse onto the dividing line between column titles and attempts to resize the column, the column will not resize.

Specified by:
columnMarginChanged in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the ChangeEvent that contains the details about the event

columnMoved

public void columnMoved(javax.swing.event.TableColumnModelEvent e)
Updates the table after a column has been moved.

Specified by:
columnMoved in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the TableColumnModelEvent that contains the details about the event

columnRemoved

public void columnRemoved(javax.swing.event.TableColumnModelEvent e)
Updates the table after removing a column.

Specified by:
columnRemoved in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the TableColumnModelEvent that contains the details about the event

columnSelectionChanged

public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
Updates the table after a change in the column selection.

Specified by:
columnSelectionChanged in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the ListSelectionEvent that contains the details about the event