com.nqadmin.swingSet
Class SSDataGrid

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by com.nqadmin.swingSet.SSDataGrid
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable

public class SSDataGrid
extends javax.swing.JTable

SSDataGrid.java

SwingSet - Open Toolkit For Making Swing Controls Database-Aware

 SSDataGrid provides a way to display information from a database in a table
 format (aka "spreadsheet" or "datasheet" view). The SSDataGrid takes a SSRowSet
 as a source of data. It also provides different cell renderers including a
 comboboxes renderer and a date renderer.

 SSDataGrid internally uses the SSTableModel to display the information in a
 table format. SSDataGrid also provides an easy means for displaying headers.
 Columns can be hidden or made uneditable. In addition, it provides much finer
 control over which cells can be edited and which cells can't be edited.  It
 uses the SSCellEditing interface for achieving this. The implementation of
 this interface also provides a way to specify what kind of information is valid
 for each cell.

 SSDataGrid uses the isCellEditable() method in SSCellEditing to determine if a
 cell is editable or not.  The cellUpdateRequested() method of SSCellEditing is
 used to notify a user program when an update is requested. While doing so it
 provides the present value in the cell and also the new value. Based on this
 information the new value can be rejected or accepted by the program.

 SSDataGrid also provides an "extra" row to facilitate the addition of rows to
 the table.  Default values for various columns can be set programmatically.  A
 programmer can also specify which column is the primary key column for the
 underlying SSRowSet and supply a primary key for that column when a new row is
 being added.

 While using the headers always set them before you set the SSRowSet.
 Otherwise the headers will not appear.

 Also if you are using column names rather than column numbers for different function
 you have to call them only after setting the SSRowSet. Because SSDataGrid uses the
 SSRowSet to convert the column names to column numbers. If you specify the column
 numbers you can do before or after setting the SSRowSet, it does not matter.

 You can simply remember this order
  1.Set the headers
  2.Set the SSRowSet
  3.Any other function calls.

 Simple Example:

      //  SET THE HEADER BEFORE SETTING THE SSROWSET
          dataGrid.setHeaders(new String[]{"Part Name", "Color Code", " Weight", "City"});
          dataGrid.setSSRowSet(ssRowSet);
          // HIDE THE PART ID COLUMN
          // THIS SETS THE WIDTH OF THE COLUMN TO 0
          //dataGrid.setHiddenColumns(new String[]{"part_id"});
          dataGrid.setHiddenColumns(new String[]{"part_id"});

          dataGrid.setMessageWindow(this);
          dataGrid.setUneditableColumns(new String[]{"part_id"});

          dataGrid.setComboRenderer("color_code",new String[]{"Red","Green","Blue"},
                  new Integer[]{new Integer(0),new Integer(1),new Integer(2)});
          dataGrid.setDefaultValues(new int[]{1,2,3},new Object[]{new Integer(0),
                  new Integer(20),new String("New Orleans")});

          dataGrid.setPrimaryColumn("part_id");
          dataGrid.setSSDataValue(new SSDataValue(){
              public Object getPrimaryColumnValue(){
                  // YOUR PRIMARY KEY VALUE GENERATION GOES HERE
                  // IF ITS SOME THING USER ENTERS THEN NO PROBLEM
                  // IF ITS AN AUTO INCREMENT FIELD THEN IT DEPENDS ON
                  // THE DATABASE DRIVER YOU ARE USING.
                  // IF THE UPDATEROW CAN RETRIEVE THE VALUES FOR THE ROW
                  // WITH OUT KNOWING THE PRIMARY  KEY VALUE ITS FINE
                  // BUT POSTGRES CAN'T UPDATE ROW WITH OUT THE PRIMARY
                  // COLUMN.

                  // YOUR PRIMARY KEY VALUE GENERATION GOES HERE.
                  ........
                  ........
                  ........
              }
          });

 Also See Examples 5, 6, 7 in the samples.

Version:
$Revision: 1.40 $
Author:
$Author: beevo $
See Also:
Serialized Form

Nested Class Summary
protected  class SSDataGrid.CheckBoxEditor
          Editor for check box fields.
protected  class SSDataGrid.CheckBoxRenderer
          Renderer for check box fields.
protected  class SSDataGrid.ComboEditor
          Editor for combo box fields.
protected  class SSDataGrid.ComboRenderer
          Renderer for combo box fields.
protected  class SSDataGrid.DateEditor
          Editor for date fields.
protected  class SSDataGrid.DateRenderer
          Renderer for date fields.
 
Nested classes/interfaces inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  boolean allowDeletion
           
protected  boolean callExecute
          Variable to indicate if execute() should be called on the SSRowSet.
protected  int columnCount
          Number of columns in the SSRowSet.
protected  int columnWidth
          Minimum width of the columns in the data grid.
protected  SSDataGridHandler dataGridHandler
          DagaGridHandler to help with row deletions, and insertions
protected  java.lang.String[] hiddenColumnNames
          Array used to store the column names that have to hidden.
protected  int[] hiddenColumns
          Array used to store the column numbers that have to be hidden.
protected  boolean insertion
          Variable to indicate if the data grid will display an additional row for inserting new rows.
protected  java.awt.Component messageWindow
          Component where messages should be popped up.
protected  int rowCount
          Number of records retrieved from the SSRowSet.
protected  javax.swing.JScrollPane scrollPane
          Scrollpane used to scroll datagrid.
protected  SSRowSet sSRowSet
          SSRowSet from which component will get/set values.
protected  SSTableModel tableModel
          Table model to construct the JTable
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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
SSDataGrid()
          Constructs an empty data grid.
SSDataGrid(SSRowSet _sSRowSet)
          Constructs a data grid with the data source set to the given SSRowSet.
 
Method Summary
protected  void bind()
          Initializes the data grid control.
 boolean getCallExecute()
          Returns the callExecute property.
 int getColumnWidth()
          Returns the minimum column width for the data grid.
 java.awt.Component getComponent()
          Returns scroll pane with the JTable embedded in it.
 java.lang.Object getDefaultValue(int _columnNumber)
          Returns the default value being used for the specified column.
 java.lang.Object getDefaultValue(java.lang.String _columnName)
          Returns the default value being used for the specified column.
 boolean getInsertion()
          Returns the allowInsertion property of the table.
 java.awt.Component getMessageWindow()
          Returns the component on which error messages will be popped up.
 int getSelectedColumnCount()
          Returns number of selected columns.
 int[] getSelectedColumns()
          Returns the list of selected columns.
 SSRowSet getSSRowSet()
          Returns the SSRowSet being used to get the values.
protected  void hideColumns()
          Hides the columns specified in the hidden columns list.
protected  void init()
          Initialization code.
 boolean isAllowDeletion()
           
 void setAllowDeletion(boolean allowDeletion)
           
 void setCallExecute(boolean _callExecute)
          Sets the callExecute property.
 void setCheckBoxRenderer(int _column)
          Sets a check box renderer for the specified column.
 void setCheckBoxRenderer(java.lang.String _column)
          Sets a check box renderer for the specified column.
 void setColumnWidth(int _columnWidth)
          Sets the minimum column width for the data grid.
 void setComboRenderer(int _column, java.lang.Object[] _displayItems, java.lang.Object[] _underlyingValues)
          Sets a combo box renderer for the specified column.
 void setComboRenderer(int _column, java.lang.Object[] _displayItems, java.lang.Object[] _underlyingValues, int _columnWidth)
          Sets a combo box renderer for the specified column.
 void setComboRenderer(java.lang.String _column, java.lang.Object[] _displayItems, java.lang.Object[] _underlyingValues)
          Sets a combo box renderer for the specified column.
 void setComboRenderer(java.lang.String _column, java.lang.Object[] _displayItems, java.lang.Object[] _underlyingValues, int _columnWidth)
          Sets a combo box renderer for the specified column.
 void setDateRenderer(int _column)
          Sets a date renderer for the specified column.
 void setDateRenderer(java.lang.String _column)
          Sets a date renderer for the specified column.
 void setDefaultValues(int[] _columnNumbers, java.lang.Object[] _values)
          Sets the default values for different columns.
 void setDefaultValues(java.lang.String[] _columnNames, java.lang.Object[] _values)
          Sets the default values for different columns.
 void setHeaders(java.lang.String[] _headers)
          Sets the header for the JTable.
 void setHiddenColumns(int[] _columnNumbers)
          Sets the column numbers that should be hidden.
 void setHiddenColumns(java.lang.String[] _columnNames)
          Sets the column numbers that should be hidden.
 void setInsertion(boolean _insertion)
          Sets the allowInsertion property of the table.
 void setMessageWindow(java.awt.Component _messageWindow)
          Sets the component on which error messages will be popped up.
 void setPrimaryColumn(int _columnNumber)
          Sets the column number which is the primary column for the table.
 void setPrimaryColumn(java.lang.String _columnName)
          Sets the column number which is the primary column for the table.
 void setRowSet(SSRowSet _sSRowSet)
          Deprecated.  
 void setSSCellEditing(SSCellEditing _cellEditing)
          If the user has to decide on which cell has to be editable and which is not then SSCellEditable interface has to be implemented and set it for the SSTableModel.
 void setSSDataGridHandler(SSDataGridHandler _dataGridHandler)
          Set the implementation of DataGridHandler which can be use to handle row deletions and insertions
 void setSSDataValue(SSDataValue _dataValue)
          Sets the SSDataValue interface implemention.
 void setSSRowSet(SSRowSet _sSRowSet)
          Binds the SSRowSet to the grid.
 void setUneditableColumns(int[] _columnNumbers)
          Sets the uneditable columns.
 void setUneditableColumns(java.lang.String[] _columnNames)
          Sets the uneditable columns.
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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

messageWindow

protected java.awt.Component messageWindow
Component where messages should be popped up.


sSRowSet

protected SSRowSet sSRowSet
SSRowSet from which component will get/set values.


columnCount

protected int columnCount
Number of columns in the SSRowSet.


rowCount

protected int rowCount
Number of records retrieved from the SSRowSet.


columnWidth

protected int columnWidth
Minimum width of the columns in the data grid.


tableModel

protected SSTableModel tableModel
Table model to construct the JTable


dataGridHandler

protected SSDataGridHandler dataGridHandler
DagaGridHandler to help with row deletions, and insertions


scrollPane

protected javax.swing.JScrollPane scrollPane
Scrollpane used to scroll datagrid.


hiddenColumns

protected int[] hiddenColumns
Array used to store the column numbers that have to be hidden.


hiddenColumnNames

protected java.lang.String[] hiddenColumnNames
Array used to store the column names that have to hidden.


callExecute

protected boolean callExecute
Variable to indicate if execute() should be called on the SSRowSet.


insertion

protected boolean insertion
Variable to indicate if the data grid will display an additional row for inserting new rows.


allowDeletion

protected boolean allowDeletion
Constructor Detail

SSDataGrid

public SSDataGrid(SSRowSet _sSRowSet)
Constructs a data grid with the data source set to the given SSRowSet.

Parameters:
_sSRowSet - SSRowSet from which values have to be retrieved.

SSDataGrid

public SSDataGrid()
Constructs an empty data grid.

Method Detail

isAllowDeletion

public boolean isAllowDeletion()
Returns:
the allowDeletion

setAllowDeletion

public void setAllowDeletion(boolean allowDeletion)
Parameters:
allowDeletion - the allowDeletion to set

setColumnWidth

public void setColumnWidth(int _columnWidth)
Sets the minimum column width for the data grid.

Parameters:
_columnWidth - minimum column width of the each column

getColumnWidth

public int getColumnWidth()
Returns the minimum column width for the data grid.

Returns:
minimum column width of the each column

setMessageWindow

public void setMessageWindow(java.awt.Component _messageWindow)
Sets the component on which error messages will be popped up. The error dialog will use this component as its parent component.

Parameters:
_messageWindow - the component that should be used when displaying error messages

getMessageWindow

public java.awt.Component getMessageWindow()
Returns the component on which error messages will be popped up. The error dialog will use this component as its parent component.

Returns:
the component that should be used when displaying error messages

setCallExecute

public void setCallExecute(boolean _callExecute)
Sets the callExecute property. If set to true causes the navigator to skip the execute function call on the specified SSRowSet. (See FAQ for further details)

Parameters:
_callExecute - true if execute function call has to be skipped else false

getCallExecute

public boolean getCallExecute()
Returns the callExecute property. If set to true causes the navigator to skip the execute function call on the specified SSRowSet. (See FAQ for further details).

Returns:
true if execute function call has to be skipped else false

setInsertion

public void setInsertion(boolean _insertion)
Sets the allowInsertion property of the table. If set to true an additional row for inserting new rows will be displayed

Parameters:
_insertion - true if new rows can be added else false.

getInsertion

public boolean getInsertion()
Returns the allowInsertion property of the table. If set to true an additional row for inserting new rows will be displayed

Returns:
true if new rows can be added else false.

getSelectedColumns

public int[] getSelectedColumns()
Returns the list of selected columns. This function gets the list of selected columns from parent class and removes any columns which are present in hidden columns. Currently not a bean property since there is no associated variable

Overrides:
getSelectedColumns in class javax.swing.JTable
Returns:
array of selected columns

getSelectedColumnCount

public int getSelectedColumnCount()
Returns number of selected columns. Currently not a bean property since there is no associated variable.

Overrides:
getSelectedColumnCount in class javax.swing.JTable
Returns:
number of selected columns

setSSRowSet

public void setSSRowSet(SSRowSet _sSRowSet)
Binds the SSRowSet to the grid. Data is taken from the new SSRowSet.

Parameters:
_sSRowSet - the SSRowSet which acts as the data source.

getSSRowSet

public SSRowSet getSSRowSet()
Returns the SSRowSet being used to get the values.

Returns:
returns the SSRowSet being used.

getComponent

public java.awt.Component getComponent()
Returns scroll pane with the JTable embedded in it. Currently not a bean property since there is no associated variable.

Returns:
scroll pane with embedded JTable

setDefaultValues

public void setDefaultValues(int[] _columnNumbers,
                             java.lang.Object[] _values)
Sets the default values for different columns. When a new row is added these default values will be added to the columns. Please make sure that the object specified for each column is of the same type as that of the column in the database. Use the getColumnClass function in JTable to determine the exact data type. Currently not a bean property since there is no associated variable.

Parameters:
_columnNumbers - array containing the column numbers for which the defaults apply.
_values - the values for the column numbers specified in _columnNumbers.

setDefaultValues

public void setDefaultValues(java.lang.String[] _columnNames,
                             java.lang.Object[] _values)
                      throws java.sql.SQLException
Sets the default values for different columns. When a new row is added these default values will be added to the columns. Please make sure that the object specified for each column is of the same type as that of the column in the database. Use the getColumnClass function in JTable to determine the exact data type. Currently not a bean property since there is no associated variable.

Parameters:
_columnNames - array containing the column names for which the defaults apply.
_values - the values for the column names specified in _columnNames.
Throws:
java.sql.SQLException - is the specified column name is not present in the SSRowSet

getDefaultValue

public java.lang.Object getDefaultValue(int _columnNumber)
Returns the default value being used for the specified column. Returns null if a default is not in use. Currently not a bean property since there is no associated variable.

Parameters:
_columnNumber - the column number for which default value is to be returned.
Returns:
returns an object containing the default value for the requested column.

getDefaultValue

public java.lang.Object getDefaultValue(java.lang.String _columnName)
                                 throws java.sql.SQLException
Returns the default value being used for the specified column. Returns null if a default is not in use. Currently not a bean property since there is no associated variable.

Parameters:
_columnName - the column name for which default value is to be returned.
Returns:
returns an object containing the default value for the requested column.
Throws:
java.sql.SQLException - is the specified column name is not present in the SSRowSet

setPrimaryColumn

public void setPrimaryColumn(int _columnNumber)
Sets the column number which is the primary column for the table. This is required if new rows have to be added to the JTable. For this to properly work the SSDataValue object should also be provided SSDataValue is used to get the value for the primary column. Currently not a bean property since there is no associated variable.

Parameters:
_columnNumber - the column which is the primary column.

setPrimaryColumn

public void setPrimaryColumn(java.lang.String _columnName)
                      throws java.sql.SQLException
Sets the column number which is the primary column for the table. This is required if new rows have to be added to the JTable. For this to properly work the SSDataValue object should also be provided SSDataValue is used to get the value for the primary column. Currently not a bean property since there is no associated variable.

Parameters:
_columnName - the column which is the primary column.
Throws:
java.sql.SQLException

setSSDataValue

public void setSSDataValue(SSDataValue _dataValue)
Sets the SSDataValue interface implemention. This interface specifies function to retrieve primary column values for a new row to be added. Currently not a bean property since there is no associated variable.

Parameters:
_dataValue - implementation of SSDataValue

setDateRenderer

public void setDateRenderer(int _column)
Sets a date renderer for the specified column. The date will be displayed in mm/dd/yyyy format. If a date renderer is not requested then the date will be displayed in a standard format(yyyy-mm-dd). Currently not a bean property since there is no associated variable.

Parameters:
_column - column number for which a date renderer is needed.

setDateRenderer

public void setDateRenderer(java.lang.String _column)
                     throws java.sql.SQLException
Sets a date renderer for the specified column. The date will be displayed in mm/dd/yyyy format. If a date renderer is not requested then the date will be displayed in a standard format(yyyy-mm-dd). Currently not a bean property since there is no associated variable.

Parameters:
_column - column name for which a date renderer is needed.
Throws:
java.sql.SQLException

setComboRenderer

public void setComboRenderer(int _column,
                             java.lang.Object[] _displayItems,
                             java.lang.Object[] _underlyingValues)
Sets a combo box renderer for the specified column. This is use full to limit the values that go with a column or if an underlying code is do be displayed in a more meaningfull manner. Currently not a bean property since there is no associated variable.

Parameters:
_column - column number for which combo renderer is to be provided.
_displayItems - the actual Objects to be displayed in the combo box.
_underlyingValues - the values that have to be written to the database when an item in the combo box is selected.

setComboRenderer

public void setComboRenderer(int _column,
                             java.lang.Object[] _displayItems,
                             java.lang.Object[] _underlyingValues,
                             int _columnWidth)
Sets a combo box renderer for the specified column. This is use full to limit the values that go with a column or if an underlying code is do be displayed in a more meaningfull manner. Currently not a bean property since there is no associated variable.

Parameters:
_column - column number for which combo renderer is to be provided.
_displayItems - the actual Objects to be displayed in the combo box.
_underlyingValues - the values that have to be written to the database when an item in the combo box is selected.

setComboRenderer

public void setComboRenderer(java.lang.String _column,
                             java.lang.Object[] _displayItems,
                             java.lang.Object[] _underlyingValues)
                      throws java.sql.SQLException
Sets a combo box renderer for the specified column. This is use full to limit the values that go with a column or if an underlying code is do be displayed in a more meaningfull manner. Currently not a bean property since there is no associated variable.

Parameters:
_column - column name for which combo renderer is to be provided.
_displayItems - the actual Objects to be displayed in the combo box.
_underlyingValues - the values that have to be written to the database when an item in the combo box is selected.
Throws:
java.sql.SQLException

setComboRenderer

public void setComboRenderer(java.lang.String _column,
                             java.lang.Object[] _displayItems,
                             java.lang.Object[] _underlyingValues,
                             int _columnWidth)
                      throws java.sql.SQLException
Sets a combo box renderer for the specified column. This is use full to limit the values that go with a column or if an underlying code is do be displayed in a more meaningfull manner. Currently not a bean property since there is no associated variable.

Parameters:
_column - column name for which combo renderer is to be provided.
_displayItems - the actual Objects to be displayed in the combo box.
_underlyingValues - the values that have to be written to the database when an item in the combo box is selected.
_columnWidth - required minimum width for this column
Throws:
java.sql.SQLException

setCheckBoxRenderer

public void setCheckBoxRenderer(java.lang.String _column)
                         throws java.sql.SQLException
Sets a check box renderer for the specified column. Currently not a bean property since there is no associated variable.

Parameters:
_column - - name ofthe column for which check box rendering is needed.
Throws:
java.sql.SQLException

setCheckBoxRenderer

public void setCheckBoxRenderer(int _column)
                         throws java.sql.SQLException
Sets a check box renderer for the specified column. Currently not a bean property since there is no associated variable.

Parameters:
_column - - column number for which check box rendering is needed.
Throws:
java.sql.SQLException

setHeaders

public void setHeaders(java.lang.String[] _headers)
Sets the header for the JTable. This function has to be called before setting the SSRowSet for SSDataGrid. Currently not a bean property since there is no associated variable.

Parameters:
_headers - array of string objects representing the header of each column.

setUneditableColumns

public void setUneditableColumns(int[] _columnNumbers)
Sets the uneditable columns. The columns specified as uneditable will not be available for user to edit. This overrides the isCellEditable function in SSCellEditing. Currently not a bean property since there is no associated variable.

Parameters:
_columnNumbers - array specifying the column numbers which should be uneditable.

setUneditableColumns

public void setUneditableColumns(java.lang.String[] _columnNames)
                          throws java.sql.SQLException
Sets the uneditable columns. The columns specified as uneditable will not be available for user to edit. This overrides the isCellEditable function in SSCellEditing. Currently not a bean property since there is no associated variable.

Parameters:
_columnNames - array specifying the column names which should be uneditable.
Throws:
java.sql.SQLException

setHiddenColumns

public void setHiddenColumns(int[] _columnNumbers)
Sets the column numbers that should be hidden. The SSDataGrid sets the column width of these columns to 0. The columns are set to zero width rather than removing the column from the table. Thus preserving the column numbering.If a column is removed then the column numbers for columns after the removed column will change. Even if the column is specified as hidden user will be seeing a tiny strip. Make sure that you specify the hidden column numbers in the uneditable column list. Currently not a bean property since there is no associated variable.

Parameters:
_columnNumbers - array specifying the column numbers which should be hidden

setHiddenColumns

public void setHiddenColumns(java.lang.String[] _columnNames)
                      throws java.sql.SQLException
Sets the column numbers that should be hidden. The SSDataGrid sets the column width of these columns to 0. The columns are set to zero width rather than removing the column from the table. Thus preserving the column numbering.If a column is removed then the column numbers for columns after the removed column will change. Even if the column is specified as hidden user will be seeing a tiny strip. Make sure that you specify the hidden column numbers in the uneditable column list. Currently not a bean property since there is no associated variable.

Parameters:
_columnNames - array specifying the column names which should be hidden
Throws:
java.sql.SQLException

setSSCellEditing

public void setSSCellEditing(SSCellEditing _cellEditing)
If the user has to decide on which cell has to be editable and which is not then SSCellEditable interface has to be implemented and set it for the SSTableModel. Currently not a bean property since there is no associated variable.

Parameters:
_cellEditing - implementation of SSCellEditable interface.

setSSDataGridHandler

public void setSSDataGridHandler(SSDataGridHandler _dataGridHandler)
Set the implementation of DataGridHandler which can be use to handle row deletions and insertions

Parameters:
_dataGridHandler - implementation of SSDataGridHandler interface.

init

protected void init()
Initialization code.


bind

protected void bind()
Initializes the data grid control. Collects metadata information about the given SSRowSet.


hideColumns

protected void hideColumns()
Hides the columns specified in the hidden columns list.


setRowSet

public void setRowSet(SSRowSet _sSRowSet)
Deprecated. 

Sets the new SSRowSet for the combo box.

Parameters:
_sSRowSet - SSRowSet to which the combo has to update values.
See Also:
setSSRowSet(com.nqadmin.swingSet.datasources.SSRowSet)