wt.clients.widgets
Class JCSMTable

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bywt.clients.widgets.JCSMTable
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
FuncEquivSearchTable, QueryFormTable

public class JCSMTable
extends JPanel

A Panel that has a table with scroll bars

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  Color bgColor
           
protected  boolean columnSelection
           
private static int DEFAULT_ROW_HEIGHT
           
protected  boolean editable
           
protected  Color gridColor
           
protected  TableCellRenderer headerRenderer
           
(package private)  MouseListener listener
           
static int MULTI_INTERVAL_SELECTION
           
protected  boolean rowSelection
           
protected  JScrollPane scrollPane
           
static int SINGLE_INTERVAL_SELECTION
           
static int SINGLE_SELECTION
           
protected  JTable table
           
protected  JCSMTableModel tableModel
           
 
Fields inherited from class javax.swing.JPanel
 
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.Container
 
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
JCSMTable()
          Construct a JCSMTable
JCSMTable(int rows, int cols)
          Construct a JCSMTable
JCSMTable(JCSMTableModel model)
           
JCSMTable(Object[][] data, Object[] columnNames)
          Construct a JCSMTable
JCSMTable(Object[] columnNames, int numRows)
          Construct a JCSMTable
JCSMTable(TableCellRenderer headerRenderer)
           
JCSMTable(Vector columnNames, int rows)
          Construct a JCSMTable
JCSMTable(Vector data, Vector columnNames)
          Construct a JCSMTable
 
Method Summary
 void addColumn(Object columnName, Vector column)
          Add a column
 void addMouseListener(MouseListener listener)
           
 void addRow(Vector row)
          Add a row to the table
 void clearTable()
          Clears the table (Removes all the entries)
protected  JCSMTableModel createModel()
           
protected  JCSMTableModel createModel(int row, int col)
           
protected  JCSMTableModel createModel(Object[][] data, Object[] columnNames)
           
protected  JCSMTableModel createModel(Object[] columnNames, int numRows)
           
protected  JCSMTableModel createModel(Vector columnNames, int rows)
           
protected  JCSMTableModel createModel(Vector data, Vector columnNames)
           
 Object getCellComponent(int row, int col)
          Get the cell component
 int getColumnCount()
          Return the column count
 boolean getColumnSelection()
          Return true if column selection is allowed
 int[] getColWidths()
          Get the column widths
protected  int getHeaderRowHeight()
          return the header row height
 int getRowCount()
          Return the row count
 int[] getRowHeights()
          Get the row heights
 boolean getRowSelection()
          Return true if row selection is allowed
 int getSelectedColumn()
          Get the selected column
 int[] getSelectedColumns()
          Get the selected columns Get an array of indices of the selected columns
 int getSelectedRow()
          Get the selectedRow
 int[] getSelectedRows()
          Get the selected Rows
 void insertColumn(Object columnName, Vector column, int index)
          Insert a column
 void insertRow(Vector row, int i)
          Insert a row
 boolean isDirty()
           
 boolean isEditable()
          Return true if in edit mode else true
 void removeMouseListener(MouseListener listener)
           
 void removeRow(int row)
          Remove a row from the table
 void setAutoResizeMode(int mode)
          Set the auto resize mode
 void setColumnNames(Object[] columnNames)
          Set the columnNames
 void setColumnNames(Vector columnNames)
          Set the columnNames
 void setColumnSelectionAllowed(boolean bl)
          Set the column selection
 void setColumnWidth(int width)
          Set the column width
 void setColumnWidth(int columnNo, int width)
          Set the column width for a specified column
 void setColumnWidth(TableColumn column, int width)
           
protected  void setComponents()
          Set the components
 void setDirty(boolean dirty)
           
 void setEditable(boolean state)
          Set to edit mode if true else view mode
 void setHeaderBackground(Color color)
          Set the header background color
 void setHeaderFont(Font font)
          Set the headerFont
 void setHeaderForeground(Color color)
          Set the header foreground color
 void setHeaderRenderer(TableCellRenderer headerRenderer)
           
protected  void setRenderersAndEditors()
          Set the renderers and the editors Override this for setting new Renderers and editors
 void setRowHeight(int height)
          Set the row height
 void setRowSelectionAllowed(boolean bl)
          Set Row selection
 void setSelectionMode(int sel)
          Set the selection mode
protected  void setTable()
          Set the table
 void setTableBackground(Color color)
          Set the table background
 void setTableData(Object[][] data)
          Set the data for the table
 void setTableData(Vector data)
          Set the data for the table
 void setTableIntercellSpacing(Dimension d)
          Set the table cell spacing
 void setTableSize(Dimension dimension)
          Set the table size
 void stopCellEditing()
          Stop the edit mode
 void validateTable()
          Validate the table
 
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, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, 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, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, 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, 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
 

Field Detail

SINGLE_SELECTION

public static final int SINGLE_SELECTION
See Also:
Constant Field Values

SINGLE_INTERVAL_SELECTION

public static final int SINGLE_INTERVAL_SELECTION
See Also:
Constant Field Values

MULTI_INTERVAL_SELECTION

public static final int MULTI_INTERVAL_SELECTION
See Also:
Constant Field Values

DEFAULT_ROW_HEIGHT

private static final int DEFAULT_ROW_HEIGHT
See Also:
Constant Field Values

rowSelection

protected boolean rowSelection

columnSelection

protected boolean columnSelection

tableModel

protected JCSMTableModel tableModel

table

protected JTable table

scrollPane

protected JScrollPane scrollPane

bgColor

protected Color bgColor

gridColor

protected Color gridColor

editable

protected boolean editable

headerRenderer

protected TableCellRenderer headerRenderer

listener

MouseListener listener
Constructor Detail

JCSMTable

public JCSMTable()
Construct a JCSMTable


JCSMTable

public JCSMTable(int rows,
                 int cols)
Construct a JCSMTable

Parameters:
rows - - no of rows
cols - - no of columns

JCSMTable

public JCSMTable(TableCellRenderer headerRenderer)

JCSMTable

public JCSMTable(Object[][] data,
                 Object[] columnNames)
Construct a JCSMTable

Parameters:
data - - a two dim array of objects
columnNames - - an array of columnNames

JCSMTable

public JCSMTable(Object[] columnNames,
                 int numRows)
Construct a JCSMTable

Parameters:
columnNames - - an array of columnNames

JCSMTable

public JCSMTable(Vector columnNames,
                 int rows)
Construct a JCSMTable

Parameters:
columnNames - - Vector of columnNames
rows - - no of rows

JCSMTable

public JCSMTable(Vector data,
                 Vector columnNames)
Construct a JCSMTable

Parameters:
data - - vector of (columns) vector of (rows)data
columnNames - - vector columnNames

JCSMTable

public JCSMTable(JCSMTableModel model)
Method Detail

createModel

protected JCSMTableModel createModel()

createModel

protected JCSMTableModel createModel(int row,
                                     int col)

createModel

protected JCSMTableModel createModel(Object[][] data,
                                     Object[] columnNames)

createModel

protected JCSMTableModel createModel(Object[] columnNames,
                                     int numRows)

createModel

protected JCSMTableModel createModel(Vector columnNames,
                                     int rows)

createModel

protected JCSMTableModel createModel(Vector data,
                                     Vector columnNames)

setColumnNames

public void setColumnNames(Vector columnNames)
Set the columnNames

Parameters:
columnNames - - Vector of columnNames

setColumnNames

public void setColumnNames(Object[] columnNames)
Set the columnNames

Parameters:
columnNames - - An array of columnNames

setHeaderRenderer

public void setHeaderRenderer(TableCellRenderer headerRenderer)

setTableData

public void setTableData(Vector data)
Set the data for the table


setTableData

public void setTableData(Object[][] data)
Set the data for the table


clearTable

public void clearTable()
Clears the table (Removes all the entries)


validateTable

public void validateTable()
Validate the table


getRowCount

public int getRowCount()
Return the row count

Returns:
the no of rows

getColumnCount

public int getColumnCount()
Return the column count

Returns:
the no of columns

getSelectedRow

public int getSelectedRow()
Get the selectedRow

Returns:
the index of the selected row

getSelectedRows

public int[] getSelectedRows()
Get the selected Rows

Returns:
an array of indices of the selected rows

getSelectedColumn

public int getSelectedColumn()
Get the selected column

Returns:
the index of the selected column

getSelectedColumns

public int[] getSelectedColumns()
Get the selected columns Get an array of indices of the selected columns


getCellComponent

public Object getCellComponent(int row,
                               int col)
Get the cell component


setTableBackground

public void setTableBackground(Color color)
Set the table background

Parameters:
color -

setHeaderForeground

public void setHeaderForeground(Color color)
Set the header foreground color


setHeaderBackground

public void setHeaderBackground(Color color)
Set the header background color


setHeaderFont

public void setHeaderFont(Font font)
Set the headerFont


setColumnWidth

public void setColumnWidth(int width)
Set the column width

Parameters:
width -

setColumnWidth

public void setColumnWidth(int columnNo,
                           int width)
Set the column width for a specified column

Parameters:
width -

setColumnWidth

public void setColumnWidth(TableColumn column,
                           int width)

setRowHeight

public void setRowHeight(int height)
Set the row height

Parameters:
height - of the row

setAutoResizeMode

public void setAutoResizeMode(int mode)
Set the auto resize mode

Parameters:
mode - (JTables AutoResize modes)

setSelectionMode

public void setSelectionMode(int sel)
Set the selection mode


setRowSelectionAllowed

public void setRowSelectionAllowed(boolean bl)
Set Row selection


setColumnSelectionAllowed

public void setColumnSelectionAllowed(boolean bl)
Set the column selection


getRowSelection

public boolean getRowSelection()
Return true if row selection is allowed

Returns:
true if row selection is allowed else false

getColumnSelection

public boolean getColumnSelection()
Return true if column selection is allowed

Returns:
true if column selection is allowed else false

removeRow

public void removeRow(int row)
Remove a row from the table

Parameters:
row - index

addRow

public void addRow(Vector row)
Add a row to the table


insertRow

public void insertRow(Vector row,
                      int i)
Insert a row


addColumn

public void addColumn(Object columnName,
                      Vector column)
Add a column

Parameters:
columnName - name of the columm
column - Vector of the column data

insertColumn

public void insertColumn(Object columnName,
                         Vector column,
                         int index)
Insert a column

Parameters:
columnName -
column - vector of column objects

getColWidths

public int[] getColWidths()
Get the column widths

Returns:
an array of the column widths

getRowHeights

public int[] getRowHeights()
Get the row heights

Returns:
an array of row heights

getHeaderRowHeight

protected int getHeaderRowHeight()
return the header row height

Returns:
header row height

setTableIntercellSpacing

public void setTableIntercellSpacing(Dimension d)
Set the table cell spacing


setEditable

public void setEditable(boolean state)
Set to edit mode if true else view mode


isEditable

public boolean isEditable()
Return true if in edit mode else true

Returns:
true if editable else false

setTableSize

public void setTableSize(Dimension dimension)
Set the table size

Parameters:
dimension -

setComponents

protected void setComponents()
Set the components


addMouseListener

public void addMouseListener(MouseListener listener)

removeMouseListener

public void removeMouseListener(MouseListener listener)

setTable

protected void setTable()
Set the table


stopCellEditing

public void stopCellEditing()
Stop the edit mode


setDirty

public void setDirty(boolean dirty)

isDirty

public boolean isDirty()

setRenderersAndEditors

protected void setRenderersAndEditors()
Set the renderers and the editors Override this for setting new Renderers and editors