com.nqadmin.swingSet
Class SSList

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JList
                  extended by com.nqadmin.swingSet.SSList
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable

public class SSList
extends javax.swing.JList

SSList.java

SwingSet - Open Toolkit For Making Swing Controls Database-Aware

 Provides a way to display a list of elements and map them to corresponding
 database codes. The selected values can be stored in a DB array element.
 These mappings can be provided by setOptions method.
 
 e.g.
      SSList list = new SSList();
      String[] options = {"VLarge""large", "medium", "small", "VSmall};
      Double[] mappings = {100.0, 10.0, 5.0, 1.0, 0.1};
      list.setOptions(options, mappings);
      list.bind(myRowset, "my_column", "myDataType");
      
 If three values VLarge, medium, small are selected the array element in the
 database will store {100.0,5.0,1.0}

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JList
javax.swing.JList.AccessibleJList
 
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  java.lang.String columnName
          SSRowSet column to which the component will be bound.
protected  java.lang.Object[] mappings
          Underlying values for each list item choice of 0, 1, 2, 3, etc.
protected  java.lang.String[] options
          Options to be displayed in list box.
protected  SSRowSet sSRowSet
          SSRowSet from which component will get/set values.
 
Fields inherited from class javax.swing.JList
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP
 
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
SSList()
          Creates an object of SSComboBox.
 
Method Summary
protected  void bind()
          Method for handling binding of component to a SSRowSet column.
 void bind(SSRowSet _sSRowSet, java.lang.String _columnName, java.lang.String _baseTypeName)
          Sets the SSRowSet and column name to which the component is to be bound.
 java.lang.String getColumnName()
          Returns the column name to which the component is bound.
 java.lang.Object[] getMappings()
          Returns the underlying values for each of the items in the list box (e.g.
 java.lang.String[] getOptions()
          Returns the items displayed in the list box.
 java.lang.Object[] getSelectedValues()
          Returns the list value associated with the currently selected item.
 SSRowSet getSSRowSet()
          Returns the SSRowSet being used to get the values.
protected  void init()
          Initialization code.
 void setColumnName(java.lang.String _columnName)
          Sets the SSRowSet column name to which the component is bound.
protected  void setMappings(java.lang.Object[] _mappings)
          Sets the underlying values for each of the items in the list box (e.g.
protected  void setOptions(java.lang.String[] _options)
          Adds an array of strings as combo box items.
 boolean setOptions(java.lang.String[] _options, java.lang.Object[] _mappings)
          Sets the options to be displayed in the list box and their corresponding values.
 void setSelectedValues(java.lang.Object[] values)
          Selects appropriate elements in the list box
 void setSSRowSet(SSRowSet _sSRowSet)
          Sets the SSRowSet to which the component is bound.
protected  void updateDisplay()
          Updates the value displayed in the component based on the SSRowSet column binding.
 
Methods inherited from class javax.swing.JList
addListSelectionListener, addSelectionInterval, clearSelection, createSelectionModel, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, doLayout, 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

sSRowSet

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


columnName

protected java.lang.String columnName
SSRowSet column to which the component will be bound.


mappings

protected java.lang.Object[] mappings
Underlying values for each list item choice of 0, 1, 2, 3, etc.


options

protected java.lang.String[] options
Options to be displayed in list box.

Constructor Detail

SSList

public SSList()
Creates an object of SSComboBox.

Method Detail

setColumnName

public void setColumnName(java.lang.String _columnName)
Sets the SSRowSet column name to which the component is bound.

Parameters:
_columnName - Column name to which the component is bound.

getColumnName

public java.lang.String getColumnName()
Returns the column name to which the component is bound.

Returns:
returns the column name to which to component is bound.

setSSRowSet

public void setSSRowSet(SSRowSet _sSRowSet)
Sets the SSRowSet to which the component is bound.

Parameters:
_sSRowSet - SSRowSet to which the component is bound

getSSRowSet

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

Returns:
returns the SSRowSet being used.

setMappings

protected void setMappings(java.lang.Object[] _mappings)
Sets the underlying values for each of the items in the list box (e.g. the values that map to the items displayed in the list box)

Parameters:
_mappings - An array of values that correspond to those in the list box.

getMappings

public java.lang.Object[] getMappings()
Returns the underlying values for each of the items in the list box (e.g. the values that map to the items displayed in the list box)

Returns:
returns the underlying values for each of the items in the list box

setOptions

protected void setOptions(java.lang.String[] _options)
Adds an array of strings as combo box items.

Parameters:
_options - the list of options that you want to appear in the list box.

getOptions

public java.lang.String[] getOptions()
Returns the items displayed in the list box.

Returns:
returns the items displayed in the list box

setOptions

public boolean setOptions(java.lang.String[] _options,
                          java.lang.Object[] _mappings)
Sets the options to be displayed in the list box and their corresponding values.

Parameters:
_options - options to be displayed in the list box.
_mappings - integer values that correspond to the options in the list box.
Returns:
returns true if the options and mappings are set successfully - returns false if the size of arrays do not match or if the values could not be set

setSelectedValues

public void setSelectedValues(java.lang.Object[] values)
Selects appropriate elements in the list box

Parameters:
values - Values to be selected in list

getSelectedValues

public java.lang.Object[] getSelectedValues()
Returns the list value associated with the currently selected item.

Overrides:
getSelectedValues in class javax.swing.JList
Returns:
returns the value associated with the selected item OR -1 if nothing is selected.

init

protected void init()
Initialization code.


bind

public void bind(SSRowSet _sSRowSet,
                 java.lang.String _columnName,
                 java.lang.String _baseTypeName)
Sets the SSRowSet and column name to which the component is to be bound.

Parameters:
_sSRowSet - datasource to be used.
_columnName - Name of the column to which this check box should be bound
_baseTypeName - Underlying DataType Name(specific to database provider) of the array elements in the specified column

bind

protected void bind()
             throws java.sql.SQLException
Method for handling binding of component to a SSRowSet column.

Throws:
java.sql.SQLException

updateDisplay

protected void updateDisplay()
                      throws java.sql.SQLException
Updates the value displayed in the component based on the SSRowSet column binding.

Throws:
java.sql.SQLException