com.ibm.as400.util.servlet
Class RowData
- java.lang.Object
-
- com.ibm.as400.util.servlet.RowData
-
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- ListRowData, RecordListRowData, ResourceListRowData, SQLResultSetRowData
public abstract class RowData extends java.lang.Object implements java.io.Serializable
The RowData class defines a representation for describing and accessing a list of data.The RowData object maintains a position in the list pointing to its current row of data. The initial position is before the first row in the list. Row indexes are numbered starting with 0.
The number, types, and properties of the list's columns are provided by the RowMetaData object returned by the getMetaData method.
Individual data objects in the current row can have properties, or a list of objects, that can be associated with the data. Properties can be set with the setObjectProperties method.
RowData objects generate the following events:
- PropertyChangeEvent
- VetoableChangeEvent
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description protected java.util.Vector
rowProperties_
protected java.util.Vector
rows_
-
Constructor Summary
Constructors Constructor and Description RowData()
Constructs a default RowData object.
-
Method Summary
Methods Modifier and Type Method and Description boolean
absolute(int rowIndex)
Sets the position to the specified rowIndex.void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.void
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds the VetoableChangeListener.void
afterLast()
Sets the position after the last row in the list.void
beforeFirst()
Sets the position before the first row in the list.boolean
first()
Sets the position to the first row in the list.int
getCurrentPosition()
Returns the current row position.abstract RowMetaData
getMetaData()
Returns the meta data.java.lang.Object
getObject(int columnIndex)
Returns the current row's column data specified at columnIndex.java.util.Vector
getObjectProperties(int columnIndex)
Returns the data object's property list at the specified columnIndex.java.util.Vector[]
getRowProperties()
Returns the current row's property list.boolean
isAfterLast()
Indicates whether the current position is after the last row in the list.boolean
isBeforeFirst()
Indicates whether the current position is before the first row in the list.boolean
isFirst()
Indicates whether the current position is the first row in the list.boolean
isLast()
Indicates whether the current position is the last row in the list.boolean
last()
Sets the position to the last row in the list.int
length()
Returns the number of rows in the list.boolean
next()
Sets the position to the next row in the list.boolean
previous()
Sets the position to the previous row in the list.boolean
relative(int numberOfRows)
Sets the position a relative numberOfRows based on the current position.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the PropertyChangeListener from the internal list.void
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes the VetoableChangeListener from the internal list.void
setObjectProperties(java.util.Vector properties, int columnIndex)
Sets the data object's properties at the specified columnIndex.
-
-
-
Field Detail
-
rows_
protected java.util.Vector rows_
-
rowProperties_
protected java.util.Vector rowProperties_
-
-
Method Detail
-
absolute
public boolean absolute(int rowIndex)
Sets the position to the specified rowIndex. Attempting to move beyond the first row will move to the position before the first row. Attempting to move beyond the last row will move to the position after the last row.- Parameters:
rowIndex
- The row index (0-based). The rowIndex must be zero or a positive integer which is less than the number of rows.- Returns:
- true if the requested position exists; false otherwise.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method is called each time the value of any bound property is changed.- Parameters:
listener
- The PropertyChangeListener.- See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener)
-
addVetoableChangeListener
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method is called each time the value of any constrained property is changed.- Parameters:
listener
- The VetoableChangeListener.- See Also:
removeVetoableChangeListener(java.beans.VetoableChangeListener)
-
afterLast
public void afterLast()
Sets the position after the last row in the list. This is a valid position after the end of the list.
-
beforeFirst
public void beforeFirst()
Sets the position before the first row in the list. This is a valid position before the beginning of the list.
-
first
public boolean first()
Sets the position to the first row in the list.- Returns:
- true if the requested position exists; false if the list is empty.
-
getCurrentPosition
public int getCurrentPosition()
Returns the current row position.- Returns:
- The row position (0-based).
-
getMetaData
public abstract RowMetaData getMetaData() throws RowDataException
Returns the meta data.- Returns:
- The meta data.
- Throws:
RowDataException
- If a row data error occurs.
-
getObject
public java.lang.Object getObject(int columnIndex) throws RowDataException
Returns the current row's column data specified at columnIndex.- Parameters:
columnIndex
- The column index (0-based).- Returns:
- The column object.
- Throws:
RowDataException
- If a row data error occurs.
-
getObjectProperties
public java.util.Vector getObjectProperties(int columnIndex)
Returns the data object's property list at the specified columnIndex.- Parameters:
columnIndex
- The column index (0-based).- Returns:
- The property list for the column data object.
- See Also:
setObjectProperties(java.util.Vector, int)
-
getRowProperties
public java.util.Vector[] getRowProperties()
Returns the current row's property list. Each Vector in the properties list corresponds to the appropriate data object's list of properties.- Returns:
- The property lists for each data object in the row.
-
isAfterLast
public boolean isAfterLast()
Indicates whether the current position is after the last row in the list. This is a valid position after the end of the list.- Returns:
- true if the position is after the last row; false otherwise.
-
isBeforeFirst
public boolean isBeforeFirst()
Indicates whether the current position is before the first row in the list. This is a valid position before the beginning of the list.- Returns:
- true if the position is before the first row and the list is not empty; false otherwise.
-
isFirst
public boolean isFirst()
Indicates whether the current position is the first row in the list.- Returns:
- true if the position is the first row; false otherwise.
-
isLast
public boolean isLast()
Indicates whether the current position is the last row in the list.- Returns:
- true if the position is the last row; false otherwise.
-
last
public boolean last()
Sets the position to the last row in the list.- Returns:
- true if the requested position exists; false if the list is empty.
-
length
public int length()
Returns the number of rows in the list.- Returns:
- The number of rows.
-
next
public boolean next()
Sets the position to the next row in the list. The list is initially positioned before its first row. The first call to next makes the first row the current row, the second call makes the second row the current row, etc. Moving beyond last row in the list will result in a position after the last row.- Returns:
- true if the requested position exists in the list; false if there are no more rows.
-
previous
public boolean previous()
Sets the position to the previous row in the list. Moving beyond the first row in the list will result in a position before the first row.- Returns:
- true if the requested position exists in the list; false otherwise.
-
relative
public boolean relative(int numberOfRows)
Sets the position a relative numberOfRows based on the current position. Moving beyond the first/last row in the list will result in a position before/after the first/last row.- Parameters:
numberOfRows
- The number of rows to move, either positive or negative.- Returns:
- true if the requested position exists; false otherwise.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the PropertyChangeListener from the internal list. If the PropertyChangeListener is not on the list, nothing is done.- Parameters:
listener
- The PropertyChangeListener.- See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener)
-
removeVetoableChangeListener
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes the VetoableChangeListener from the internal list. If the VetoableChangeListener is not on the list, nothing is done.- Parameters:
listener
- The VetoableChangeListener.- See Also:
addVetoableChangeListener(java.beans.VetoableChangeListener)
-
setObjectProperties
public void setObjectProperties(java.util.Vector properties, int columnIndex)
Sets the data object's properties at the specified columnIndex. Object properties are user defined objects that can be associated with the data in the row.- Parameters:
properties
- The properties.columnIndex
- The column index (0-based).- See Also:
getObjectProperties(int)
-
-