Package org.zaproxy.zap.view.table
Class DefaultHistoryReferencesTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- org.zaproxy.zap.view.table.AbstractHistoryReferencesTableModel<DefaultHistoryReferencesTableEntry>
-
- org.zaproxy.zap.view.table.DefaultHistoryReferencesTableModel
-
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.table.TableModel
,HistoryReferencesTableModel<DefaultHistoryReferencesTableEntry>
- Direct Known Subclasses:
ActiveScanTableModel
,DefaultCustomColumnHistoryReferencesTableModel
public class DefaultHistoryReferencesTableModel extends AbstractHistoryReferencesTableModel<DefaultHistoryReferencesTableEntry>
A default implementation ofHistoryReferencesTableModel
.- See Also:
HistoryReferencesTableModel
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.zaproxy.zap.view.table.HistoryReferencesTableModel
HistoryReferencesTableModel.Column
-
-
Constructor Summary
Constructors Constructor Description DefaultHistoryReferencesTableModel()
Constructs aDefaultHistoryReferencesTableModel
with the default columns.DefaultHistoryReferencesTableModel(HistoryReferencesTableModel.Column[] columns)
Constructs aDefaultHistoryReferencesTableModel
with the specified columns (in the specified order).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntry(DefaultHistoryReferencesTableEntry historyReference)
Appends the givenentry
to the end of the entries.void
addHistoryReference(HistoryReference historyReference)
Convenience method that creates aDefaultHistoryReferencesTableEntry
with the given history reference and adds it to the model.void
clear()
Removes all the entries.java.lang.Class<?>
getColumnClass(int columnIndex)
Returns theClass
of the given column.java.lang.Class<?>
getColumnClass(HistoryReferencesTableModel.Column column)
Returns theClass
of the given column.static HistoryReferencesTableModel.Column[]
getDefaultColumns()
DefaultHistoryReferencesTableEntry
getEntry(int rowIndex)
Returns the entry at the givenrowIndex
.int
getEntryRowIndex(int historyReferenceId)
Returns the row index of the entry with the givenhistoryReferenceId
.DefaultHistoryReferencesTableEntry
getEntryWithHistoryId(int historyId)
Returns the entry with the givenhistoryReferenceId
.HistoryReference
getHistoryReference(int historyReferenceId)
Returns the history reference with the given ID.java.lang.Object
getPrototypeValue(int columnIndex)
Returns the prototype value for the given column index.java.lang.Object
getPrototypeValue(HistoryReferencesTableModel.Column column)
Returns the prototype value of the given column.int
getRowCount()
void
refreshEntryRow(int historyReferenceId)
Notifies the table model listeners that the entry with the givenhistoryReferenceId
has changed.void
refreshEntryRows()
void
removeEntry(int historyReferenceId)
Removes the entry with the givenhistoryReferenceId
.void
removeHistoryReference(HistoryReference historyReference)
Convenience method that removes aDefaultHistoryReferencesTableEntry
with the given history reference from the model.-
Methods inherited from class org.zaproxy.zap.view.table.AbstractHistoryReferencesTableModel
getColumn, getColumnCount, getColumnIndex, getColumnName, getColumns, getValueAt, isColumnEnabled, isCustomColumn, isCustomColumn
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
-
-
-
Constructor Detail
-
DefaultHistoryReferencesTableModel
public DefaultHistoryReferencesTableModel()
Constructs aDefaultHistoryReferencesTableModel
with the default columns.- See Also:
getDefaultColumns()
-
DefaultHistoryReferencesTableModel
public DefaultHistoryReferencesTableModel(HistoryReferencesTableModel.Column[] columns)
Constructs aDefaultHistoryReferencesTableModel
with the specified columns (in the specified order).- Parameters:
columns
- the columns that will have the model- Throws:
java.lang.IllegalArgumentException
- ifcolumns
is null or empty.
-
-
Method Detail
-
getDefaultColumns
public static HistoryReferencesTableModel.Column[] getDefaultColumns()
-
getColumnClass
public java.lang.Class<?> getColumnClass(int columnIndex)
Description copied from class:AbstractHistoryReferencesTableModel
Returns theClass
of the given column.- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Specified by:
getColumnClass
in classAbstractHistoryReferencesTableModel<DefaultHistoryReferencesTableEntry>
- Parameters:
columnIndex
- the column being queried- Returns:
- the
Class
of the column
-
getColumnClass
public java.lang.Class<?> getColumnClass(HistoryReferencesTableModel.Column column)
Returns theClass
of the given column.- Parameters:
column
- the column being queried- Returns:
- the
Class
of the column
-
getRowCount
public int getRowCount()
-
getPrototypeValue
public java.lang.Object getPrototypeValue(int columnIndex)
Description copied from interface:HistoryReferencesTableModel
Returns the prototype value for the given column index. The prototype value is a possible representation of the values that might exist in the column. It's used to set an expected width for the column.- Parameters:
columnIndex
- the column index that will be checked.- Returns:
- the prototype value for the column
-
getPrototypeValue
public java.lang.Object getPrototypeValue(HistoryReferencesTableModel.Column column)
Returns the prototype value of the given column.- Parameters:
column
- the column being queried- Returns:
- the prototype value of the column
-
addEntry
public void addEntry(DefaultHistoryReferencesTableEntry historyReference)
Description copied from interface:HistoryReferencesTableModel
Appends the givenentry
to the end of the entries.- Parameters:
historyReference
- the entry that will be added
-
refreshEntryRow
public void refreshEntryRow(int historyReferenceId)
Description copied from interface:HistoryReferencesTableModel
Notifies the table model listeners that the entry with the givenhistoryReferenceId
has changed.The call to this method has no effect if there is no entry with the given ID.
- Parameters:
historyReferenceId
- theHistoryReference
ID of the entry that has changed- See Also:
TableModelListener
-
refreshEntryRows
public void refreshEntryRows()
-
removeEntry
public void removeEntry(int historyReferenceId)
Description copied from interface:HistoryReferencesTableModel
Removes the entry with the givenhistoryReferenceId
.The call to this method has no effect if there is no entry with the given ID.
- Parameters:
historyReferenceId
- theHistoryReference
ID of the entry that will be removed
-
clear
public void clear()
Description copied from interface:HistoryReferencesTableModel
Removes all the entries.
-
getEntryRowIndex
public int getEntryRowIndex(int historyReferenceId)
Description copied from interface:HistoryReferencesTableModel
Returns the row index of the entry with the givenhistoryReferenceId
. If there is no entry with the given ID -1 is returned.- Parameters:
historyReferenceId
- theHistoryReference
ID of the entry that will be searched- Returns:
- the row index of the entry with the given
HistoryReference
ID, or -1 if there is no entry with the given ID
-
getEntryWithHistoryId
public DefaultHistoryReferencesTableEntry getEntryWithHistoryId(int historyId)
Description copied from interface:HistoryReferencesTableModel
Returns the entry with the givenhistoryReferenceId
. If there is no entry with the given IDnull
is returned.- Parameters:
historyId
- theHistoryReference
ID of the entry that will be returned- Returns:
- the entry with the given
HistoryReference
ID, ornull
if there is no entry with the given ID
-
getEntry
public DefaultHistoryReferencesTableEntry getEntry(int rowIndex)
Description copied from interface:HistoryReferencesTableModel
Returns the entry at the givenrowIndex
.- Parameters:
rowIndex
- the row index of the entry- Returns:
- the entry at the given row index
-
addHistoryReference
public void addHistoryReference(HistoryReference historyReference)
Convenience method that creates aDefaultHistoryReferencesTableEntry
with the given history reference and adds it to the model.- Parameters:
historyReference
- the history reference that will be added to the model- See Also:
DefaultHistoryReferencesTableEntry
,HistoryReference
-
removeHistoryReference
public void removeHistoryReference(HistoryReference historyReference)
Convenience method that removes aDefaultHistoryReferencesTableEntry
with the given history reference from the model. If the providedHistoryReference
isnull
the function will return without having done anything.- Parameters:
historyReference
- the history reference that will be removed from the model- Since:
- 2.7.0
- See Also:
DefaultHistoryReferencesTableEntry
,HistoryReference
-
getHistoryReference
public HistoryReference getHistoryReference(int historyReferenceId)
Returns the history reference with the given ID. If the history reference is not foundnull
is returned.- Parameters:
historyReferenceId
- the ID of the history reference that will be searched- Returns:
- the history reference, or
null
if not found
-
-