Class ColumnFilterDialogModel<R>
- java.lang.Object
-
- docking.widgets.table.constraint.dialog.ColumnFilterDialogModel<R>
-
- Type Parameters:
R
- the row type for the table
public class ColumnFilterDialogModel<R> extends java.lang.Object
This class is for constructing and editingColumnBasedTableFilter
. It is used by theColumnFilterDialog
and exists primarily to make testing easier.
-
-
Constructor Summary
Constructors Constructor Description ColumnFilterDialogModel(RowObjectFilterModel<R> model, javax.swing.table.TableColumnModel columnModel, ColumnBasedTableFilter<R> currentColumnTableFilter)
Constructs a new ColumnFilterModel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(TableFilterDialogModelListener listener)
Adds a listener to be notified for various changes that occur in this filter model.void
clear()
Clears the model of all filters.DialogFilterRow
createFilterRow(LogicOperation logicOperation)
Creates a new filter fow (a new major row in the dialog filter panel)void
deleteFilterRow(DialogFilterRow filterRow)
Deletes a filter row (a major row in the dialog filter panel)void
dispose()
clean up.java.util.List<ColumnFilterData<?>>
getAllColumnFilterData()
Returns a list of the columnFilterData for all filterable columns in the tablejava.util.List<DialogFilterRow>
getFilterRows()
Returns a list of all filter rows in this model.ColumnBasedTableFilter<R>
getTableColumnFilter()
Builds a ColumnTableFilter from this model if the model is valid.boolean
hasUnappliedChanges()
Returns true if this model has changes that make the filter different from the currently applied filter.boolean
isEmpty()
Return true if there are no conditions (valid or invalid) defined for this filter model.boolean
isValid()
Checks if this model represents a valid filter.void
removeListener(TableFilterDialogModelListener listener)
Removes the given listener.void
setCurrentlyAppliedFilter(ColumnBasedTableFilter<R> tableColumnFilter)
-
-
-
Constructor Detail
-
ColumnFilterDialogModel
public ColumnFilterDialogModel(RowObjectFilterModel<R> model, javax.swing.table.TableColumnModel columnModel, ColumnBasedTableFilter<R> currentColumnTableFilter)
Constructs a new ColumnFilterModel- Parameters:
model
- the RowObjectFilterModel of the table being filtered.columnModel
- the TableColumnModel of the table being filtered.currentColumnTableFilter
- the currently applied TableColumnFilter or null if there is no current TableColumnFilter applied.
-
-
Method Detail
-
dispose
public void dispose()
clean up.
-
createFilterRow
public DialogFilterRow createFilterRow(LogicOperation logicOperation)
Creates a new filter fow (a new major row in the dialog filter panel)- Parameters:
logicOperation
- the logical operation for how this row interacts with the rows before it- Returns:
- the new filter row that represents a major row in the dialog filter panel.
-
deleteFilterRow
public void deleteFilterRow(DialogFilterRow filterRow)
Deletes a filter row (a major row in the dialog filter panel)- Parameters:
filterRow
- the row to delete.
-
getFilterRows
public java.util.List<DialogFilterRow> getFilterRows()
Returns a list of all filter rows in this model.- Returns:
- a list of all filter rows in this model.
-
addListener
public void addListener(TableFilterDialogModelListener listener)
Adds a listener to be notified for various changes that occur in this filter model.- Parameters:
listener
- the listener to add.
-
removeListener
public void removeListener(TableFilterDialogModelListener listener)
Removes the given listener.- Parameters:
listener
- the listener to remove.
-
isValid
public boolean isValid()
Checks if this model represents a valid filter. While editing, some elements of the filter may be incomplete or invalid and if so, then this method will return false.- Returns:
- true if the model represents a valid filter.
-
getTableColumnFilter
public ColumnBasedTableFilter<R> getTableColumnFilter()
Builds a ColumnTableFilter from this model if the model is valid.- Returns:
- a new ColumnTableFilter based on the configuration of this model or null if the model is invalid.
-
clear
public void clear()
Clears the model of all filters.
-
getAllColumnFilterData
public java.util.List<ColumnFilterData<?>> getAllColumnFilterData()
Returns a list of the columnFilterData for all filterable columns in the table- Returns:
- a list of the columnFilterData for all filterable columns in the table
-
isEmpty
public boolean isEmpty()
Return true if there are no conditions (valid or invalid) defined for this filter model.- Returns:
- true if there are no conditions (valid or invalid) defined for this filter model.
-
hasUnappliedChanges
public boolean hasUnappliedChanges()
Returns true if this model has changes that make the filter different from the currently applied filter.- Returns:
- if there are unapplied user changes to the filter.
-
setCurrentlyAppliedFilter
public void setCurrentlyAppliedFilter(ColumnBasedTableFilter<R> tableColumnFilter)
-
-