|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
ex1.CropTableModel
Table model for crop viewer. This is the model for delivering data to the crop table view. This handles loading the crop_defn.xml file and the
crop_lang.xml file.
The crop_defn.xml file contains the following information that is stored:
Field Summary |
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 |
Constructor Detail |
public CropTableModel(java.lang.String cfgDir, java.lang.String dbMainDir)
cfgDir
- Directory where WEPS MCREW config files can be founddbMainDir
- Directory where data files start for crops or operationsMethod Detail |
public int getColumnCount()
public int getRowCount()
public void setAltUnits(boolean val)
val
- True for English (alternate units) false for metric (default units)public java.lang.String getColumnName(int col)
col
- number number to get heading/name for
public java.lang.String getChangedFiles()
public java.lang.Object getValueAt(int row, int col)
row
- The row in the table to get the value fromcol
- The column in the table to get the value from
public void setValueAt(java.lang.Object o, int row, int col)
o
- - Object that will be saved (string)row
- - Row of table data is fromcol
- - Column of table data is frompublic boolean isModified()
public void setEdit(boolean val)
val
- True to allow edits, false to make crop data readonlypublic int getColumnType(int col)
public java.lang.Class getColumnClass(int c)
c
- Column to get class forpublic boolean isCellEditable(int row, int col)
row
- Row to check if editablecol
- Column to check if editable
public int getChoiceCount(int col)
col
- Column to check for number of choices
public java.lang.String getChoice(int col, int ch)
col
- Column to check for dropdown listch
- Entry in dropdown list to return
public void addXmlFile(java.lang.String file)
file
- Crop XML File to load into the table modelpublic void saveAll()
public java.lang.String getFileName(int row)
row
- Specific row to get filename for
public java.lang.String getFilePath(int row)
row
- Specific row to get filename for
public boolean isModified(int row)
row
- Row to check if associated file has been modified
public void copyCrop(java.lang.String name, int row)
name
- new filename for croprow
- Base row to copy parameters frompublic void renameCrop(java.lang.String name, int row)
name
- new name for crop filerow
- row that is being renamedpublic boolean deleteCrop(int row)
row
- Row to delete associated file
public boolean saveFile(int row)
row
- Row to save associated file from
public void sort(int col, int status)
col
- Column to sort onstatus
- ASCENDING or DESCENDINGpublic WepsDBFile getXmlFile(int row)
row
- Row to get associated file
public boolean isReadOnly(int row)
row
- What row to check for read-only properties
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |