All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.as400.vaccess.RecordListTablePane
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----javax.swing.JComponent
|
+----com.ibm.as400.vaccess.RecordListTablePane
- public class RecordListTablePane
- extends JComponent
- implements Serializable
The RecordListTablePane class represents a table that contains
the records and fields of an AS/400 file using record-level access.
The data in the table is retrieved from the system when
load() is called. If load() is not called,
the table will be empty.
Users must call close() to ensure that the AS/400
resources are properly freed when this table 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.
The data in this table is not editable, the individual
cell values cannot be changed.
RecordListTablePane objects generate the following events:
- ErrorEvent
- ListSelectionEvent
- PropertyChangeEvent
// Set up table for file contents.
AS400 system = new AS400("MySystem", "Userid", "Password");
String file = "/QSYS.LIB/QGPL.LIB/MyFile.FILE";
final RecordListTablePane pane = new RecordListTablePane(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.
-
RecordListTablePane()
- Constructs a RecordListTablePane object.
-
RecordListTablePane(AS400, String)
- Constructs a RecordListTablePane object.
-
RecordListTablePane(AS400, String, Object[], int)
- Constructs a RecordListTablePane object.
-
addErrorListener(ErrorListener)
- Adds a listener to be notified when an error occurs.
-
addListSelectionListener(ListSelectionListener)
- Adds a listener to be notified when the selection changes.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener to be notified when the value of any bound
property is changed.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a listener to be notified when the value of any constrained
property is changed.
-
close()
- Closes the AS/400 file this table represents.
-
getColumnModel()
- Returns the column model for this table.
-
getColumnTitle(int)
- Returns the title of a column.
-
getColumnWidth(int)
- Returns the width of a column.
-
getDataModel()
- Returns the data model for the table.
-
getFileName()
- Returns the file name.
-
getGridColor()
- Returns the color used to draw grid lines.
-
getKey()
- Returns the key.
-
getKeyed()
- Returns whether the file will be accessed in key or sequential order.
-
getSearchType()
- Returns the search type.
-
getSelectionModel()
- Returns the ListSelectionModel that is used to maintain row selection state.
-
getShowHorizontalLines()
- Returns whether horizontal lines are drawn between rows.
-
getShowVerticalLines()
- Returns whether vertical lines are drawn between columns.
-
getStringValueAt(int, int)
- Returns the string value at the specifed row and column.
-
getSystem()
- Returns the AS400 where the file is located.
-
getValueAt(int, int)
- Returns the value at the specifed row and column.
-
load()
- Loads the table based on the state of the system.
-
moveColumn(int, int)
- Moves the column and heading at columnIndex to newIndex.
-
refreshHeadings()
- Updates the table header to match the data.
-
removeColumn(int)
- Removes a column from the table.
-
removeErrorListener(ErrorListener)
- Removes a listener from being notified when an error occurs.
-
removeListSelectionListener(ListSelectionListener)
- Removes a listener from being notified when the selection changes.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a listener from being notified when the value of any bound
property is changed.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a listener from being notified when the value of any constrained
property is changed.
-
setColumnTitle(int, String)
- Sets the title of a column.
-
setColumnWidth(int, int)
- Sets the width of a column.
-
setFileName(String)
- Sets the name of the file.
-
setGridColor(Color)
- Sets the color used to draw grid lines.
-
setKey(Object[])
- Sets the key.
-
setKeyed(boolean)
- Sets whether the file will be accessed in key or sequential order.
-
setSearchType(int)
- Sets the search type.
-
setSelectionModel(ListSelectionModel)
- Sets the ListSelectionModel that is used to maintain row selection state.
-
setShowHorizontalLines(boolean)
- Sets whether horizontal lines are drawn between rows.
-
setShowVerticalLines(boolean)
- Sets whether vertical lines are drawn between columns.
-
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.
RecordListTablePane
public RecordListTablePane()
- Constructs a RecordListTablePane object.
This constructor sets the keyed property to false.
RecordListTablePane
public RecordListTablePane(AS400 system,
String fileName)
- Constructs a RecordListTablePane 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.
RecordListTablePane
public RecordListTablePane(AS400 system,
String fileName,
Object key[],
int searchType)
- Constructs a RecordListTablePane object.
This constructor sets the keyed property to true.
- Parameters:
- system - The AS400 where the file is located.
- fileName - The keyed 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.
addErrorListener
public void addErrorListener(ErrorListener listener)
- Adds a listener to be notified when an error occurs.
- Parameters:
- listener - The listener.
addListSelectionListener
public void addListSelectionListener(ListSelectionListener listener)
- Adds a listener to be notified when the selection changes.
- Parameters:
- listener - The listener.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener to be notified when the value of any bound
property is changed.
- Parameters:
- listener - The listener.
- Overrides:
- addPropertyChangeListener in class JComponent
addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a listener to be notified when the value of any constrained
property is changed.
- Parameters:
- listener - The listener.
- Overrides:
- addVetoableChangeListener in class JComponent
close
public void close()
- Closes the AS/400 file this table represents.
getColumnModel
public TableColumnModel getColumnModel()
- Returns the column model for this table.
- Returns:
- The model for this table's columns.
getColumnTitle
public String getColumnTitle(int columnIndex)
- Returns the title of a column. This is used for the table column heading.
If an error occurs, null is returned.
- Parameters:
- columnIndex - The index of the column. Indices start at 0.
- Returns:
- The title of the column.
getColumnWidth
public int getColumnWidth(int columnIndex)
- Returns the width of a column.
If an error occurs, 0 is returned.
- Parameters:
- columnIndex - The index of the column. Indices start at 0.
- Returns:
- The width of the column.
getDataModel
public RecordListTableModel getDataModel()
- Returns the data model for the table.
- Returns:
- The data model for the table.
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.
getGridColor
public Color getGridColor()
- Returns the color used to draw grid lines.
- Returns:
- The color used to draw grid lines.
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.
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.
getSelectionModel
public ListSelectionModel getSelectionModel()
- Returns the ListSelectionModel that is used to maintain row selection state.
- Returns:
- The model that provides row selection state.
getShowHorizontalLines
public boolean getShowHorizontalLines()
- Returns whether horizontal lines are drawn between rows.
- Returns:
- true if horizontal lines are to be drawn; false otherwise.
getShowVerticalLines
public boolean getShowVerticalLines()
- Returns whether vertical lines are drawn between columns.
- Returns:
- true if vertical lines are to be drawn; false otherwise.
getSystem
public AS400 getSystem()
- Returns the AS400 where the file is located.
- Returns:
- The AS400 where the file is located.
getStringValueAt
public String getStringValueAt(int rowIndex,
int columnIndex)
- Returns the string value at the specifed row and column.
Indices start at 0.
If an error occurs, null is returned.
- Parameters:
- rowIndex - The row index.
- columnIndex - The column index.
- Returns:
- The value at the specified row and column as a string.
getValueAt
public Object getValueAt(int rowIndex,
int columnIndex)
- Returns the value at the specifed row and column.
Indices start at 0.
If an error occurs, null is returned.
- Parameters:
- rowIndex - The row index.
- columnIndex - The column index.
- Returns:
- The value at the specified row and column.
load
public void load()
- Loads the table based on the state of the system.
The fileName and system properties
must be set before this method is called.
The table heading is reconstructed to ensure it matches
the data, so any column customization will be lost.
moveColumn
public void moveColumn(int columnIndex,
int newIndex)
- Moves the column and heading at columnIndex to newIndex.
The old column at columnIndex will now be found at newIndex,
the column that used to be at newIndex is shifted left or right
to make room.
Indices start at 0.
- Parameters:
- columnIndex - The index of column to be moved.
- newIndex - The new index to move the column to.
refreshHeadings
public void refreshHeadings()
- Updates the table header to match the data.
Any column customization will be lost.
removeColumn
public void removeColumn(int columnIndex)
- Removes a column from the table.
- Parameters:
- columnIndex - The index of column. Indices start at 0.
removeErrorListener
public void removeErrorListener(ErrorListener listener)
- Removes a listener from being notified when an error occurs.
- Parameters:
- listener - The listener.
removeListSelectionListener
public void removeListSelectionListener(ListSelectionListener listener)
- Removes a listener from being notified when the selection changes.
- Parameters:
- listener - The listener.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a listener from being notified when the value of any bound
property is changed.
- Parameters:
- listener - The listener.
- Overrides:
- removePropertyChangeListener in class JComponent
removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a listener from being notified when the value of any constrained
property is changed.
- Parameters:
- listener - The listener.
- Overrides:
- removeVetoableChangeListener in class JComponent
setColumnTitle
public void setColumnTitle(int columnIndex,
String title)
- Sets the title of a column. This is used for the table column heading.
- Parameters:
- columnIndex - The index of column. Indices start at 0.
- title - The title of the column.
setColumnWidth
public void setColumnWidth(int columnIndex,
int width)
- Sets the width of a column.
- Parameters:
- columnIndex - The index of column. Indices start at 0.
- width - The column width.
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 table 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.
setGridColor
public void setGridColor(Color color)
- Sets the color used to draw grid lines.
- Parameters:
- color - The color used to draw the grid lines.
setKey
public void setKey(Object key[]) throws PropertyVetoException
- Sets the key.
This property is bound and constrained.
Note that the data in the table 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 table 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.
setSearchType
public void setSearchType(int searchType) throws PropertyVetoException
- Sets the search type.
This property is bound and constrained.
Note that the data in the table 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.
setSelectionModel
public void setSelectionModel(ListSelectionModel model)
- Sets the ListSelectionModel that is used to maintain row selection state.
- Parameters:
- model - The model that provides the row selection state.
setShowHorizontalLines
public void setShowHorizontalLines(boolean show)
- Sets whether horizontal lines are drawn between rows.
- Parameters:
- show - true if horizontal lines are to be drawn; false otherwise.
setShowVerticalLines
public void setShowVerticalLines(boolean show)
- Sets whether vertical lines are drawn between columns.
- Parameters:
- show - true if vertical lines are to be drawn; false otherwise.
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 table 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