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:
- ActionCompletedEvent
- ErrorEvent
- PropertyChangeEvent
// 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)
-
KEY_EQ
- Constant indicating search type of equal.
-
KEY_GE
- Constant indicating search type of greater than or equal.
-
KEY_GT
- Constant indicating search type of greater than.
-
KEY_LE
- Constant indicating search type of less than or equal.
-
KEY_LT
- Constant indicating search type of less than.
-
RecordListFormPane()
- Constructs a RecordListFormPane object.
-
RecordListFormPane(AS400, String)
- Constructs a RecordListFormPane object.
-
RecordListFormPane(AS400, String, Object[], int)
- Constructs a RecordListFormPane object.
-
addActionCompletedListener(ActionCompletedListener)
- Adds a listener to be notified when a new record is displayed.
-
addErrorListener(ErrorListener)
- Adds a listener to be notified when an error occurs.
-
close()
- Closes the AS/400 file this form represents.
-
displayFirst()
- Displays the first record of the record list.
-
displayLast()
- Displays the last record of the record list.
-
displayNext()
- Displays the next record of the record list.
-
displayPrevious()
- Displays the previous record of the record list.
-
getCurrentRecord()
- Returns the index of the record currently being displayed.
-
getFileName()
- Returns the file name.
-
getKey()
- Returns the key.
-
getKeyed()
- Returns whether the file will be accessed in key or sequential order.
-
getLabelText(int)
- Returns the text of the label at the given index.
-
getSearchType()
- Returns the search type.
-
getStringValueAt(int)
- Returns the string value of the current record at the given index.
-
getSystem()
- Returns the AS400 where the file is located.
-
getValueAt(int)
- Returns the value of the current record at the given index.
-
load()
- Refreshes the view based on the state of the system.
-
removeActionCompletedListener(ActionCompletedListener)
- Removes a listener from being notified when a new record is displayed.
-
removeErrorListener(ErrorListener)
- Removes a listener from being notified when an error occurs.
-
setFileName(String)
- Sets the name of the file.
-
setKey(Object[])
- Sets the key.
-
setKeyed(boolean)
- Sets whether the file will be accessed in key or sequential order.
-
setLabelText(int, String)
- Sets the text of the label at the given index.
-
setSearchType(int)
- Sets the search type.
-
setSystem(AS400)
- Sets the AS400 where the file is located.
KEY_EQ
public static final int KEY_EQ
- Constant indicating search type of equal.
KEY_GT
public static final int KEY_GT
- Constant indicating search type of greater than.
KEY_GE
public static final int KEY_GE
- Constant indicating search type of greater than or equal.
KEY_LT
public static final int KEY_LT
- Constant indicating search type of less than.
KEY_LE
public static final int KEY_LE
- Constant indicating search type of less than or equal.
RecordListFormPane
public RecordListFormPane()
- Constructs a RecordListFormPane object.
This constructor sets the keyed property to false.
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.
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.
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.
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.
close
public void close()
- Closes the AS/400 file this form represents.
displayFirst
public void displayFirst()
- Displays the first record of the record list.
displayLast
public void displayLast()
- Displays the last record of the record list.
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.
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.
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.
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.
getKey
public Object[] getKey()
- Returns the key.
The key is only used if the keyed property is true.
- Returns:
- The key.
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.
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.
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.
getSystem
public AS400 getSystem()
- Returns the AS400 where the file is located.
- Returns:
- The AS400 where the file is located.
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.
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.
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.
removeActionCompletedListener
public void removeActionCompletedListener(ActionCompletedListener listener)
- Removes a listener from being notified when a new record is displayed.
- Parameters:
- listener - The listener.
removeErrorListener
public void removeErrorListener(ErrorListener listener)
- Removes a listener from being notified when an error occurs.
- Parameters:
- listener - The listener.
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.
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.
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.
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.
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.
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