Class TableUtils


  • public class TableUtils
    extends java.lang.Object
    A utility class for JTables used in Ghidra.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_SEARCH_ROWS  
    • Constructor Summary

      Constructors 
      Constructor Description
      TableUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void columnAlternativelySelected​(javax.swing.JTable table, int columnIndex)
      Attempts to sort the given table based upon the given column index.
      static void columnSelected​(javax.swing.JTable table, int columnIndex)
      Attempts to sort the given table based upon the given column index.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TableUtils

        public TableUtils()
    • Method Detail

      • columnSelected

        public static void columnSelected​(javax.swing.JTable table,
                                          int columnIndex)
        Attempts to sort the given table based upon the given column index. If the TableModel of the given table is not a SortedTableModel, then this method will do nothing.

        If the given column index is not sortable, then this method will not change the state of the model. Otherwise, the sorted model will be sorted on the given column index. The results of calling this method depend upon the current sorted state of the given column:

        1. if the column is not yet the sorted column, then the column is made the sorted column, if sortable, and any other sorted columns will be made unsorted, or
        2. if the column is the sorted column and the direction will simply be toggled.
        Parameters:
        table - The table whose model shall be sorted.
        columnIndex - The column index upon which to sort.
      • columnAlternativelySelected

        public static void columnAlternativelySelected​(javax.swing.JTable table,
                                                       int columnIndex)
        Attempts to sort the given table based upon the given column index. If the TableModel of the given table is not a SortedTableModel, then this method will do nothing.

        If the given column index is not sortable, then this method will not change the state of the model. The results of calling this method depend upon the current sorted state of the given column:

        1. if the column is not yet sorted, then the column is made sorted, if sortable, and any other sorted columns will not be changed, or
        2. if the column is sorted, then:
          1. if there are other sorted columns, this column will no longer be sorted
          2. if there are no other sorted columns, then no action will be taken
        Parameters:
        table - The table whose model shall be sorted.
        columnIndex - The column index upon which to sort.