Class SeedTableModel

All Implemented Interfaces:
Serializable, TableModel

public class SeedTableModel extends AbstractTableModel
TableModel backed by a SeedOverlay. Seven columns (X, Y, Z, Conf, Radius, Type, Source, plus an optional Status column when an SNT instance is supplied so coverage can be derived live from the active tracing).

All cells are read-only: to relocate a seed, change confidence/radius/type, or relabel its provenance, open the SeedPointEditDialog (single mode via double-click on a row or Alt+Click on the canvas; bulk mode via the panel's Edit toolbar button).

The model remains a 1:1 view of the overlay (one row per seed). Confidence- range filtering is exposed as a RowFilter via confidenceRangeFilter(), which the panel installs on the table's TableRowSorter; out-of-range rows are hidden by the sorter (not removed from the model), so view↔model row conversions continue to work transparently for selection sync.

Author:
Tiago Ferreira
See Also:
  • Field Details

  • Constructor Details

    • SeedTableModel

      public SeedTableModel(SeedOverlay overlay)
      Builds a model without the Status column.
    • SeedTableModel

      public SeedTableModel(SeedOverlay overlay, SNT snt)
      Builds a model with an optional Status column. snt == null suppresses the column (matches the simpler constructor's behavior).
  • Method Details

    • recomputeStatuses

      public void recomputeStatuses()
      Recomputes the coverage cache and fires a status-column update. Callers (e.g. the panel) can invoke this after tracer runs that change paths without going through the SeedOverlay listener.
    • dispose

      public void dispose()
      Unregisters the overlay listener and clears the status-cache reference. Must be called when this model is no longer used: the listener holds a strong reference back to this model, so failing to call dispose() pins the model (and its enclosing UI) for as long as the overlay lives.
    • getRowCount

      public int getRowCount()
    • getColumnCount

      public int getColumnCount()
    • getColumnName

      public String getColumnName(int col)
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
    • getColumnClass

      public Class<?> getColumnClass(int col)
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AbstractTableModel
    • getValueAt

      public Object getValueAt(int row, int col)
    • isCellEditable

      public boolean isCellEditable(int row, int col)
      All cells are read-only. Edits go through SeedPointEditDialog (opened via row double-click, canvas Alt+Click, or the panel's Edit toolbar button), which rebuilds the immutable SeedPoint and applies it via SeedOverlay.replaceAt(int, SeedPoint).
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class AbstractTableModel
    • confidenceRangeFilter

      public RowFilter<SeedTableModel,Integer> confidenceRangeFilter()
      Returns:
      a RowFilter that includes a row iff its seed's confidence falls within the overlay's current [lowConfidence, highConfidence] window. The filter reads the bounds live, so re-evaluating it after a range change (e.g., via the model's fireTableDataChanged() firing on overlay changes) is sufficient: the panel does not need to swap the filter.