Class FilterTableModel

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int COL_ENABLED
      The filter enabled column
      static int COL_HIDING
      The column indicating if the filter is hiding.
      static int COL_INVERTED
      The column to invert the filter
      static int COL_TEXT
      The column that displays the filter text
      private OSDLabel lblOSD
      (package private) FilterModel model
      The filter model
      (package private) javax.swing.ListSelectionModel selectionModel
      The selection model
      • Fields inherited from class javax.swing.table.AbstractTableModel

        listenerList
    • Constructor Summary

      Constructors 
      Constructor Description
      FilterTableModel​(javax.swing.ListSelectionModel listSelectionModel)
      Constructs a new FilterTableModel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFilter​(Filter filter)
      Adds a new filter to the filter list.
      void addFilters​(Filter... filters)
      Adds a new filter to the filter list.
      boolean doMove​(int delta, int... selectedRows)
      Performs the move operation, without any check nor selection handling.
      void drawOSDText​(java.awt.Graphics2D g)
      Draws a text on the map display that indicates that filters are active.
      void executeFilters()
      Runs the filters on the current edit data set, if any.
      void executeFilters​(boolean force)
      Runs the filters on the current edit data set, if any.
      void executeFilters​(java.util.Collection<? extends OsmPrimitive> primitives)
      Runs the filter on a list of primitives that are part of the edit data set, if any.
      void executeFilters​(java.util.Collection<? extends OsmPrimitive> primitives, boolean force)
      Runs the filter on a list of primitives that are part of the edit data set, if any.
      java.lang.Class<?> getColumnClass​(int column)  
      int getColumnCount()  
      java.lang.String getColumnName​(int column)  
      java.util.List<Filter> getFilters()
      Returns the list of filters.
      int getRowCount()
      Returns the number of rows in the list/table.
      javax.swing.ListSelectionModel getSelectionModel()
      Returns the selection model.
      Filter getValue​(int rowIndex)
      Get object value at given index.
      java.lang.Object getValueAt​(int row, int column)  
      boolean isCellEditable​(int row, int column)  
      boolean isCellEnabled​(int row, int column)
      Determines if a cell is enabled.
      private void loadPrefs()  
      boolean move​(int delta, int... selectedRows)
      Move selected rows by any number of positions, if possible.
      void removeFilter​(int rowIndex)
      Removes the filter that is displayed in the given row
      void removeFilters​(int... rowIndexes)
      Removes the filters that is displayed in the given rows
      void reverse()
      Reverse the items order.
      private void savePrefs()  
      Filter setValue​(int rowIndex, Filter filter)
      Set object value at given index.
      void setValueAt​(java.lang.Object aValue, int row, int column)  
      void sort()
      Sort the items.
      private void updateFilters()  
      private void updateMap()  
      • 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

      • FilterTableModel

        public FilterTableModel​(javax.swing.ListSelectionModel listSelectionModel)
        Constructs a new FilterTableModel.
        Parameters:
        listSelectionModel - selection model
    • Method Detail

      • executeFilters

        public void executeFilters()
        Runs the filters on the current edit data set, if any. Does nothing if no filter is enabled.
      • executeFilters

        public void executeFilters​(java.util.Collection<? extends OsmPrimitive> primitives)
        Runs the filter on a list of primitives that are part of the edit data set, if any. Does nothing if no filter is enabled.
        Parameters:
        primitives - The primitives
      • executeFilters

        public void executeFilters​(boolean force)
        Runs the filters on the current edit data set, if any.
        Parameters:
        force - force execution of filters even if no filter is enabled. Useful to reset state after change of filters
        Since:
        14206
      • executeFilters

        public void executeFilters​(java.util.Collection<? extends OsmPrimitive> primitives,
                                   boolean force)
        Runs the filter on a list of primitives that are part of the edit data set, if any.
        Parameters:
        force - force execution of filters even if no filter is enabled. Useful to reset state after change of filters
        primitives - The primitives
        Since:
        14206
      • addFilters

        public void addFilters​(Filter... filters)
        Adds a new filter to the filter list.
        Parameters:
        filters - The new filter
        Since:
        18556
      • doMove

        public boolean doMove​(int delta,
                              int... selectedRows)
        Description copied from interface: ReorderableModel
        Performs the move operation, without any check nor selection handling.
        Specified by:
        doMove in interface ReorderableModel<Filter>
        Parameters:
        delta - negative or positive delta
        selectedRows - rows to move
        Returns:
        true if rows have been moved
      • removeFilter

        public void removeFilter​(int rowIndex)
        Removes the filter that is displayed in the given row
        Parameters:
        rowIndex - The index of the filter to remove
        See Also:
        removeFilters(int...)
      • removeFilters

        public void removeFilters​(int... rowIndexes)
        Removes the filters that is displayed in the given rows
        Parameters:
        rowIndexes - The indexes of the filters to remove
        Since:
        18556
      • getRowCount

        public int getRowCount()
        Description copied from interface: ReorderableTableModel
        Returns the number of rows in the list/table.
        Specified by:
        getRowCount in interface ReorderableTableModel<Filter>
        Specified by:
        getRowCount in interface javax.swing.table.TableModel
        Returns:
        the number of rows in the list/table
        See Also:
        ListModel.getSize(), TableModel.getRowCount()
      • getColumnCount

        public int getColumnCount()
        Specified by:
        getColumnCount in interface javax.swing.table.TableModel
      • getColumnName

        public java.lang.String getColumnName​(int column)
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int column)
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
      • isCellEnabled

        public boolean isCellEnabled​(int row,
                                     int column)
        Determines if a cell is enabled.
        Parameters:
        row - row index
        column - column index
        Returns:
        true if the cell at (row, column) is enabled
      • isCellEditable

        public boolean isCellEditable​(int row,
                                      int column)
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.AbstractTableModel
      • setValueAt

        public void setValueAt​(java.lang.Object aValue,
                               int row,
                               int column)
        Specified by:
        setValueAt in interface javax.swing.table.TableModel
        Overrides:
        setValueAt in class javax.swing.table.AbstractTableModel
      • getValueAt

        public java.lang.Object getValueAt​(int row,
                                           int column)
        Specified by:
        getValueAt in interface javax.swing.table.TableModel
      • drawOSDText

        public void drawOSDText​(java.awt.Graphics2D g)
        Draws a text on the map display that indicates that filters are active.
        Parameters:
        g - The graphics to draw that text on.
      • getFilters

        public java.util.List<FiltergetFilters()
        Returns the list of filters.
        Returns:
        the list of filters