|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractTableModel
CoordinateTableModel
public class CoordinateTableModel
A table of direct positions. All coordinates contained in this table have the same coordinate reference system, which is specified at construction time.
This table model provides a way to display invalid coordinates in a different color. Invalid coordinates are defined here as coordinates outside the CRS domain of validity. This color display can be enabled by the following code:
CoordinateTableModel model = new CoordinateTableModel(crs); JTable view = new JTable(model); TableCellRenderer renderer = new CellRenderer(); view.setDefaultRenderer(Double.class, renderer);
| display/geotk-widgets-swing (download) | View source code for this class |
| Nested Class Summary | |
|---|---|
static class |
CoordinateTableModel.CellRenderer
A cell renderer for the coordinate table model. |
| Field Summary |
|---|
| Fields inherited from class AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
CoordinateTableModel(CoordinateReferenceSystem crs)
Creates an initially empty table model using the specified coordinate reference system. |
|
| Method Summary | |
|---|---|
void |
add(Collection<? extends DirectPosition> newPositions)
Adds a collection of direct positions to this table. |
void |
add(DirectPosition newPosition)
Adds a direct position to this table. |
Class<?> |
getColumnClass(int columnIndex)
Returns tye type of data for the specified column. |
int |
getColumnCount()
Returns the number of columns in the table. |
String |
getColumnName(int columnIndex)
Returns the name for the specified column. |
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the CRS for this table model |
List<DirectPosition> |
getPositions()
Returns all direct positions in this table. |
int |
getRowCount()
Returns the number of rows in the table. |
Number |
getValueAt(int rowIndex,
int columnIndex)
Returns the value in the table at the specified postion. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Tells that the user can edit every rows in the table. |
boolean |
isValidCoordinate(int rowIndex)
Returns true if the position at the specified row is inside the CRS
domain of validity. |
void |
setValueAt(Object value,
int rowIndex,
int columnIndex)
Sets the value for the specified cell. |
String |
toString()
Returns a string representation of this table. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CoordinateTableModel(CoordinateReferenceSystem crs)
crs - The Coordinate Reference System of all coordinates to appear in this model.| Method Detail |
|---|
public CoordinateReferenceSystem getCoordinateReferenceSystem()
public List<DirectPosition> getPositions()
add(DirectPosition),
add(Collection)public int getRowCount()
public int getColumnCount()
public String getColumnName(int columnIndex)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelpublic Class<?> getColumnClass(int columnIndex)
Double.class.
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelpublic void add(DirectPosition newPosition)
DirectPosition object.
newPosition - The position to add to this table.public void add(Collection<? extends DirectPosition> newPositions)
DirectPosition object.
newPositions - The positions to add to this table.
public Number getValueAt(int rowIndex,
int columnIndex)
rowIndex - Cell row number.columnIndex - Cell column number.
null if no value is available for the specified cell.
public void setValueAt(Object value,
int rowIndex,
int columnIndex)
setValueAt in interface TableModelsetValueAt in class AbstractTableModelvalue - The new value for the cell.rowIndex - Row number of the cell modified.columnIndex - Column number of the cell modified.
public boolean isCellEditable(int rowIndex,
int columnIndex)
isCellEditable in interface TableModelisCellEditable in class AbstractTableModelpublic boolean isValidCoordinate(int rowIndex)
true if the position at the specified row is inside the CRS
domain of validity.
This method is invoked by CoordinateTableModel.CellRenderer in order to determine if this
row should be colorized.
rowIndex - The index of the coordinate to test for validity.
true if the coordinate at the given index is valid.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||