M
- the model in the store and in each grid rowV
- the numeric type in the column to filterpublic class NumericFilter<M,V extends Number> extends Filter<M,V>
double
before comparing, but this behavior can
be change by overriding equals(Number, Number)
and greaterThan(Number, Number)
. See Filter
for more information.Modifier and Type | Class and Description |
---|---|
class |
NumericFilter.DefaultNumericFilterMessages
The default locale-sensitive messages used by this class.
|
static interface |
NumericFilter.NumericFilterMessages
The locale-sensitive messages used by this class.
|
Constructor and Description |
---|
NumericFilter(ValueProvider<? super M,V> valueProvider,
NumberPropertyEditor<V> propertyEditor)
Creates a numeric filter for the specified value provider.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
equals(V a,
V b)
Compares the two values for equality.
|
List<FilterConfig> |
getFilterConfig()
Returns a list of filter configurations.
|
NumericFilter.NumericFilterMessages |
getMessages()
Returns the locale-sensitive messages used by this class.
|
protected NumberPropertyEditor<V> |
getPropertyEditor() |
protected Class<V> |
getType() |
Object |
getValue()
Template method to be implemented by all subclasses that is to get and return the value of the filter.
|
int |
getWidth()
Returns the width used for the range sub-menu.
|
protected boolean |
greaterThan(V a,
V b)
Compares the values given, and returns true if the first is greater than the second.
|
boolean |
isActivatable()
Template method to be implemented by all subclasses that is to return
true if the filter has enough
configuration information to be activated. |
void |
setEqualValue(V value)
Sets the equal value.
|
void |
setFilterConfig(List<FilterConfig> configs)
Sets the filters values using the given filter configs.
|
void |
setGreaterThanValue(V value)
Sets the greater than value.
|
void |
setLessThanValue(V value)
Sets the less than value.
|
void |
setMessages(NumericFilter.NumericFilterMessages messages) |
void |
setValue(List<FilterConfig> values) |
void |
setWidth(int width)
Sets the width to use for the range sub-menu (defaults to 125).
|
protected boolean |
validateModel(M model)
Template method to be implemented by all subclasses that is to validates the provided Model against the filters
configuration.
|
addActivateHandler, addDeactivateHandler, addUpdateHandler, createNewFilterConfig, fireUpdate, getHandler, getMenu, getUpdateBuffer, getValueProvider, isActive, setActive, setHandler, setUpdateBuffer
public NumericFilter(ValueProvider<? super M,V> valueProvider, NumberPropertyEditor<V> propertyEditor)
Filter.Filter(ValueProvider)
for more
information.valueProvider
- the value providerpropertyEditor
- property editor for numeric type <V>
public void setLessThanValue(V value)
value
- the valuepublic void setGreaterThanValue(V value)
value
- the valuepublic void setEqualValue(V value)
value
- the equal valuepublic void setValue(List<FilterConfig> values)
public List<FilterConfig> getFilterConfig()
Filter
getFilterConfig
in class Filter<M,V extends Number>
public NumericFilter.NumericFilterMessages getMessages()
public Object getValue()
Filter
public int getWidth()
public boolean isActivatable()
Filter
true
if the filter has enough
configuration information to be activated.isActivatable
in class Filter<M,V extends Number>
public void setMessages(NumericFilter.NumericFilterMessages messages)
public void setWidth(int width)
width
- the width used for the range sub-menu.protected boolean equals(V a, V b)
return Math.abs(modelValue.doubleValue() - filterValue.doubleValue()) < epsilon * modelValue.doubleValue();
where epsilon
would represent the magnitude of difference between the two values. If the magnitude of the
values is known, this could instead be
return Math.abs(modelValue.doubleValue() - filterValue.doubleValue()) < epsilon;
where epsilon
is instead the maximum difference
allowed.a
- b
- protected NumberPropertyEditor<V> getPropertyEditor()
protected boolean greaterThan(V a, V b)
double
before comparing.a
- b
- protected boolean validateModel(M model)
Filter
validateModel
in class Filter<M,V extends Number>
model
- the modelpublic void setFilterConfig(List<FilterConfig> configs)
Filter
setFilterConfig
in class Filter<M,V extends Number>
configs
- the list of filter configurationsCopyright © 2018. All rights reserved.