public class FileSetTableModel extends java.lang.Object implements javax.swing.table.TableModel, Resetable
Constructor and Description |
---|
FileSetTableModel(java.util.List<TargetFile> fileList,
Localizer localizer)
Must be instantiated with a non null file list and a Localizer instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addTableModelListener(javax.swing.event.TableModelListener tmListener) |
void |
clearInfo()
Resets the info column to default.
|
void |
deleteRow(int rowIndex)
Removes the indicated row from this table model.
|
java.io.File |
getBaseDirectory()
Returns the base directory that was specified when the file set was set.
|
java.lang.Class<?> |
getColumnClass(int columnIndex) |
int |
getColumnCount() |
java.lang.String |
getColumnName(int columnIndex) |
int |
getIncludedRowCount()
Returns the number of included rows.
|
TargetFile |
getRow(int rowIndex)
Returns the row object for the specified index.
|
int |
getRowCount() |
int |
getRowIndex(TargetFile file)
Returns the index of the specified file
in this table or -1 if it is not present.
|
int |
getSelectedRowCount()
Returns the number of currently selected rows.
|
java.util.List<TargetFile> |
getSelectedRows()
Returns the set of selected rows.
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the following values from the underlying file object:
column 0: TargetFile.isSelected()
column 1: TargetFile.getName()
column 2: TargetFile.getPath() ,
formated as relative path with respect to the base directory
column 3: TargetFile.getNewName()
|
boolean |
isCellEditable(int rowIndex,
int columnIndex) |
java.util.List<TargetFile> |
listRows()
Returns the entire row set
|
void |
notifyUpdate()
Triggers a call to the registered TableModelListeners
in order to force a repaint operation.
|
void |
removeTableModelListener(javax.swing.event.TableModelListener tmListener) |
void |
reset()
Clears the internal row list.
|
void |
setFileList(java.util.List<TargetFile> fileList,
java.io.File baseDirectory)
Resets all rows to the elements from the specified List.
|
void |
setLocalizer(Localizer localizer)
Sets the Localizer that should be used to translate the
column header.
|
void |
setRow(int rowIndex,
TargetFile row)
Replace the indicated row with the specified new object.
|
void |
setValueAt(java.lang.Object value,
int rowIndex,
int columnIndex) |
void |
sortByColumn(int columnIndex)
Resorts the table by the specified column.
|
public FileSetTableModel(java.util.List<TargetFile> fileList, Localizer localizer)
fileList
- must not be nulllocalizer
- for translation of column headerpublic void setFileList(java.util.List<TargetFile> fileList, java.io.File baseDirectory)
getValueAt(row, 2)
will
return a relative path, if the respective file object resides under the base directory.fileList
- new table contentbaseDirectory
- common base directory for this file set. May be null.public void setLocalizer(Localizer localizer)
localizer
- for translationspublic void clearInfo()
public void notifyUpdate()
public int getSelectedRowCount()
public java.util.List<TargetFile> getSelectedRows()
public int getIncludedRowCount()
public int getRowIndex(TargetFile file)
file
- to be looked uppublic TargetFile getRow(int rowIndex)
rowIndex
- zero base row indexpublic void setRow(int rowIndex, TargetFile row)
rowIndex
- zero base row indexrow
- new row objectpublic void deleteRow(int rowIndex)
rowIndex
- zero base row indexpublic java.util.List<TargetFile> listRows()
public java.io.File getBaseDirectory()
public void sortByColumn(int columnIndex)
columnIndex
- only 1 or two can trigger a resortpublic int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
public java.lang.Class<?> getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
TargetFile.isSelected()
TargetFile.getName()
TargetFile.getPath()
,
formated as relative path with respect to the base directoryTargetFile.getNewName()
getValueAt
in interface javax.swing.table.TableModel
rowIndex
- zero based row numbercolumnIndex
- zero based column indexpublic void setValueAt(java.lang.Object value, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
public void addTableModelListener(javax.swing.event.TableModelListener tmListener)
addTableModelListener
in interface javax.swing.table.TableModel
public void removeTableModelListener(javax.swing.event.TableModelListener tmListener)
removeTableModelListener
in interface javax.swing.table.TableModel