com.ibm.as400.vaccess
Class SQLQueryBuilderPane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bycom.ibm.as400.vaccess.SQLQueryBuilderPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

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

public class SQLQueryBuilderPane
extends JComponent
implements Serializable

The SQLQueryBuilderPane class represents a panel which allows a user to dynamically build a SQL query using graphical interfaces. The corresponding SQL is generated.

Data for the GUI is retrieved from the system when load() is called. If load() is not called, the tables in the GUI will be empty.

If table names are provided, then the user is presented choices based on the fields within those tables. If userSelectTables is true, the user may modify the tables on which the query is built. tableSchemas and userSelectTableSchemas are used to determine the list of tables which the user can choose from, however the user is not prevented from using tables not in these schemas.

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 ());

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.

SQLQueryBuilderPane objects generate the following events:

// 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");
final SQLQueryBuilderPane pane = new SQLQueryBuilderPane(connection);

 // 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 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
 
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
SQLQueryBuilderPane()
          Deprecated. Constructs a SQLQueryBuilderPane object.
SQLQueryBuilderPane(SQLConnection connection)
          Deprecated. Constructs a SQLQueryBuilderPane object.
SQLQueryBuilderPane(SQLConnection connection, String[] tables)
          Deprecated. Constructs a SQLQueryBuilderPane object.
 
Method Summary
 void addErrorListener(ErrorListener listener)
          Deprecated. Adds a listener to be notified when an error occurs.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Deprecated. Adds a listener to be notified when the value of any bound property is changed.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Deprecated. Adds a listener to be notified when the value of any constrained property is changed.
 SQLConnection getConnection()
          Deprecated. Returns the SQL connection with which to access data for the GUI.
 String getQuery()
          Deprecated. Returns the SQL query that corresponds to the user's selections.
 String[] getTables()
          Deprecated. Returns the names of the tables used in the query.
 String[] getTableSchemas()
          Deprecated. Returns the schemas for which the tables will be listed for inclusion in the query.
 boolean getUserSelectTables()
          Deprecated. Returns true if the user is able to select and change the tables that are included in the query.
 boolean getUserSelectTableSchemas()
          Deprecated. Returns true if the user is able to select and change the schemas for which tables are shown.
 void load()
          Deprecated. Gets data from the system.
 void removeErrorListener(ErrorListener listener)
          Deprecated. Removes a listener from being notified when an error occurs.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Deprecated. Removes a listener from being notified when the value of any bound property is changed.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Deprecated. Removes a listener from being notified when the value of any constrained property is changed.
 void setConnection(SQLConnection connection)
          Deprecated. Sets the SQL connection with which to access data for the GUI.
 void setTables(String[] tables)
          Deprecated. Sets the table names for the query.
 void setTableSchemas(String[] tableSchemas)
          Deprecated. Sets the schemas for which the tables will be listed for inclusion in the query.
 void setUserSelectTables(boolean flag)
          Deprecated. Sets whether the user will be able to select and change the tables that are included in the query.
 void setUserSelectTableSchemas(boolean flag)
          Deprecated. Sets whether the user will be able to select and change the schemas for which tables are shown.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, 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, updateUI
 
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, addMouseListener, 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, removeMouseListener, 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
 

Constructor Detail

SQLQueryBuilderPane

public SQLQueryBuilderPane()
Deprecated. 
Constructs a SQLQueryBuilderPane object.


SQLQueryBuilderPane

public SQLQueryBuilderPane(SQLConnection connection)
Deprecated. 
Constructs a SQLQueryBuilderPane object.

Parameters:
connection - The SQL connection.

SQLQueryBuilderPane

public SQLQueryBuilderPane(SQLConnection connection,
                           String[] tables)
Deprecated. 
Constructs a SQLQueryBuilderPane object.

Parameters:
connection - The SQL connection.
tables - The names of the tables to be used for the query. Tables should be in the form of schema.table.
Method Detail

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.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Deprecated. 
Adds a listener to be notified when the value of any bound property is changed. The listener's propertyChange() method will be called.

Parameters:
listener - The listener.

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Deprecated. 
Adds a listener to be notified when the value of any constrained property is changed. The listener's vetoableChange() method will be called.

Parameters:
listener - The listener.

getConnection

public SQLConnection getConnection()
Deprecated. 
Returns the SQL connection with which to access data for the GUI.

Returns:
The SQL connection.

getQuery

public String getQuery()
Deprecated. 
Returns the SQL query that corresponds to the user's selections. An empty String is returned if no tables have been selected.

Returns:
The SQL query that corresponds to the user's selections.

getTables

public String[] getTables()
Deprecated. 
Returns the names of the tables used in the query.

Returns:
The table names.

getTableSchemas

public String[] getTableSchemas()
Deprecated. 
Returns the schemas for which the tables will be listed for inclusion in the query.

Returns:
The schema names.

getUserSelectTables

public boolean getUserSelectTables()
Deprecated. 
Returns true if the user is able to select and change the tables that are included in the query. This property controls when the table page is enabled or disabled. The default value is true.

Returns:
true if the user is allowed to change the tables in the query; false otherwise.

getUserSelectTableSchemas

public boolean getUserSelectTableSchemas()
Deprecated. 
Returns true if the user is able to select and change the schemas for which tables are shown. This property controls whether the list of tables on the table page is changeable. The default value is true.

Returns:
true if the user is allowed to change the schemas whose tables are shown; false otherwise.

load

public void load()
Deprecated. 
Gets data from the system. If the connection is null, the server JDBC driver will be used, and the user will be prompted for sign-on information.


removeErrorListener

public void removeErrorListener(ErrorListener listener)
Deprecated. 
Removes a listener from being notified when an error occurs.

Parameters:
listener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Deprecated. 
Removes a listener from being notified when the value of any bound property is changed.

Parameters:
listener - The listener.

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Deprecated. 
Removes a listener from being notified when the value of any constrained property is changed.

Parameters:
listener - The listener.

setConnection

public void setConnection(SQLConnection connection)
                   throws PropertyVetoException
Deprecated. 
Sets the SQL connection with which to access data for the GUI. This property is bound and constrained. Note that the data in the GUI will not change until a load() is done.

Parameters:
connection - The SQL connection.
Throws:
PropertyVetoException - If the change is vetoed.

setTables

public void setTables(String[] tables)
               throws PropertyVetoException
Deprecated. 
Sets the table names for the query. This property is bound and constrained. Note that the data in the GUI will not change until a load() is done.

Parameters:
tables - The names of the tables used in the query. Tables should be in the form of schema.table.
Throws:
PropertyVetoException - If the change is vetoed.

setTableSchemas

public void setTableSchemas(String[] tableSchemas)
                     throws PropertyVetoException
Deprecated. 
Sets the schemas for which the tables will be listed for inclusion in the query. The default is no schemas, so no tables will be listed. This property is bound and constrained.

Parameters:
tableSchemas - The schemas for which tables will be listed.
Throws:
PropertyVetoException - If the change is vetoed.

setUserSelectTables

public void setUserSelectTables(boolean flag)
                         throws PropertyVetoException
Deprecated. 
Sets whether the user will be able to select and change the tables that are included in the query. This property controls when the table page is enabled or disabled. The default value is true. This property is bound and constrained.

Parameters:
flag - true if the user is allowed to change the tables in the query; false otherwise.
Throws:
PropertyVetoException - If the change is vetoed.

setUserSelectTableSchemas

public void setUserSelectTableSchemas(boolean flag)
                               throws PropertyVetoException
Deprecated. 
Sets whether the user will be able to select and change the schemas for which tables are shown. This property controls whether the list of tables on the table page is changeable. The default value is true. This property is bound and constrained.

Parameters:
flag - true if the user is allowed to change the schemas whose tables are shown; false otherwise.
Throws:
PropertyVetoException - If the change is vetoed.