com.ibm.as400.vaccess

Class SQLResultSetFormPane

  • java.lang.Object
    • java.awt.Component
      • java.awt.Container
        • javax.swing.JComponent
          • com.ibm.as400.vaccess.SQLResultSetFormPane
  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

    Deprecated. 
    Use Java Swing instead, along with the classes in package com.ibm.as400.access

    public class SQLResultSetFormPane
    extends javax.swing.JComponent
    implements java.io.Serializable
    The SQLResultSetFormPane class represents a form that is filled in with the result set generated by a SQL query using JDBC. The form displays one record of the result set at a time and provides buttons that allow the user to scroll forward, backward, to the first or last record, or refresh the view of the result set.

    The data in the form is retrieved from the system (and the GUI fields for the data are created) when load() is called. If load() is not called, the form will be empty.

    It is up to the user to register a JDBC driver when using this class. For example, the following code registers the IBM Toolbox for Java JDBC driver.

       DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    

    Users should call close() to ensure that the result set is closed when this table is no longer needed. close() should also be called on the SQLConnection object as well to close the connection.

    Most errors are reported by firing ErrorEvents, rather than throwing exceptions. Users should listen for ErrorEvents in order to diagnose and recover from error conditions.

    SQLResultSetFormPane objects generate the following events:

    • ActionCompletedEvent
    • ErrorEvent
    • PropertyChangeEvent
    // Register JDBC driver.
    DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    
     // Set up table for result set contents.
    final SQLConnection connection = new SQLConnection("jdbc:as400://MySystem", "Userid", "Password");
    String query = "SELECT * FROM MYLIB.MYTABLE";
    final SQLResultSetFormPane pane = new SQLResultSetFormPane(connection, query);
    
     // Set up window to hold table
    JFrame frame = new JFrame ("My Window");
    WindowListener l = new WindowAdapter()
    {
         // Close the pane when window is closed.
        public void windowClosing(WindowEvent e)
        {
            pane.close();
            connection.close();
        }
    };
    frame.addWindowListener(l);
    
    // Set up the error dialog adapter.
    pane.addErrorListener (new ErrorDialogAdapter (frame));
    
    // Add the component and get data from system.
    frame.getContentPane().add(pane);
    pane.load();
    
     // Display the window
    frame.setVisible(true)
    
    See Also:
    Serialized Form
  • >
    • Nested Class Summary

      • 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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      • 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

      Constructors 
      Constructor and Description
      SQLResultSetFormPane()
      Deprecated. 
      Constructs a SQLResultSetFormPane object.
      SQLResultSetFormPane(SQLConnection connection, java.lang.String query)
      Deprecated. 
      Constructs a SQLResultSetFormPane object.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addActionCompletedListener(ActionCompletedListener listener)
      Deprecated. 
      Adds a listener to be notified when a new record is displayed.
      void addErrorListener(ErrorListener listener)
      Deprecated. 
      Adds a listener to be notified when an error occurs.
      void clearWarnings()
      Deprecated. 
      Clears all SQL warnings.
      void close()
      Deprecated. 
      Closes the SQL result set this form represents.
      void displayFirst()
      Deprecated. 
      Displays the first record of the result set.
      void displayLast()
      Deprecated. 
      Displays the last record of the result set.
      void displayNext()
      Deprecated. 
      Displays the next record of the result set.
      void displayPrevious()
      Deprecated. 
      Displays the previous record of the result set.
      SQLConnection getConnection()
      Deprecated. 
      Returns the SQL connection with which to access data.
      int getCurrentRecord()
      Deprecated. 
      Returns the index of the record currently being displayed.
      java.lang.String getLabelText(int index)
      Deprecated. 
      Returns the text of the label at the given index.
      java.lang.String getQuery()
      Deprecated. 
      Returns the SQL query used to generate the form data.
      java.lang.String getStringValueAt(int index)
      Deprecated. 
      Returns the string value of the current record at the given index.
      java.lang.Object getValueAt(int index)
      Deprecated. 
      Returns the value of the current record at the given index.
      java.sql.SQLWarning getWarnings()
      Deprecated. 
      Returns the warnings generated by the JDBC connection, statement, and result set.
      void load()
      Deprecated. 
      Refreshes the view based on the state of the system.
      void removeActionCompletedListener(ActionCompletedListener listener)
      Deprecated. 
      Removes a listener from being notified when a new record is displayed.
      void removeErrorListener(ErrorListener listener)
      Deprecated. 
      Removes a listener from being notified when an error occurs.
      void setConnection(SQLConnection connection)
      Deprecated. 
      Sets the SQL connection with which to access data.
      void setLabelText(int index, java.lang.String text)
      Deprecated. 
      Sets the text of the label at the given index.
      void setQuery(java.lang.String query)
      Deprecated. 
      Sets the SQL query used to generate the result set.
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
      • 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
    • Constructor Detail

      • SQLResultSetFormPane

        public SQLResultSetFormPane()
        Deprecated. 
        Constructs a SQLResultSetFormPane object.
      • SQLResultSetFormPane

        public SQLResultSetFormPane(SQLConnection connection,
                            java.lang.String query)
        Deprecated. 
        Constructs a SQLResultSetFormPane object.
        Parameters:
        connection - The SQL connection.
        query - The SQL query.
    >
    • Method Detail

      • addActionCompletedListener

        public void addActionCompletedListener(ActionCompletedListener listener)
        Deprecated. 
        Adds a listener to be notified when a new record is displayed. The listener's actionCompleted() method will be called.
        Parameters:
        listener - The listener.
      • addErrorListener

        public void addErrorListener(ErrorListener listener)
        Deprecated. 
        Adds a listener to be notified when an error occurs. The listener's errorOccurred() method will be called.
        Parameters:
        listener - The listener.
      • clearWarnings

        public void clearWarnings()
        Deprecated. 
        Clears all SQL warnings.
      • close

        public void close()
        Deprecated. 
        Closes the SQL result set this form represents.
      • displayFirst

        public void displayFirst()
        Deprecated. 
        Displays the first record of the result set.
      • displayLast

        public void displayLast()
        Deprecated. 
        Displays the last record of the result set.
      • displayNext

        public void displayNext()
        Deprecated. 
        Displays the next record of the result set. If the last record is being displayed, the first record will be displayed.
      • displayPrevious

        public void displayPrevious()
        Deprecated. 
        Displays the previous record of the result set. If the first record is being displayed, the last record will be displayed.
      • getConnection

        public SQLConnection getConnection()
        Deprecated. 
        Returns the SQL connection with which to access data.
        Returns:
        The SQL connection.
      • getCurrentRecord

        public int getCurrentRecord()
        Deprecated. 
        Returns the index of the record currently being displayed. Indices start at 0, and increment one for each of the records in the result set. Note that this is not the same as the record number.
        Returns:
        The index of the record currently being displayed. If there is no record being displayed, -1 is returned.
      • getLabelText

        public java.lang.String getLabelText(int index)
        Deprecated. 
        Returns the text of the label at the given index.
        Parameters:
        index - The index of the label. Indices start at 0.
        Returns:
        The text of the label at the given index.
      • getQuery

        public java.lang.String getQuery()
        Deprecated. 
        Returns the SQL query used to generate the form data.
        Returns:
        The SQL query.
      • getStringValueAt

        public java.lang.String getStringValueAt(int index)
        Deprecated. 
        Returns the string value of the current record at the given index.
        Parameters:
        index - The index of the value. Indices start at 0.
        Returns:
        The value at the given index as a string.
      • getValueAt

        public java.lang.Object getValueAt(int index)
        Deprecated. 
        Returns the value of the current record at the given index.
        Parameters:
        index - The index of the value. Indices start at 0.
        Returns:
        The value at the given index.
      • getWarnings

        public java.sql.SQLWarning getWarnings()
        Deprecated. 
        Returns the warnings generated by the JDBC connection, statement, and result set. The warnings from the result set will be linked to the end of any statement warnings, which in turn are linked to the end of any connection warnings. Warnings are cleared when load() or clearWarnings() is called.
        Returns:
        The warnings generated by the connection, statement, and result set, or null if none.
      • load

        public void load()
        Deprecated. 
        Refreshes the view based on the state of the system. This runs the SQL query. The first record will be displayed. The labels are reconstructed, so any label text customization will be lost. The query and connection properties must be set before this method is called.
      • removeActionCompletedListener

        public void removeActionCompletedListener(ActionCompletedListener listener)
        Deprecated. 
        Removes a listener from being notified when a new record is displayed.
        Parameters:
        listener - The listener.
      • removeErrorListener

        public void removeErrorListener(ErrorListener listener)
        Deprecated. 
        Removes a listener from being notified when an error occurs.
        Parameters:
        listener - The listener.
      • setConnection

        public void setConnection(SQLConnection connection)
                           throws java.beans.PropertyVetoException
        Deprecated. 
        Sets the SQL connection with which to access data. This property is bound and constrained. Note that the data in the form will not change until a load() is done.
        Parameters:
        connection - The SQL connection.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setLabelText

        public void setLabelText(int index,
                        java.lang.String text)
        Deprecated. 
        Sets the text of the label at the given index.
        Parameters:
        index - The index of the label. Indices start at 0.
        text - The text of the label.
      • setQuery

        public void setQuery(java.lang.String query)
                      throws java.beans.PropertyVetoException
        Deprecated. 
        Sets the SQL query used to generate the result set. This property is bound and constrained. Note that the data in the form will not change until a load() is done.
        Parameters:
        query - The SQL query.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.