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
,EntityComboBoxModelConditionModel
,EntityListConditionModel
,EntitySearchModelConditionModel
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 aColumnConditionModel.Builder
viabuilder(Object, Class)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ColumnConditionModel.AutomaticWildcard
The possible automatic wildcard typesstatic interface
ColumnConditionModel.Builder<C,T>
Builds aColumnConditionModel
instance.
-
Field Summary
Fields Modifier and Type Field Description static PropertyValue<ColumnConditionModel.AutomaticWildcard>
AUTOMATIC_WILDCARD
Specifies whether wildcards are automatically added to string conditions by default
Value type:ColumnConditionModel.AutomaticWildcard
Default value:ColumnConditionModel.AutomaticWildcard.NONE
static PropertyValue<Boolean>
CASE_SENSITIVE
Specifies whether string based conditions are case-sensitive or not by default
Value type: Boolean
Default value: true
-
Method Summary
-
-
-
Field Detail
-
AUTOMATIC_WILDCARD
static final PropertyValue<ColumnConditionModel.AutomaticWildcard> AUTOMATIC_WILDCARD
Specifies whether wildcards are automatically added to string conditions by default
Value type:ColumnConditionModel.AutomaticWildcard
Default value:ColumnConditionModel.AutomaticWildcard.NONE
-
CASE_SENSITIVE
static final PropertyValue<Boolean> CASE_SENSITIVE
Specifies whether string based conditions are case-sensitive or not by default
Value type: Boolean
Default value: true
-
-
Method Detail
-
columnIdentifier
C columnIdentifier()
- Returns:
- the column identifier
-
caseSensitiveState
State caseSensitiveState()
- 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
-
automaticWildcardValue
Value<ColumnConditionModel.AutomaticWildcard> automaticWildcardValue()
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
-
autoEnableState
State autoEnableState()
- Returns:
- the
State
controlling whether this model is enabled automatically when a condition value is specified
-
setLocked
void setLocked(boolean locked)
- Parameters:
locked
- true to lock this model, false to unlock
-
isLocked
boolean isLocked()
- Returns:
- true if this model is locked
-
setEqualValue
void setEqualValue(T value)
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
void setEqualValues(Collection<T> values)
- Parameters:
values
- the values to set
-
getEqualValues
Collection<T> getEqualValues()
- Returns:
- the equal values, never null
-
setUpperBound
void setUpperBound(T upper)
- Parameters:
upper
- the new upper bound
-
getUpperBound
T getUpperBound()
- Returns:
- the upper bound
-
setLowerBound
void setLowerBound(T value)
- Parameters:
value
- the lower bound
-
getLowerBound
T getLowerBound()
- Returns:
- the lower bound
-
getOperator
Operator getOperator()
- Returns:
- the search operator
-
setOperator
void setOperator(Operator operator)
- Parameters:
operator
- the conditional operator- Throws:
IllegalArgumentException
- in case the given operator is not available in this condition model
-
wildcard
char wildcard()
- Returns:
- the character used as a wildcard when working with strings
-
isEnabled
boolean isEnabled()
- Returns:
- true if this condition model is enabled
-
setEnabled
void setEnabled(boolean enabled)
- Parameters:
enabled
- true to enable, false to disable
-
clearCondition
void clearCondition()
Disables and clears this condition model, that is, sets the upper and lower bounds to null and the operator to the default valueOperator.EQUAL
-
equalValueSet
ValueSet<T> equalValueSet()
- Returns:
- a ValueSet based on the equals values of this condition model
-
upperBoundValue
Value<T> upperBoundValue()
- Returns:
- a Value based on the upper bound value of this condition model
-
lowerBoundValue
Value<T> lowerBoundValue()
- Returns:
- a Value based on the lower bound value of this condition model
-
lockedObserver
StateObserver lockedObserver()
- Returns:
- an observer for this model's locked state
-
enabledState
State enabledState()
- Returns:
- a State controlling the enabled state
-
accepts
boolean accepts(Comparable<T> columnValue)
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
-
addEnabledListener
void addEnabledListener(EventListener listener)
- Parameters:
listener
- a listener to be notified each time the enabled state changes
-
removeEnabledListener
void removeEnabledListener(EventListener listener)
- Parameters:
listener
- the listener to remove
-
addOperatorListener
void addOperatorListener(EventDataListener<Operator> listener)
- Parameters:
listener
- a listener to be notified each time the operator changes
-
removeOperatorListener
void removeOperatorListener(EventDataListener<Operator> listener)
- Parameters:
listener
- the listener to remove
-
addEqualsValueListener
void addEqualsValueListener(EventListener listener)
- Parameters:
listener
- a listener to be notified each time the lower bound changes
-
removeEqualsValueListener
void removeEqualsValueListener(EventListener listener)
- Parameters:
listener
- the listener to remove
-
addLowerBoundListener
void addLowerBoundListener(EventListener listener)
- Parameters:
listener
- a listener to be notified each time the lower bound changes
-
removeLowerBoundListener
void removeLowerBoundListener(EventListener listener)
- Parameters:
listener
- the listener to remove
-
addUpperBoundListener
void addUpperBoundListener(EventListener listener)
- Parameters:
listener
- a listener to be notified each time the upper bound changes
-
removeUpperBoundListener
void removeUpperBoundListener(EventListener listener)
- Parameters:
listener
- the listener to remove
-
addClearedListener
void addClearedListener(EventListener listener)
- Parameters:
listener
- a listener to be notified each time the model is cleared
-
removeClearedListener
void removeClearedListener(EventListener listener)
- Parameters:
listener
- the listener to remove
-
addConditionChangedListener
void addConditionChangedListener(EventListener listener)
- Parameters:
listener
- a listener to be notified each time the condition state changes
-
removeConditionChangedListener
void removeConditionChangedListener(EventListener listener)
- Parameters:
listener
- the listener to remove
-
builder
static <C,T> ColumnConditionModel.Builder<C,T> builder(C columnIdentifier, Class<T> columnClass)
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
-
-