Class ColumnBasedTableFilter<R>
- Type Parameters:
R- the row type of the table
- All Implemented Interfaces:
TableFilter<R>
TableFilter that filters based on column values
This class maintains a list of ColumnConstraintSet objects that are logically combined
to determine if the overall filter accepts the given row object. Each ColumnConstraint has an
associated LogicOperation which determines how its result are combined with the constraint
set before it. (The first ConstraintSets LogicOperation is not used). AND operations have higher
precedence than the OR operations.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new empty ColumnBasedTableFilter -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsRow(R rowObject) Returns true if this filter matches the given row (data)<T> voidaddConstraintSet(LogicOperation logicalOp, int columnIndex, List<ColumnConstraint<T>> constraints) Adds a new constraintSet to this ColumnBasedTableFiltercopy()booleanList<ColumnConstraintSet<R, ?>> Return the list of ConstraintSets in this TableFilterReturns an HTML description of this filter.getName()Returns the name of this filter.getToolTip(int columnIndex) Return a tooltip that describes the effect of this filter for a specific filter.booleanhasColumnFilter(int columnModelIndex) Returns true if the there is a column filter on the column specifiedinthashCode()booleanisEquivalent(ColumnBasedTableFilter<?> other) Checks if the givenColumnBasedTableFilteris the same as this one except for its name.booleanisSaved()Returns true if this filter has been saved (i.e.booleanisSubFilterOf(TableFilter<?> tableFilter) Returns true if this filter is a more specific version of the given filter.<T> voidRestore this filter from the given saveState.save()Serializes this filter into a SaveState object.voidSets the name of this filter.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface docking.widgets.table.TableFilter
isEmpty
-
Constructor Details
-
ColumnBasedTableFilter
Constructs a new empty ColumnBasedTableFilter- Parameters:
model- the table model
-
-
Method Details
-
copy
-
acceptsRow
Description copied from interface:TableFilterReturns true if this filter matches the given row (data)- Specified by:
acceptsRowin interfaceTableFilter<R>- Parameters:
rowObject- the current row object- Returns:
- true if the element at the given row matches this filter.
-
getName
Returns the name of this filter.Names are used for saving filters, so unless they are saved they typically don't have a name.
- Returns:
- the name of this filter.
-
setName
Sets the name of this filter.- Parameters:
name- the new name for this filter.
-
addConstraintSet
public <T> void addConstraintSet(LogicOperation logicalOp, int columnIndex, List<ColumnConstraint<T>> constraints) Adds a new constraintSet to this ColumnBasedTableFilter- Parameters:
logicalOp- The logic operation (AND or OR) for how the new ConstraintSet's result will be combined with the previous ConstraintSet's result.columnIndex- the model index of the column whose values must past the given constraint filters.constraints- a list of ColumnConstraints where at least one must pass for the constraintSet to pass.
-
isSubFilterOf
Description copied from interface:TableFilterReturns true if this filter is a more specific version of the given filter.For example, if this filter is a 'starts with' text filter, with the value of 'bobo', then if the given filter is also a 'starts with' filter, with a value of 'bob', then this filter is considered a sub-filter of the given sub-filter.
- Specified by:
isSubFilterOfin interfaceTableFilter<R>- Parameters:
tableFilter- the filter to check- Returns:
- true if this filter is a sub-filter of the given filter
-
hasColumnFilter
public boolean hasColumnFilter(int columnModelIndex) Description copied from interface:TableFilterReturns true if the there is a column filter on the column specified- Specified by:
hasColumnFilterin interfaceTableFilter<R>- Parameters:
columnModelIndex- the model index of the column to test for column filters.- Returns:
- true if the there is a column filter on the column specified.
-
getConstraintSets
Return the list of ConstraintSets in this TableFilter- Returns:
- the list of ConstraintSets in this TableFilter
-
save
Serializes this filter into a SaveState object.- Returns:
- the SaveState serialized version of this filter.
-
restore
Restore this filter from the given saveState.- Parameters:
saveState- that contains the serialized filter datadataSource- the Table's DataSource which some objects might need to restore themselves.
-
getHtmlRepresentation
Returns an HTML description of this filter.Note: the HTML string returned does NOT start with the HTML tag so that it can be combined with other text.
- Returns:
- an HTML description of this filter.
-
getToolTip
Return a tooltip that describes the effect of this filter for a specific filter.- Parameters:
columnIndex- the model index of the column to get a filter description of.- Returns:
- a tooltip that describes this filter for a specific column.
-
toString
-
hashCode
public int hashCode() -
equals
-
isEquivalent
Checks if the givenColumnBasedTableFilteris the same as this one except for its name.- Parameters:
other- the other filter to check for equivalence.- Returns:
- true if the other filter is the same as this one except for its name
-
isSaved
public boolean isSaved()Returns true if this filter has been saved (i.e. has a name)- Returns:
- true if this filter has been saved (i.e. has a name)
-