arlut.csd.JTable
Class rowTable

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

public class rowTable
extends baseTable
implements java.awt.event.ActionListener

rowTable is a specialized baseTable, supporting a per-row access model based on a hashtable.

See Also:
baseTable, 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)  rowSelectCallback callback
           
(package private)  java.util.Vector crossref
           
(package private)  javax.swing.JMenuItem DeleteColMI
           
(package private)  java.util.Hashtable index
           
(package private)  javax.swing.JMenuItem OptimizeMI
           
(package private)  javax.swing.JMenuItem RevSortByMI
           
(package private)  javax.swing.JPopupMenu rowMenu
           
(package private)  java.lang.Object rowSelectedKey
           
(package private)  javax.swing.JMenuItem SortByMI
           
(package private)  boolean sortForward
           
 
Fields inherited from class arlut.csd.JTable.baseTable
bounding_rect, canvas, colPos, cols, debug, hbar, hbar_visible, headerAttrib, headerMenu, hHeadLineColor, hHeadLineThickness, horizLines, hRowLineColor, hRowLineThickness, hVertFill, in, menu, menuCol, menuRow, origTotalWidth, row_baseline, row_height, rows, rowsToShow, scalefact, selectedRow, tableAttrib, vbar, vbar_visible, vertFill, vertLines, vHeadLineColor, vLineThickness, 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
rowTable(int[] colWidths, java.lang.String[] headers, rowSelectCallback callback, boolean horizLines, javax.swing.JPopupMenu menu, boolean allowDeleteColumn)
          Constructor with default fonts, justification, and behavior
rowTable(int[] colWidths, java.lang.String[] headers, rowSelectCallback callback, javax.swing.JPopupMenu menu, boolean allowDeleteColumn)
          Constructor with default fonts, justification, and behavior
rowTable(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, rowSelectCallback callback, javax.swing.JPopupMenu menu, boolean allowDeleteColumn)
          This is the base constructor for rowTable, which allows all aspects of the rowTable's appearance and behavior to be customized.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Method used to handle the popup menu
 void clearCells()
          Erases all the cells in the table and removes any per-cell attribute sets.
 void clickInCell(int x, int y, boolean rightButton)
          Hook for subclasses to implement selection logic
 boolean containsKey(java.lang.Object key)
          Returns true if a key is already in use in the table
 void deleteRow(java.lang.Object key, boolean repaint)
          Deletes a row.
 void doubleClickInCell(int x, int y)
          Hook for subclasses to implement selection logic
 tableCell getCell(java.lang.Object key, int col)
          Gets a cell based on hashkey
 tableAttr getCellAttr(java.lang.Object key, int col)
          Gets the tableAttr of a cell in the table.
 java.lang.String getCellText(java.lang.Object key, int col)
          Gets the contents of a cell in the table.
 java.lang.Object getSelectedRow()
           
 java.util.Enumeration keys()
          Return an enumeration of the keys in the table
 void newRow(java.lang.Object key)
          Creates a new row, adds it to the hashtable
 void resort(int column, boolean repaint)
          Sort by column , according to the direction of the last sort.
 void resort(int column, boolean forward, boolean repaint)
           
 void selectRow(java.lang.Object key, boolean refreshTable)
          This method unselects any rows currently selected that do not match key and selects the row that does match key (if any).
 void setCellAttr(java.lang.Object key, int col, tableAttr attr, boolean repaint)
          Sets the tableAttr of a cell in the table.
 void setCellBackColor(java.lang.Object key, int col, 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(java.lang.Object key, int col, 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(java.lang.Object key, int col, java.awt.Font font, boolean repaint)
          Sets the font of a cell in the table.
 void setCellJust(java.lang.Object key, int col, int just, boolean repaint)
          Sets the justification of a cell in the table.
 void setCellText(java.lang.Object key, int col, java.lang.String cellText, boolean repaint)
          Sets the contents of a cell in the table.
 void setCellText(java.lang.Object key, int col, java.lang.String cellText, java.lang.Object data, boolean repaint)
          Sets the contents of a cell in the table.
 void unSelectAll()
          Unselect all cells..
 void unSelectRow()
          This method unselects the currently selected row.
 
Methods inherited from class arlut.csd.JTable.baseTable
addRow, adjustmentValueChanged, adjustScrollbars, calcCols, calcFonts, calcVSize, clickInCell, deleteColumn, deleteRow, displayRegionFirstLine, getCell, getCellAttr, getCellText, getCellText, getRowCount, getTableHeaders, getWrappedCellText, getWrappedCellText, optimizeCols, reCalcRowPos, refreshTable, reinitialize, reinitialize, reShape, scrollRowTo, selectCell, selectCol, selectRow, setBounds, setCellAttr, setCellBackColor, setCellColor, setCellFont, setCellJust, setCellText, setColAttr, setColBackColor, setColColor, setColFont, setColJust, setHeadAttr, setHeadBackColor, setHeadColor, setHeadFont, setRows, setRowsVisible, setTableAttr, setTableBackColor, setTableColor, setTableFont, setTableJust, testCellSelected, testColSelected, testRowSelected, unSelectCell, unSelectCol, unSelectRow
 
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

index

java.util.Hashtable index

crossref

java.util.Vector crossref

callback

rowSelectCallback callback

rowMenu

javax.swing.JPopupMenu rowMenu

SortByMI

javax.swing.JMenuItem SortByMI

RevSortByMI

javax.swing.JMenuItem RevSortByMI

DeleteColMI

javax.swing.JMenuItem DeleteColMI

OptimizeMI

javax.swing.JMenuItem OptimizeMI

sortForward

boolean sortForward

rowSelectedKey

java.lang.Object rowSelectedKey
Constructor Detail

rowTable

public rowTable(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,
                rowSelectCallback callback,
                javax.swing.JPopupMenu menu,
                boolean allowDeleteColumn)
This is the base constructor for rowTable, which allows all aspects of the rowTable'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)
callback - reference to an object that implements the rowSelectCallback interface
menu - reference to a popup menu to be associated with rows in this table

rowTable

public rowTable(int[] colWidths,
                java.lang.String[] headers,
                rowSelectCallback callback,
                boolean horizLines,
                javax.swing.JPopupMenu menu,
                boolean allowDeleteColumn)
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
callback - reference to an object that implements the rowSelectCallback interface
horizLines - draw horizontal lines between rows?
menu - reference to a popup menu to be associated with rows in this table

rowTable

public rowTable(int[] colWidths,
                java.lang.String[] headers,
                rowSelectCallback callback,
                javax.swing.JPopupMenu menu,
                boolean allowDeleteColumn)
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
callback - reference to an object that implements the rowSelectCallback interface
menu - reference to a popup menu to be associated with rows in this table
Method Detail

clickInCell

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

doubleClickInCell

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

unSelectAll

public void unSelectAll()
Unselect all cells.. override of a baseTable method.
Overrides:
unSelectAll in class baseTable

getSelectedRow

public java.lang.Object getSelectedRow()

selectRow

public void selectRow(java.lang.Object key,
                      boolean refreshTable)
This method unselects any rows currently selected that do not match key and selects the row that does match key (if any).
Parameters:
key - The key to the row to be selected

unSelectRow

public void unSelectRow()
This method unselects the currently selected row.

clearCells

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

newRow

public void newRow(java.lang.Object key)
Creates a new row, adds it to the hashtable
Parameters:
key - A hashtable key to be used to refer to this row in the future

deleteRow

public void deleteRow(java.lang.Object key,
                      boolean repaint)
Deletes a row.
Parameters:
key - A hashtable key for the row to delete
repaint - true if the table should be redrawn after the row is deleted

getCell

public tableCell getCell(java.lang.Object key,
                         int col)
Gets a cell based on hashkey
Parameters:
key - A hashtable key for the row of the cell
col - Column number, range 0..# of columns - 1

setCellText

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

setCellText

public final void setCellText(java.lang.Object key,
                              int col,
                              java.lang.String cellText,
                              java.lang.Object data,
                              boolean repaint)
Sets the contents of a cell in the table.
Parameters:
key - key to the row of the cell to be changed
col - column of the cell to be changed
cellText - the text to place into cell
data - A piece of data to be held with this cell, will be used for sorting
repaint - true if the table should be redrawn after changing cell

getCellText

public final java.lang.String getCellText(java.lang.Object key,
                                          int col)
Gets the contents of a cell in the table.
Parameters:
key - key to the row of the cell
col - column of the cell

setCellAttr

public final void setCellAttr(java.lang.Object key,
                              int col,
                              tableAttr attr,
                              boolean repaint)
Sets the tableAttr of a cell in the table.
Parameters:
key - key to the row of the cell to be changed
col - column of the cell to be changed
attr - the tableAttr to assign to cell
repaint - true if the table should be redrawn after changing cell

getCellAttr

public final tableAttr getCellAttr(java.lang.Object key,
                                   int col)
Gets the tableAttr of a cell in the table.
Parameters:
key - key to the row of the cell
col - column of the cell

setCellFont

public final void setCellFont(java.lang.Object key,
                              int col,
                              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:
key - key to the row of the cell
col - column of the cell
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(java.lang.Object key,
                              int col,
                              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:
key - key to the row of the cell
col - column of the cell
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(java.lang.Object key,
                               int col,
                               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:
key - key to the row of the cell
col - column of the cell
color - the Color to assign to cell
repaint - true if the table should be redrawn after changing cell

setCellBackColor

public final void setCellBackColor(java.lang.Object key,
                                   int col,
                                   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:
key - key to the row of the cell
col - column of the cell
color - the Color to assign to cell
repaint - true if the table should be redrawn after changing cell

containsKey

public boolean containsKey(java.lang.Object key)
Returns true if a key is already in use in the table
Parameters:
key - key to look for in the table

keys

public java.util.Enumeration keys()
Return an enumeration of the keys in the table

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Method used to handle the popup menu
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class baseTable

resort

public void resort(int column,
                   boolean repaint)
Sort by column , according to the direction of the last sort.

resort

public void resort(int column,
                   boolean forward,
                   boolean repaint)