| 1 |
package com.jidesoft.validation; |
| 2 |
|
| 3 |
import java.util.EventObject; |
| 4 |
|
| 5 |
/** |
| 6 |
* RowValidationObject is an object containing the information that needed by RowValidator. |
| 7 |
* The base class has two things - the JTable which is the source (you need to cast to JTable), and the row index. |
| 8 |
* <p/> |
| 9 |
* Please note, the row index is the visual row index as the validation is triggered in the JideTable code. |
| 10 |
* In order to find the actual row index as in the table model, you will need TableModelWrapperUtils.getActualRowAt method. |
| 11 |
* <p/> |
| 12 |
* Users can extend this class to create their own RowValidationObject to provide |
| 13 |
* additional information that needed by RowValidator. |
| 14 |
*/ |
| 15 |
|
| 16 |
public class RowValidationObject extends EventObject { |
| 17 |
|
| 18 |
private int _rowIndex; |
| 19 |
|
| 20 |
public RowValidationObject(Object source, int rowIndex) { |
| 21 |
super(source); |
| 22 |
_rowIndex = rowIndex; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Gets the row index. the row index is the visual row index. |
| 27 |
* In order to find the actual row index as in the table model, you will need TableModelWrapperUtils.getActualRowAt method. |
| 28 |
* |
| 29 |
* @return the row index. |
| 30 |
*/ |
| 31 |
public int getRowIndex() { |
| 32 |
return _rowIndex; |
| 33 |
} |
| 34 |
|
| 35 |
@Override |
| 36 |
public String toString() { |
| 37 |
String properties = |
| 38 |
" source=" + getSource() + |
| 39 |
" rowIndex=" + getRowIndex() + |
| 40 |
" "; |
| 41 |
return getClass().getName() + "[" + properties + "]"; |
| 42 |
} |
| 43 |
} |