Class
caplin.grid.filter

FieldFilterExpression

Implementation of FilterExpression that represents a filter for a single field. When this is applied, only those records that match the specified criteria will be returned, those that don't are filtered out.

Field filter examples:

OperatorExample
{@link caplin.grid.filter.FieldFilterExpression.Operator#EQUAL EQUAL} Currency=USD Filters out all records that do not have a value of USD for their Currency field
{@link caplin.grid.filter.FieldFilterExpression.Operator#NOT_EQUAL NOT_EQUAL} Currency!=USD Filters out all records that have a value of USD for their Currency field
{@link caplin.grid.filter.FieldFilterExpression.Operator#GREATER_THAN GREATER_THAN} Bid>100 Filters out all records that do not have a value greater than 100 for their Bid field
{@link caplin.grid.filter.FieldFilterExpression.Operator#GREATER_THAN_OR_EQUAL GREATER_THAN_OR_EQUAL} Bid>=100 Filters out all records that do not have a value greater than or equal to 100 for their Bid field
{@link caplin.grid.filter.FieldFilterExpression.Operator#LESS_THAN LESS_THAN} Bid<100 Filters out all records that do not have a value less than 100 for their Bid field
{@link caplin.grid.filter.FieldFilterExpression.Operator#LESS_THAN_OR_EQUAL LESS_THAN_OR_EQUAL} Bid<=100 Filters out all records that do not have a value less than or equal to 100 for their Bid field
{@link caplin.grid.filter.FieldFilterExpression.Operator#REGULAR_EXPRESSION REGULAR_EXPRESSION} Currency~^(USD|EUR)$ Filters out all records that do not have a value of USD or EUR for their Currency field
{@link caplin.grid.filter.FieldFilterExpression.Operator#CASE_INSENSITIVE_REGULAR_EXPRESSION CASE_INSENSITIVE_REGULAR_EXPRESSION} Issuer#.*Gov.* Filters out all records that do not have a value that contains the text Gov, regardless of case, for their Issuer field

Constructor Summary

Attributes Name and Description
caplin.grid.filter.FieldFilterExpression(String name, String operator, String value, String (optional), String (optional))

Constructs a new FieldFilterExpression with the specified field name, operator and value.

Method Summary

Attributes Name and Description
String getFieldName()

Gets the field name which this filter applies to

String getFilterKey()

Returns a textual key that represents the operator used by this expression.

String getOperator()

Returns the operator

<static> String getOperatorForFieldKey( fieldKey)

Returns the FieldFilterExpression operator that relates to the given key.

String getRttpState()

Gets the serialized representation of this FieldFilterExpression which is understood by the Container Filtering Module used by Transformer.

String getSerializedState(String indent)

Gets the XML representation of this FieldFilterExpression that will be used to save it within a serialized component and/or layout.

String getUserInputtedValue()

Returns the value the user typed into the filter input box if this filter was created by user input.

String getValue()

Returns the value

boolean isMutuallyExclusiveWith(FieldFilterExpression filterExpression)

Indicates whether this filter is mutually exclusive with the given filter.

<static> boolean isValidFieldKey( fieldKey)

Indicates whether the given key maps to a valid FieldFilterExpression operator.

boolean matchesFilterKey( filterName)

Indicated whether this FieldFilterExpression matches the filter name given.

void setValue( value)

Sets the value

void toMap()

Construct map representing the filter.

String toString()

Gets a text representation of the field filter expression.

Constructor Detail

caplin.grid.filter.FieldFilterExpression(String name, String operator, String value, String (optional), String (optional))

Constructs a new FieldFilterExpression with the specified field name, operator and value.

Parameters
String name The name of the field to be filtered.
String operator The operator to be used for the filter. This must be one values defined by the caplin.grid.filter.FieldFilterExpression.Operator enumeration.
String value The value to be operated against.
String (optional) primaryFieldType The type of the field, can be used to set custom filter types.
String (optional) userInputtedValue The value the user typed into a filter input.
Throws
@link caplin.core.Error
if the specified field name or value parameters are null or undefined, or if the specified operator is illegal.

Method Detail

String getFieldName()

Gets the field name which this filter applies to

Returns
The field that this filter applies to

String getFilterKey()

Returns a textual key that represents the operator used by this expression.

Returns
The key that represents this expression's operator

String getOperator()

Returns the operator

Returns
The operator for this FieldFilterExpression

<static> String getOperatorForFieldKey( fieldKey)

Returns the FieldFilterExpression operator that relates to the given key. This is a compatibility function to provide a mapping between operators and GridColumnFilter filter names.

Parameters
fieldKey The filter key to map
Returns
The FieldFilterExpression operator

String getRttpState()

Gets the serialized representation of this FieldFilterExpression which is understood by the Container Filtering Module used by Transformer.

Returns
String A serialized representation of this expression.

String getSerializedState(String indent)

Gets the XML representation of this FieldFilterExpression that will be used to save it within a serialized component and/or layout.

Parameters
String indent The number of characters the caller would like the expression to indent the XML it returns to make it easily human readable.
Returns
String An XML representation of this expression.

String getUserInputtedValue()

Returns the value the user typed into the filter input box if this filter was created by user input. A RegExp string may be converted from what is seen in the GUI to a string containing ^.*& etc and the grid on deserializing will need the original value to place into the input box, this method provides it.

Returns
The user inputted value for this FieldFilterExpression.

String getValue()

Returns the value

Returns
The value for this FieldFilterExpression

boolean isMutuallyExclusiveWith(FieldFilterExpression filterExpression)

Indicates whether this filter is mutually exclusive with the given filter. Filters are mutually exclusive if they both share a mutually exclusive operator. The mutually exclusive operators are LESS THAN (OR EQUAL), GREATER THAN (OR EQUAL), EQUAL and NOT EQUAL.

Parameters
FieldFilterExpression filterExpression The filter to compare with this one
Returns
boolean if the filters have mutually exclusive operators, false otherwise

<static> boolean isValidFieldKey( fieldKey)

Indicates whether the given key maps to a valid FieldFilterExpression operator.

Parameters
fieldKey The filter key to check
Returns
True if the key is valid, false otherwise

boolean matchesFilterKey( filterName)

Indicated whether this FieldFilterExpression matches the filter name given. This is for backwards compatibility with GridColumnFilters.

Parameters
filterName The filter name to check
Returns
boolean if this filter matches, false otherwise

void setValue( value)

Sets the value

Parameters
value The new value for the filter

void toMap()

Construct map representing the filter. Used by InputControls

Returns
A map with low/high/regex/not/numberNot/value

String toString()

Gets a text representation of the field filter expression.

Returns
A text representation of the expression.