Module is.codion.common.model
Package is.codion.common.model.table
Interface ColumnConditionModel<C,T>
- Type Parameters:
C
- the type used to identify columnsT
- the column value type
- All Known Implementing Classes:
AbstractForeignKeyConditionModel
,EntityComboBoxConditionModel
,EntitySearchConditionModel
public interface ColumnConditionModel<C,T>
Specifies a condition model based on a table column, parameters, operator, upper bound and lower bound,
as well as relevant events and states.
For instances create a
ColumnConditionModel.Builder
via builder(Object, Class)
.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
The possible automatic wildcard typesstatic interface
Builds aColumnConditionModel
instance.static interface
Responsible for creatingColumnConditionModel
instances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<ColumnConditionModel.AutomaticWildcard>
Specifies whether wildcards are automatically added to string conditions by default
Value type:ColumnConditionModel.AutomaticWildcard
Default value:ColumnConditionModel.AutomaticWildcard.POSTFIX
static final PropertyValue<Boolean>
Specifies whether string based conditions are case-sensitive or not by default
Value type: Boolean
Default value: false -
Method Summary
Modifier and TypeMethodDescriptionboolean
accepts
(Comparable<T> columnValue) Returns true if this model is enabled and the given value is accepted by this models condition.void
addChangeListener
(Runnable listener) Note that this is only applicable to string based condition models and only used for operatorsOperator.EQUAL
andOperator.NOT_EQUAL
static <C,
T> ColumnConditionModel.Builder<C, T> Returns a newColumnConditionModel.Builder
instance.static String
void
clear()
Disables and clears this condition model, that is, sets the upper and lower bounds to null and the operator to the default valueOperator.EQUAL
enabled()
format()
locked()
operator()
void
removeChangeListener
(Runnable listener) void
setEqualValue
(T value) Sets the values used when theOperator.EQUAL
is enabled.void
setEqualValues
(Collection<T> values) void
setLowerBound
(T value) void
setUpperBound
(T upper) char
wildcard()
-
Field Details
-
AUTOMATIC_WILDCARD
Specifies whether wildcards are automatically added to string conditions by default
Value type:ColumnConditionModel.AutomaticWildcard
Default value:ColumnConditionModel.AutomaticWildcard.POSTFIX
-
CASE_SENSITIVE
Specifies whether string based conditions are case-sensitive or not by default
Value type: Boolean
Default value: false
-
-
Method Details
-
columnIdentifier
C columnIdentifier()- Returns:
- the column identifier
-
caseSensitive
State caseSensitive()- Returns:
- the State controlling whether this model is case-sensitive, when working with strings
-
format
Format format()- Returns:
- the Format object to use when formatting input, if any
-
dateTimePattern
String dateTimePattern()- Returns:
- the date/time format pattern, if any
-
automaticWildcard
Value<ColumnConditionModel.AutomaticWildcard> automaticWildcard()Note that this is only applicable to string based condition models and only used for operatorsOperator.EQUAL
andOperator.NOT_EQUAL
- Returns:
- the Value controlling whether automatic wildcards are enabled when working with strings
-
autoEnable
State autoEnable()- Returns:
- the
State
controlling whether this model is enabled automatically when a condition value is specified
-
locked
State locked()- Returns:
- the state controlling the locked status
-
columnClass
- Returns:
- the column class this condition model is based on
-
setEqualValue
Sets the values used when theOperator.EQUAL
is enabled.- Parameters:
value
- the value to use as condition
-
getEqualValue
T getEqualValue()- Returns:
- the equal value, possibly null
-
setEqualValues
- Parameters:
values
- the values to set
-
getEqualValues
Collection<T> getEqualValues()- Returns:
- the equal values, never null
-
setUpperBound
- Parameters:
upper
- the new upper bound
-
getUpperBound
T getUpperBound()- Returns:
- the upper bound
-
setLowerBound
- Parameters:
value
- the lower bound
-
getLowerBound
T getLowerBound()- Returns:
- the lower bound
-
operators
- Returns:
- the operators available in this condition model
-
wildcard
char wildcard()- Returns:
- the character used as a wildcard when working with strings
-
enabled
State enabled()- Returns:
- a state controlling the enabled status
-
clear
void clear()Disables and clears this condition model, that is, sets the upper and lower bounds to null and the operator to the default valueOperator.EQUAL
-
equalValues
- Returns:
- a ValueSet based on the equals values of this condition model
-
upperBoundValue
- Returns:
- a Value based on the upper bound value of this condition model
-
lowerBoundValue
- Returns:
- a Value based on the lower bound value of this condition model
-
operator
- Returns:
- a Value based on the operator
-
accepts
Returns true if this model is enabled and the given value is accepted by this models condition.- Parameters:
columnValue
- the column value- Returns:
- true if this model is enabled and the given value is accepted by this models condition
-
addChangeListener
- Parameters:
listener
- a listener to be notified each time the condition state changes
-
removeChangeListener
- Parameters:
listener
- the listener to remove
-
builder
Returns a newColumnConditionModel.Builder
instance.- Type Parameters:
C
- the column identifier typeT
- the column value type- Parameters:
columnIdentifier
- the column identifiercolumnClass
- the column class- Returns:
- a new
ColumnConditionModel.Builder
instance
-
caption
- Parameters:
operator
- the operator- Returns:
- a caption for the given operator
-