arlut.csd.JTable
Class baseTable

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--arlut.csd.JTable.baseTable
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
gridTable, rowTable

public class baseTable
extends javax.swing.JComponent
implements java.awt.event.AdjustmentListener, java.awt.event.ActionListener

baseTable is an AWT table component, supporting a wide variety of table displays based on an underlying grid model. Columns and rows may be separated by lines or not, and baseTable supports a variety of vertical filling behaviors for those cases in which the baseTable doesn't contain enough rows for its size.

baseTable supports a hierarchy of attribute sets for its rendering. An attribute set comprises a font, justification, and foreground / background colors. Such an attribute set can be assigned to the headers of the table, to the body of the table as a whole, to the individual columns of the table, and to the individual cells themselves.

The baseTable supports intelligent scrollbars, dynamic column sizing, user adjustable columns, and popup menus.

baseTable is not yet a full featured table/grid component. baseTable currently doesn't support the selection of individual cells and/or columns, nor does it support cut and paste or in-cell editing. These are not currently priorities for baseTable, and the current code is not designed for such applications.

baseTable is intended to provide a flexible row-oriented report table in which the user can select a row for action by a program that incorporates a baseTable. The ability to select rows can be turned off, in which case baseTable becomes strictly a display component.

See Also:
rowTable, gridTable, Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.ActionStandin, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  java.awt.Rectangle bounding_rect
           
(package private)  tableCanvas canvas
           
(package private)  java.util.Vector colPos
           
(package private)  java.util.Vector cols
           
(package private) static boolean debug
           
(package private)  javax.swing.JScrollBar hbar
           
(package private)  boolean hbar_visible
           
(package private)  tableAttr headerAttrib
           
(package private)  javax.swing.JPopupMenu headerMenu
           
(package private)  java.awt.Color hHeadLineColor
           
(package private)  int hHeadLineThickness
           
(package private)  boolean horizLines
           
(package private)  java.awt.Color hRowLineColor
           
(package private)  int hRowLineThickness
           
(package private)  boolean hVertFill
           
(package private)  java.awt.Insets in
           
(package private)  javax.swing.JPopupMenu menu
           
(package private)  int menuCol
           
(package private)  int menuRow
           
(package private)  int origTotalWidth
           
(package private)  int row_baseline
           
(package private)  int row_height
           
(package private)  java.util.Vector rows
           
(package private)  int rowsToShow
           
(package private)  float scalefact
           
(package private)  int selectedRow
           
(package private)  tableAttr tableAttrib
           
(package private)  javax.swing.JScrollBar vbar
           
(package private)  boolean vbar_visible
           
(package private)  boolean vertFill
           
(package private)  boolean vertLines
           
(package private)  java.awt.Color vHeadLineColor
           
(package private)  int vLineThickness
           
(package private)  java.awt.Color vRowLineColor
           
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, uiClassID, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
baseTable(int[] colWidths, java.lang.String[] headers, javax.swing.JPopupMenu menu, javax.swing.JPopupMenu headerMenu)
          Constructor with default fonts, justification, and behavior
baseTable(tableAttr headerAttrib, tableAttr tableAttrib, tableAttr[] colAttribs, int[] colWidths, java.awt.Color vHeadLineColor, java.awt.Color vRowLineColor, java.awt.Color hHeadLineColor, java.awt.Color hRowLineColor, java.lang.String[] headers, boolean horizLines, boolean vertLines, boolean vertFill, boolean hVertFill, javax.swing.JPopupMenu menu, javax.swing.JPopupMenu headerMenu)
          This is the base constructor for baseTable, which allows all aspects of the baseTable's appearance and behavior to be customized.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Override this method to implement the popup menu hook.
 void addRow(boolean repaint)
          Adds a new row to the bottom of the table
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
          Handles scrollbar events.
(package private)  void adjustScrollbars()
          Internal method Check to see whether we need scrollbars in our current component size, set the min/max/visible parameters This method is intended to be called from reShape().
(package private)  void calcCols()
          Internal method Calculate our columns.
(package private)  void calcFonts()
          Internal method Calculate our fonts and measurements.
(package private)  int calcVSize()
          Internal method calculate the total vertical size of the rows only
 void clearCells()
          Erases all the cells in the table and removes any per-cell attribute sets.
 void clickInCell(int x, int y)
          Old Hook for subclasses to implement selection logic
 void clickInCell(int x, int y, boolean rightClick)
          Hook for subclasses to implement selection logic
 void deleteColumn(int index, boolean reportion)
          This method takes the given column out of the table entirely.
 void deleteRow(int num, boolean repaint)
          Deletes a row from the table
(package private)  int displayRegionFirstLine()
          This method returns the first line of the display area, below the headers.
 void doubleClickInCell(int x, int y)
          Hook for subclasses to implement selection logic
 tableCell getCell(int x, int y)
          Access a cell from the table
 tableAttr getCellAttr(tableCell cell)
          Gets the tableAttr of a cell in the table.
 java.lang.String getCellText(int x, int y)
          Gets the contents of a cell in the table.
 java.lang.String getCellText(tableCell cell)
          Gets the contents of a cell in the table.
 int getRowCount()
          This method returns the number of rows in the table.
 java.util.Vector getTableHeaders()
          This method returns a Vector of Strings containing the titles of columns currently in the table.
 java.lang.String getWrappedCellText(int x, int y)
          Gets the contents of a cell in the table.
 java.lang.String getWrappedCellText(tableCell cell)
          Gets the contents of a cell in the table.
 void optimizeCols()
          This method will go through all of the columns and optimize the pole placement to minimize wasted space and provide a decent balance of row and column sizes.
(package private)  void reCalcRowPos(int startRow)
          This method is used to recalculate the vertical position of all of the rows in the table below startRow.
 void refreshTable()
          Causes the table to be updated and redisplayed.
 void reinitialize(int[] colWidths, java.lang.String[] headers)
          Reinitializes the table with a new set of columns / headers
 void reinitialize(tableAttr[] colAttribs, int[] colWidths, java.lang.String[] headers)
          Reinitializes the table with a new set of columns / headers
(package private)  void reShape()
          Internal method This method recalculates the general parameters of our table's display.
(package private)  void scrollRowTo(int rowIndex, int y)
          This method is used to adjust the vertical scrollbar (if present) such that row has its topEdge at y
 void selectCell(int x, int y)
          Mark a cell as selected
 void selectCol(int x)
          Mark a column as selected
 void selectRow(int y)
          Mark a row as selected
 void setBounds(int x, int y, int width, int height)
          This method is called when our size is changed.
 void setCellAttr(tableCell cell, tableAttr attr, boolean repaint)
          Sets the tableAttr of a cell in the table.
 void setCellBackColor(tableCell cell, java.awt.Color color, boolean repaint)
          Sets the background color of a cell A color of (Color) null will cause baseTable to revert to using the background selected for the column (if defined) or the background for the table.
 void setCellColor(tableCell cell, java.awt.Color color, boolean repaint)
          Sets the foreground color of a cell A color of (Color) null will cause baseTable to revert to using the foreground selected for the column (if defined) or the foreground for the table.
 void setCellFont(tableCell cell, java.awt.Font font, boolean repaint)
          Sets the font of a cell in the table.
 void setCellJust(tableCell cell, int just, boolean repaint)
          Sets the justification of a cell in the table.
 void setCellText(tableCell cell, java.lang.String cellText, boolean repaint)
          Sets the contents of a cell in the table.
 void setColAttr(int x, tableAttr attr, boolean repaint)
          Sets the tableAttr for a column A attr of (tableAttr) null will cause baseTable to revert to using the table defaults for this column.
 void setColBackColor(int x, java.awt.Color color, boolean repaint)
          Sets the background color of a column A color of (Color) null will cause baseTable to revert to using the background selected for the table.
 void setColColor(int x, java.awt.Color color, boolean repaint)
          Sets the foreground color of a column A color of (Color) null will cause baseTable to revert to using the foreground selected for the table.
 void setColFont(int x, java.awt.Font font, boolean repaint)
          Sets the font of a column A font of (Font) null will cause baseTable to revert to using the table's default font for this column.
 void setColJust(int x, int just, boolean repaint)
          Sets the justification of a column in the table.
 void setHeadAttr(tableAttr attr, boolean repaint)
          Sets the tableAttr of headers in the table.
 void setHeadBackColor(java.awt.Color color, boolean repaint)
          Sets the background color of headers in the table.
 void setHeadColor(java.awt.Color color, boolean repaint)
          Sets the foreground color of headers in the table.
 void setHeadFont(java.awt.Font font, boolean repaint)
          Sets the font for headers in the table.
 void setRows(int numRows, boolean repaint)
          Changes the number of rows in the table
 void setRowsVisible(int x)
          This method sets the number of rows that the table will display.
 void setTableAttr(tableAttr attr, boolean repaint)
          Sets the tableAttr for the table
 void setTableBackColor(java.awt.Color color, boolean repaint)
          Sets the background color of the table
 void setTableColor(java.awt.Color color, boolean repaint)
          Sets the foreground color of the table
 void setTableFont(java.awt.Font font, boolean repaint)
          Sets the default font for the table
 void setTableJust(int just, boolean repaint)
          Sets the default justification of cells in the table.
 boolean testCellSelected(int x, int y)
          Returns true if cell (x,y) is currently selected
 boolean testColSelected(int x)
          Returns true if col x is currently selected
 boolean testRowSelected(int y)
          Returns true if row y is currently selected
 void unSelectAll()
          Unselect all cells
 void unSelectCell(int x, int y)
          Mark a cell as unselected
 void unSelectCol(int x)
          Mark a column as unselected
 void unSelectRow(int y)
          Mark a row as unselected
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, , addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paintWithBuffer, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update, updateUI, writeObject
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

debug

static final boolean debug

canvas

tableCanvas canvas

hbar

javax.swing.JScrollBar hbar

vbar

javax.swing.JScrollBar vbar

origTotalWidth

int origTotalWidth

row_height

int row_height

row_baseline

int row_baseline

vLineThickness

int vLineThickness

hHeadLineThickness

int hHeadLineThickness

hRowLineThickness

int hRowLineThickness

rowsToShow

int rowsToShow

scalefact

float scalefact

bounding_rect

java.awt.Rectangle bounding_rect

in

java.awt.Insets in

hbar_visible

boolean hbar_visible

vbar_visible

boolean vbar_visible

horizLines

boolean horizLines

vertLines

boolean vertLines

vertFill

boolean vertFill

hVertFill

boolean hVertFill

colPos

java.util.Vector colPos

headerAttrib

tableAttr headerAttrib

tableAttrib

tableAttr tableAttrib

vHeadLineColor

java.awt.Color vHeadLineColor

vRowLineColor

java.awt.Color vRowLineColor

hHeadLineColor

java.awt.Color hHeadLineColor

hRowLineColor

java.awt.Color hRowLineColor

rows

java.util.Vector rows

cols

java.util.Vector cols

headerMenu

javax.swing.JPopupMenu headerMenu

menu

javax.swing.JPopupMenu menu

menuRow

int menuRow

menuCol

int menuCol

selectedRow

int selectedRow
Constructor Detail

baseTable

public baseTable(tableAttr headerAttrib,
                 tableAttr tableAttrib,
                 tableAttr[] colAttribs,
                 int[] colWidths,
                 java.awt.Color vHeadLineColor,
                 java.awt.Color vRowLineColor,
                 java.awt.Color hHeadLineColor,
                 java.awt.Color hRowLineColor,
                 java.lang.String[] headers,
                 boolean horizLines,
                 boolean vertLines,
                 boolean vertFill,
                 boolean hVertFill,
                 javax.swing.JPopupMenu menu,
                 javax.swing.JPopupMenu headerMenu)
This is the base constructor for baseTable, which allows all aspects of the baseTable's appearance and behavior to be customized.
Parameters:
headerAttrib - attribute set for the column headers
tableAttrib - default attribute set for the body of the table
colAttribs - per column attribute sets
colWidths - array of initial column widths
vHeadLineColor - color of vertical lines in the column headers, if any
vRowLineColor - color of vertical lines in the table body, if any
hHeadLineColor - color of horizontal lines in the column headers, if any
vRowLineColor - color of vertical lines in the table body, if any
headers - array of column header titles, must be same size as colWidths
horizLines - true if horizontal lines should be shown between rows in report table
vertLines - true if vertical lines should be shown between columns in report table
vertFill - true if table should expand vertically to fill size of baseTable
hVertFill - true if horizontal lines should be drawn in the vertical fill region (only applies if vertFill and horizLines are true)

baseTable

public baseTable(int[] colWidths,
                 java.lang.String[] headers,
                 javax.swing.JPopupMenu menu,
                 javax.swing.JPopupMenu headerMenu)
Constructor with default fonts, justification, and behavior
Parameters:
colWidths - array of initial column widths
headers - array of column header titles, must be same size as colWidths
Method Detail

getCell

public final tableCell getCell(int x,
                               int y)
Access a cell from the table
Parameters:
x - column number in range [0..# of columns-1]
y - row number in range [0..# of rows-1]

setCellText

public final void setCellText(tableCell cell,
                              java.lang.String cellText,
                              boolean repaint)
Sets the contents of a cell in the table.
Parameters:
cell - the cell to change
cellText - the text to place into cell
repaint - true if the table should be redrawn after changing cell

getCellText

public final java.lang.String getCellText(tableCell cell)
Gets the contents of a cell in the table.
Parameters:
cell - the cell to read text from

getWrappedCellText

public final java.lang.String getWrappedCellText(tableCell cell)
Gets the contents of a cell in the table.
Parameters:
cell - the cell to read text from

getCellText

public java.lang.String getCellText(int x,
                                    int y)
Gets the contents of a cell in the table.
Parameters:
x - column number in range [0..# of columns-1]
y - row number in range [0..# of rows-1]

getWrappedCellText

public java.lang.String getWrappedCellText(int x,
                                           int y)
Gets the contents of a cell in the table.
Parameters:
x - column number in range [0..# of columns-1]
y - row number in range [0..# of rows-1]

setCellAttr

public final void setCellAttr(tableCell cell,
                              tableAttr attr,
                              boolean repaint)
Sets the tableAttr of a cell in the table.
Parameters:
cell - the tableCell to assign to
attr - the tableAttr to assign to cell
repaint - true if the table should be redrawn after changing cell

getCellAttr

public final tableAttr getCellAttr(tableCell cell)
Gets the tableAttr of a cell in the table.
Parameters:
cell - the cell to retrieve a tableAttr from

setCellFont

public final void setCellFont(tableCell cell,
                              java.awt.Font font,
                              boolean repaint)
Sets the font of a cell in the table. A font of (Font) null will cause baseTable to revert to using the table or column's default font for this cell.
Parameters:
cell - the cell to change
font - the Font to assign to cell, may be null to use default
repaint - true if the table should be redrawn after changing cell

setCellJust

public final void setCellJust(tableCell cell,
                              int just,
                              boolean repaint)
Sets the justification of a cell in the table. Use tableAttr.JUST_INHERIT to have this cell use default justification
Parameters:
cell - the cell to change
just - the justification to assign to cell
repaint - true if the table should be redrawn after changing cell
See Also:
tableAttr

setCellColor

public final void setCellColor(tableCell cell,
                               java.awt.Color color,
                               boolean repaint)
Sets the foreground color of a cell A color of (Color) null will cause baseTable to revert to using the foreground selected for the column (if defined) or the foreground for the table.
Parameters:
cell - the cell to change
color - the Color to assign to cell
repaint - true if the table should be redrawn after changing cell

setCellBackColor

public final void setCellBackColor(tableCell cell,
                                   java.awt.Color color,
                                   boolean repaint)
Sets the background color of a cell A color of (Color) null will cause baseTable to revert to using the background selected for the column (if defined) or the background for the table.
Parameters:
cell - the cell to change
color - the Color to assign to cell
repaint - true if the table should be redrawn after changing cell

setColAttr

public final void setColAttr(int x,
                             tableAttr attr,
                             boolean repaint)
Sets the tableAttr for a column A attr of (tableAttr) null will cause baseTable to revert to using the table defaults for this column.
Parameters:
x - the column of the table to change color, in the range [0..# of columns-1]
color - the Color to assign to column x
repaint - true if the table should be redrawn after changing column x

setColFont

public final void setColFont(int x,
                             java.awt.Font font,
                             boolean repaint)
Sets the font of a column A font of (Font) null will cause baseTable to revert to using the table's default font for this column.
Parameters:
x - the column of the table to change color, in the range [0..# of columns-1]
font - the Font to assign to column x
repaint - true if the table should be redrawn after changing column x

setColJust

public final void setColJust(int x,
                             int just,
                             boolean repaint)
Sets the justification of a column in the table. Use tableAttr.JUST_INHERIT to have this column use default justification
Parameters:
x - the column to change, in the range [0..# of columns - 1]
just - the justification to assign to column x
repaint - true if the table should be redrawn after changing column x
See Also:
tableAttr

setColColor

public final void setColColor(int x,
                              java.awt.Color color,
                              boolean repaint)
Sets the foreground color of a column A color of (Color) null will cause baseTable to revert to using the foreground selected for the table.
Parameters:
x - the column of the table to change color, in the range [0..# of columns-1]
color - the Color to assign to column x
repaint - true if the table should be redrawn after changing column x

setColBackColor

public final void setColBackColor(int x,
                                  java.awt.Color color,
                                  boolean repaint)
Sets the background color of a column A color of (Color) null will cause baseTable to revert to using the background selected for the table.
Parameters:
x - the column of the table to change color, in the range [0..# of columns-1]
color - the Color to assign to column x
repaint - true if the table should be redrawn after changing column x

setRowsVisible

public void setRowsVisible(int x)
This method sets the number of rows that the table will display. If x == -1, as many rows as possible will be displayed.

setTableAttr

public final void setTableAttr(tableAttr attr,
                               boolean repaint)
Sets the tableAttr for the table
Parameters:
attr - the tableAttr to assign to table, must be non-null,
repaint - true if the table should be redrawn after changing attr

setTableFont

public final void setTableFont(java.awt.Font font,
                               boolean repaint)
Sets the default font for the table
Parameters:
font - the Font to assign to table, must be non-null
repaint - true if the table should be redrawn after changing font

setTableJust

public final void setTableJust(int just,
                               boolean repaint)
Sets the default justification of cells in the table. tableAttr.JUST_INHERIT is not a valid value for just
Parameters:
just - the justification to make default for cells in table
repaint - true if the table should be redrawn after changing justification
See Also:
tableAttr

setTableColor

public final void setTableColor(java.awt.Color color,
                                boolean repaint)
Sets the foreground color of the table
Parameters:
color - the Color to assign to table foreground, must be non-null
repaint - true if the table should be redrawn after changing color

setTableBackColor

public final void setTableBackColor(java.awt.Color color,
                                    boolean repaint)
Sets the background color of the table
Parameters:
color - the Color to assign to table background, must be non-null
repaint - true if the table should be redrawn after changing color

setHeadAttr

public final void setHeadAttr(tableAttr attr,
                              boolean repaint)
Sets the tableAttr of headers in the table.
Parameters:
attr - the tableAttr to assign to the headers - must be non-null
repaint - true if the table should be redrawn after changing headers

setHeadColor

public final void setHeadColor(java.awt.Color color,
                               boolean repaint)
Sets the foreground color of headers in the table.
Parameters:
color - the Color to assign to the headers - must be non-null
repaint - true if the table should be redrawn after changing headers

setHeadBackColor

public final void setHeadBackColor(java.awt.Color color,
                                   boolean repaint)
Sets the background color of headers in the table.
Parameters:
color - the Color to assign to the headers - must be non-null
repaint - true if the table should be redrawn after changing headers

setHeadFont

public final void setHeadFont(java.awt.Font font,
                              boolean repaint)
Sets the font for headers in the table.
Parameters:
font - the Font to assign to the headers - must be non-null
repaint - true if the table should be redrawn after changing headers

deleteColumn

public void deleteColumn(int index,
                         boolean reportion)
This method takes the given column out of the table entirely.

clickInCell

public void clickInCell(int x,
                        int y)
Old Hook for subclasses to implement selection logic
Parameters:
x - col of cell clicked in
y - row of cell clicked in

clickInCell

public void clickInCell(int x,
                        int y,
                        boolean rightClick)
Hook for subclasses to implement selection logic
Parameters:
x - col of cell clicked in
y - row of cell clicked in
rightClick - if true, the cell click was with the right button

doubleClickInCell

public void doubleClickInCell(int x,
                              int y)
Hook for subclasses to implement selection logic
Parameters:
x - col of cell double clicked in
y - row of cell double clicked in

selectRow

public final void selectRow(int y)
Mark a row as selected
Parameters:
y - row to select

unSelectRow

public final void unSelectRow(int y)
Mark a row as unselected
Parameters:
y - row to unselect

selectCol

public final void selectCol(int x)
Mark a column as selected
Parameters:
x - col to select

unSelectCol

public final void unSelectCol(int x)
Mark a column as unselected
Parameters:
x - col to unselect

unSelectAll

public void unSelectAll()
Unselect all cells

selectCell

public final void selectCell(int x,
                             int y)
Mark a cell as selected
Parameters:
x - col of cell to select
y - row of cell to select

unSelectCell

public final void unSelectCell(int x,
                               int y)
Mark a cell as unselected
Parameters:
x - col of cell to unselect
y - row of cell to unselect

testRowSelected

public final boolean testRowSelected(int y)
Returns true if row y is currently selected
Parameters:
y - row to test

testColSelected

public final boolean testColSelected(int x)
Returns true if col x is currently selected
Parameters:
x - col to test

testCellSelected

public final boolean testCellSelected(int x,
                                      int y)
Returns true if cell (x,y) is currently selected
Parameters:
x - col of cell to test
y - row of cell to test

setRows

public void setRows(int numRows,
                    boolean repaint)
Changes the number of rows in the table
Parameters:
numRows - how many rows should be in the table
repaint - true if the table should be redrawn after changing size

addRow

public void addRow(boolean repaint)
Adds a new row to the bottom of the table
Parameters:
repaint - true if the table should be redrawn after changing size

optimizeCols

public void optimizeCols()
This method will go through all of the columns and optimize the pole placement to minimize wasted space and provide a decent balance of row and column sizes. Somehow.

displayRegionFirstLine

final int displayRegionFirstLine()
This method returns the first line of the display area, below the headers.

reCalcRowPos

void reCalcRowPos(int startRow)
This method is used to recalculate the vertical position of all of the rows in the table below startRow. If startRow is 0, all rows will be readjusted. This method is provided to support variable-height rows.

deleteRow

public void deleteRow(int num,
                      boolean repaint)
Deletes a row from the table
Parameters:
num - The index of the row to be deleted
repaint - true if the table should be redrawn after the row is deleted

refreshTable

public void refreshTable()
Causes the table to be updated and redisplayed.

clearCells

public void clearCells()
Erases all the cells in the table and removes any per-cell attribute sets.

reinitialize

public void reinitialize(int[] colWidths,
                         java.lang.String[] headers)
Reinitializes the table with a new set of columns / headers

reinitialize

public void reinitialize(tableAttr[] colAttribs,
                         int[] colWidths,
                         java.lang.String[] headers)
Reinitializes the table with a new set of columns / headers

getTableHeaders

public java.util.Vector getTableHeaders()
This method returns a Vector of Strings containing the titles of columns currently in the table.

getRowCount

public int getRowCount()
This method returns the number of rows in the table.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Override this method to implement the popup menu hook.
Specified by:
actionPerformed in interface java.awt.event.ActionListener

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Handles scrollbar events.
Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
This method is called when our size is changed. We need to know this so we can update the scrollbars and what-not.
Overrides:
setBounds in class java.awt.Component

reShape

void reShape()
Internal method This method recalculates the general parameters of our table's display. That is, it calculates whether or not we need scroll bars, adds or deletes the scroll bars, and scales the column positions to match the general rendering parameters.

adjustScrollbars

void adjustScrollbars()
Internal method Check to see whether we need scrollbars in our current component size, set the min/max/visible parameters This method is intended to be called from reShape().

calcVSize

int calcVSize()
Internal method calculate the total vertical size of the rows only

calcCols

void calcCols()
Internal method Calculate our columns. This method is called both by reShape() and by our canvas, in response to the user adjusting the columns by hand.

calcFonts

void calcFonts()
Internal method Calculate our fonts and measurements. If they have changed, go ahead and reshape ourselves.

scrollRowTo

void scrollRowTo(int rowIndex,
                 int y)
This method is used to adjust the vertical scrollbar (if present) such that row has its topEdge at y