Method from javax.faces.model.ResultDataModel Detail: |
public int getRowCount() {
if (result == null) {
return (-1);
}
return (rows.length);
}
If there is wrappedData available, return the
length of the array returned by calling getRows()
on the underlying Result . If no wrappedData
is available, return -1.
|
public SortedMap<String, Object> getRowData() {
if (result == null) {
return (null);
} else if (!isRowAvailable()) {
throw new NoRowAvailableException();
} else {
//noinspection unchecked
return ((SortedMap< String,Object >)rows[index]);
}
}
If row data is available, return the SortedMap array
element at the index specified by rowIndex of the
array returned by calling getRows() on the underlying
Result . If no wrapped data is available,
return null .
Note that, if a non-null Map is returned
by this method, it will contain the values of the columns for the
current row, keyed by column name. Column name comparisons must be
performed in a case-insensitive manner.
|
public int getRowIndex() {
return (index);
}
|
public Object getWrappedData() {
return (this.result);
}
|
public boolean isRowAvailable() {
if (result == null) {
return (false);
} else if ((index >= 0) && (index < rows.length)) {
return (true);
} else {
return (false);
}
}
Return true if there is wrappedData
available, and the current value of rowIndex is greater
than or equal to zero, and less than the length of the array returned
by calling getRows() on the underlying Result .
Otherwise, return false .
|
public void setRowIndex(int rowIndex) {
if (rowIndex < -1) {
throw new IllegalArgumentException();
}
int old = index;
index = rowIndex;
if (result == null) {
return;
}
DataModelListener [] listeners = getDataModelListeners();
if ((old != index) && (listeners != null)) {
SortedMap< String,Object > rowData = null;
if (isRowAvailable()) {
rowData = getRowData();
}
DataModelEvent event =
new DataModelEvent(this, index, rowData);
int n = listeners.length;
for (int i = 0; i < n; i++) {
if (null != listeners[i]) {
listeners[i].rowSelected(event);
}
}
}
}
|
public void setWrappedData(Object data) {
if (data == null) {
result = null;
rows = null;
setRowIndex(-1);
} else {
result = (Result) data;
rows = result.getRows();
index = -1;
setRowIndex(0);
}
}
|