- list of values and text for the choice lists that a parameter may have
- See Also:
- Serialized Form
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary |
CropTableModel(java.lang.String cfgDir,
java.lang.String dbMainDir)
Creates a new instance of CropTableModel |
Method Summary |
void |
addXmlFile(java.lang.String file)
Parse a CROP data file and add it to the table model. |
void |
copyCrop(java.lang.String name,
int row)
Create a copy of the crop data on a certain row and give it a new name. |
boolean |
deleteCrop(int row)
Delete the crop on this row. |
java.lang.String |
getChangedFiles()
Returns a list of the modified files. |
java.lang.String |
getChoice(int col,
int ch)
From a column dropdown list get a specific entry. |
int |
getChoiceCount(int col)
Get number of list elements for a dropdown list for this column. |
java.lang.Class |
getColumnClass(int c)
Called by JTable framework. |
int |
getColumnCount()
Number of columns for table. |
java.lang.String |
getColumnName(int col)
This is prompt field for the parameter with any units appended. |
int |
getColumnType(int col)
The type of data in this column int, float, string, list |
java.lang.String |
getFileName(int row)
For a row get the short file name (no path). |
java.lang.String |
getFilePath(int row)
For a row get the path part of the file |
int |
getRowCount()
Number of rows in table, one per file. |
java.lang.Object |
getValueAt(int row,
int col)
This is called by the JTable framework to get a value at a particular row
and column. |
WepsDBFile |
getXmlFile(int row)
Return the WepsDBFile instance attached this row |
boolean |
isCellEditable(int row,
int col)
Called by JTable framework to see if this cell can switch to edit mode |
boolean |
isModified()
Returns true if any file has been modified. |
boolean |
isModified(int row)
Return true if this file attached to the row has been changed |
boolean |
isReadOnly(int row)
Return true if this row is readonly either because edits are not
allowed or the file is readonly. |
void |
renameCrop(java.lang.String name,
int row)
Give a new name to the crop on this row. |
void |
saveAll()
For any modified files try to save them. |
boolean |
saveFile(int row)
Save the crop file on this row. |
void |
setAltUnits(boolean val)
setAltUnits()
True for English, False for Metric |
void |
setEdit(boolean val)
True if changes are allowed. |
void |
setValueAt(java.lang.Object o,
int row,
int col)
This is called by the JTable framework to set a value at a
particular position. |
void |
sort(int col,
int status)
sort()
Sort the column data in ascending or descending order. |
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CropTableModel
public CropTableModel(java.lang.String cfgDir,
java.lang.String dbMainDir)
- Creates a new instance of CropTableModel
- Parameters:
cfgDir
- Directory where WEPS MCREW config files can be founddbMainDir
- Directory where data files start for crops or operations
getColumnCount
public int getColumnCount()
- Number of columns for table.
- Returns:
- The number of columns which is the number of crop parameters defined.
getRowCount
public int getRowCount()
- Number of rows in table, one per file.
- Returns:
- The number of rows in the crop table which is the number of crop files loaded.
setAltUnits
public void setAltUnits(boolean val)
- setAltUnits()
True for English, False for Metric
- Parameters:
val
- True for English (alternate units) false for metric (default units)
getColumnName
public java.lang.String getColumnName(int col)
- This is prompt field for the parameter with any units appended.
- Parameters:
col
- number number to get heading/name for
- Returns:
- Name of the column with units
getChangedFiles
public java.lang.String getChangedFiles()
- Returns a list of the modified files.
- Returns:
- A list of all the files that have been modified seperated by a '\n'
getValueAt
public java.lang.Object getValueAt(int row,
int col)
- This is called by the JTable framework to get a value at a particular row
and column.
- Parameters:
row
- The row in the table to get the value fromcol
- The column in the table to get the value from
- Returns:
- The String(object) of the cell contents
setValueAt
public void setValueAt(java.lang.Object o,
int row,
int col)
- This is called by the JTable framework to set a value at a
particular position. This passes along the altUnits flag
so any translation can be done.
- Parameters:
o
- - Object that will be saved (string)row
- - Row of table data is fromcol
- - Column of table data is from
isModified
public boolean isModified()
- Returns true if any file has been modified.
- Returns:
- True if any file has been changed
setEdit
public void setEdit(boolean val)
- True if changes are allowed.
- Parameters:
val
- True to allow edits, false to make crop data readonly
getColumnType
public int getColumnType(int col)
- The type of data in this column int, float, string, list
- Returns:
- Type of the column 0,1,2,3
getColumnClass
public java.lang.Class getColumnClass(int c)
- Called by JTable framework.
- Parameters:
c
- Column to get class for
isCellEditable
public boolean isCellEditable(int row,
int col)
- Called by JTable framework to see if this cell can switch to edit mode
- Parameters:
row
- Row to check if editablecol
- Column to check if editable
- Returns:
- true if the cell can handle changes
getChoiceCount
public int getChoiceCount(int col)
- Get number of list elements for a dropdown list for this column.
- Parameters:
col
- Column to check for number of choices
- Returns:
- number of choices this column dropdown list contains
getChoice
public java.lang.String getChoice(int col,
int ch)
- From a column dropdown list get a specific entry.
- Parameters:
col
- Column to check for dropdown listch
- Entry in dropdown list to return
- Returns:
- String representing this specific entry
addXmlFile
public void addXmlFile(java.lang.String file)
- Parse a CROP data file and add it to the table model.
- Parameters:
file
- Crop XML File to load into the table model
saveAll
public void saveAll()
- For any modified files try to save them.
getFileName
public java.lang.String getFileName(int row)
- For a row get the short file name (no path).
- Parameters:
row
- Specific row to get filename for
- Returns:
- Filename as a String
getFilePath
public java.lang.String getFilePath(int row)
- For a row get the path part of the file
- Parameters:
row
- Specific row to get filename for
- Returns:
- Pathname as a String
isModified
public boolean isModified(int row)
- Return true if this file attached to the row has been changed
- Parameters:
row
- Row to check if associated file has been modified
- Returns:
- true if this file in the specified row has changed and need to be saved.
copyCrop
public void copyCrop(java.lang.String name,
int row)
- Create a copy of the crop data on a certain row and give it a new name.
- Parameters:
name
- new filename for croprow
- Base row to copy parameters from
renameCrop
public void renameCrop(java.lang.String name,
int row)
- Give a new name to the crop on this row.
- Parameters:
name
- new name for crop filerow
- row that is being renamed
deleteCrop
public boolean deleteCrop(int row)
- Delete the crop on this row.
- Parameters:
row
- Row to delete associated file
- Returns:
- true if the file was removed
saveFile
public boolean saveFile(int row)
- Save the crop file on this row.
- Parameters:
row
- Row to save associated file from
- Returns:
- true if the data was saved
sort
public void sort(int col,
int status)
- sort()
Sort the column data in ascending or descending order. This will reorder the
xmlFiles list so that when the table is refreshed the data will be in the
requested order.
- Parameters:
col
- Column to sort onstatus
- ASCENDING or DESCENDING
getXmlFile
public WepsDBFile getXmlFile(int row)
- Return the WepsDBFile instance attached this row
- Parameters:
row
- Row to get associated file
- Returns:
- The WepsDBFile instance for this row
isReadOnly
public boolean isReadOnly(int row)
- Return true if this row is readonly either because edits are not
allowed or the file is readonly.
- Parameters:
row
- What row to check for read-only properties
- Returns:
- true if the file on this row is readonly