All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.vaccess.RecordListFormPane

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.ibm.as400.vaccess.RecordListFormPane

public class RecordListFormPane
extends JComponent
implements Serializable
The RecordListFormPane class represents a form that is filled in with the fields of a file on the AS/400. The form displays one record 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 file.

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.

Users must call close() to ensure that the AS/400 resources are properly freed when this form is no longer needed.

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.

RecordListFormPane objects generate the following events:

// Set up table for file contents.
AS400 system = new AS400("MySystem", "Userid", "Password");
String file = "/QSYS.LIB/QGPL.LIB/MyFile.FILE";
final RecordListFormPane pane = new RecordListFormPane(system, file);
// Set up window to hold table
JFrame frame = new JFrame ("My Window");
WindowListener l = new WindowAdapter()
{
// Close the model when window is closed.
public void windowClosing(WindowEvent e)
{
pane.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)


Variable Index

 o KEY_EQ
Constant indicating search type of equal.
 o KEY_GE
Constant indicating search type of greater than or equal.
 o KEY_GT
Constant indicating search type of greater than.
 o KEY_LE
Constant indicating search type of less than or equal.
 o KEY_LT
Constant indicating search type of less than.

Constructor Index

 o RecordListFormPane()
Constructs a RecordListFormPane object.
 o RecordListFormPane(AS400, String)
Constructs a RecordListFormPane object.
 o RecordListFormPane(AS400, String, Object[], int)
Constructs a RecordListFormPane object.

Method Index

 o addActionCompletedListener(ActionCompletedListener)
Adds a listener to be notified when a new record is displayed.
 o addErrorListener(ErrorListener)
Adds a listener to be notified when an error occurs.
 o close()
Closes the AS/400 file this form represents.
 o displayFirst()
Displays the first record of the record list.
 o displayLast()
Displays the last record of the record list.
 o displayNext()
Displays the next record of the record list.
 o displayPrevious()
Displays the previous record of the record list.
 o getCurrentRecord()
Returns the index of the record currently being displayed.
 o getFileName()
Returns the file name.
 o getKey()
Returns the key.
 o getKeyed()
Returns whether the file will be accessed in key or sequential order.
 o getLabelText(int)
Returns the text of the label at the given index.
 o getSearchType()
Returns the search type.
 o getStringValueAt(int)
Returns the string value of the current record at the given index.
 o getSystem()
Returns the AS400 where the file is located.
 o getValueAt(int)
Returns the value of the current record at the given index.
 o load()
Refreshes the view based on the state of the system.
 o removeActionCompletedListener(ActionCompletedListener)
Removes a listener from being notified when a new record is displayed.
 o removeErrorListener(ErrorListener)
Removes a listener from being notified when an error occurs.
 o setFileName(String)
Sets the name of the file.
 o setKey(Object[])
Sets the key.
 o setKeyed(boolean)
Sets whether the file will be accessed in key or sequential order.
 o setLabelText(int, String)
Sets the text of the label at the given index.
 o setSearchType(int)
Sets the search type.
 o setSystem(AS400)
Sets the AS400 where the file is located.

Variables

 o KEY_EQ
 public static final int KEY_EQ
Constant indicating search type of equal.

 o KEY_GT
 public static final int KEY_GT
Constant indicating search type of greater than.

 o KEY_GE
 public static final int KEY_GE
Constant indicating search type of greater than or equal.

 o KEY_LT
 public static final int KEY_LT
Constant indicating search type of less than.

 o KEY_LE
 public static final int KEY_LE
Constant indicating search type of less than or equal.

Constructors

 o RecordListFormPane
 public RecordListFormPane()
Constructs a RecordListFormPane object. This constructor sets the keyed property to false.

 o RecordListFormPane
 public RecordListFormPane(AS400 system,
                           String fileName)
Constructs a RecordListFormPane object. This constructor sets the keyed property to false.

Parameters:
system - The AS400 where the file is located.
fileName - The file name. The name is specified as a fully qualified path name in the library file system.
 o RecordListFormPane
 public RecordListFormPane(AS400 system,
                           String fileName,
                           Object key[],
                           int searchType)
Constructs a RecordListFormPane object. This constructor sets the keyed property to true.

Parameters:
system - The AS400 where the file is located.
fileName - The file name. The name is specified as a fully qualified path name in the library file system.
key - The values which make up the key with which to find the record. This value may be null.
searchType - Constant indicating the type of match required.

Methods

 o addActionCompletedListener
 public void addActionCompletedListener(ActionCompletedListener listener)
Adds a listener to be notified when a new record is displayed. The listener's actionCompleted() method will be called.

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

Parameters:
listener - The listener.
 o close
 public void close()
Closes the AS/400 file this form represents.

 o displayFirst
 public void displayFirst()
Displays the first record of the record list.

 o displayLast
 public void displayLast()
Displays the last record of the record list.

 o displayNext
 public void displayNext()
Displays the next record of the record list. If the last record is being displayed, the first record will be displayed.

 o displayPrevious
 public void displayPrevious()
Displays the previous record of the record list. If the first record is being displayed, the last record will be displayed.

 o getCurrentRecord
 public synchronized int getCurrentRecord()
Returns the index of the record currently being displayed. Indices start at 0, and increment one for each of the records in the list. 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.
 o getFileName
 public String getFileName()
Returns the file name. The name is formatted as a fully qualified path name in the library file system.

Returns:
The file name.
 o getKey
 public Object[] getKey()
Returns the key. The key is only used if the keyed property is true.

Returns:
The key.
 o getKeyed
 public boolean getKeyed()
Returns whether the file will be accessed in key or sequential order.

Returns:
true if the file will be accessed in key order; false if the file will be accessed in sequential order.
 o getLabelText
 public synchronized String getLabelText(int index)
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.
 o getSearchType
 public int getSearchType()
Returns the search type. The search type is only used if the keyed property is true and the key property is not null.

Returns:
The search type.
 o getSystem
 public AS400 getSystem()
Returns the AS400 where the file is located.

Returns:
The AS400 where the file is located.
 o getStringValueAt
 public synchronized String getStringValueAt(int index)
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.
 o getValueAt
 public synchronized Object getValueAt(int index)
Returns the value of the current record at the given index.

Parameters:
index - Index of the value. Indices start at 0.
Returns:
The value at the given index.
 o load
 public void load()
Refreshes the view based on the state of the system. The first record will be displayed. The labels are reconstructed, so any label customization will be lost. The fielName and system properties must be set before this method is called.

 o removeActionCompletedListener
 public void removeActionCompletedListener(ActionCompletedListener listener)
Removes a listener from being notified when a new record is displayed.

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

Parameters:
listener - The listener.
 o setFileName
 public void setFileName(String fileName) throws PropertyVetoException
Sets the name of the file. This property is bound and constrained. Note that the data in the form will not change until a load() is done.

Parameters:
fileName - The file name. The name is specified as a fully qualified path name in the library file system.
Throws: PropertyVetoException
If the change is vetoed.
 o setKey
 public void setKey(Object key[]) throws PropertyVetoException
Sets the key. This property is bound and constrained. Note that the data in the form will not change until a load() is done. The key is only used if the keyed property is true.

Parameters:
key - The values which make up the key with which to find the record. This value may be null.
Throws: PropertyVetoException
If the change is vetoed.
 o setKeyed
 public void setKeyed(boolean keyed) throws PropertyVetoException
Sets whether the file will be accessed in key or sequential order. This property is bound and constrained. Note that the data in the form will not change until a load() is done.

Parameters:
keyed - true if the file will be accessed in key order; false if the file will be accessed in sequential order.
Throws: PropertyVetoException
If the change is vetoed.
 o setLabelText
 public void setLabelText(int index,
                          String text)
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.
 o setSearchType
 public void setSearchType(int searchType) throws PropertyVetoException
Sets the search type. This property is bound and constrained. Note that the data in the form will not change until a load() is done. The search type is only used if the keyed property is true and the key property is not null.

Parameters:
searchType - Constant indicating the type of match required.
Throws: PropertyVetoException
If the change is vetoed.
 o setSystem
 public void setSystem(AS400 system) throws PropertyVetoException
Sets the AS400 where the file is located. This property is bound and constrained. Note that the data in the form will not change until a load() is done.

Parameters:
system - The AS400 where the file is located.
Throws: PropertyVetoException
If the change is vetoed.

All Packages  Class Hierarchy  This Package  Previous  Next  Index