Package docking.widgets.table.constraint
Class StringColumnConstraint
- java.lang.Object
-
- docking.widgets.table.constraint.StringColumnConstraint
-
- All Implemented Interfaces:
ColumnConstraint<java.lang.String>
,java.lang.Comparable<ColumnConstraint<java.lang.String>>
- Direct Known Subclasses:
StringContainsColumnConstraint
,StringEndsWithColumnConstraint
,StringMatcherColumnConstraint
,StringStartsWithColumnConstraint
public abstract class StringColumnConstraint extends java.lang.Object implements ColumnConstraint<java.lang.String>
Base class for various String constraints.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.regex.Pattern
matchesPattern
-
Constructor Summary
Constructors Modifier Constructor Description protected
StringColumnConstraint(java.lang.String patternString)
Constructs a new StringColumnConstraint using the given pattern and patternString, using the default hint text that explains that you can use globbing characters.protected
StringColumnConstraint(java.lang.String patternString, java.lang.String errorMessage)
Constructs a new StringColumnConstraint using the given pattern and patternString.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
accepts(java.lang.String value, TableFilterContext context)
Compares value against the current constraint value to determine acceptance; true if value satisfies the constraints' value, false otherwiseabstract ColumnConstraint<java.lang.String>
copy(java.lang.String newPatternString)
subclasses must override to generate new versions of themselves but with a new pattern string.boolean
equals(java.lang.Object o)
protected java.util.regex.Pattern
generateFindsPattern()
protected abstract java.util.regex.Pattern
generateMatchesPattern(java.lang.String value)
java.lang.Class<java.lang.String>
getColumnType()
Returns the column type that this constraint can be used to filter.java.lang.String
getConstraintValueString()
Returns the "value" of the constraint in string formjava.lang.String
getConstraintValueTooltip()
returns a description of the constraint suitable for displaying in a tooltipColumnConstraintEditor<java.lang.String>
getEditor(ColumnData<java.lang.String> columnDataSource)
Returns a ColumnConstraintEditor which will provide gui components for users to edit the constraint values.java.lang.String
getGroup()
Returns a "group" string that is used to logically group column constraints for presentation to the userjava.util.regex.Matcher
getHighlightMatcher(java.lang.String value)
java.lang.String
getPatternString()
Returns the pattern string for this constraint.int
hashCode()
boolean
isValidPatternString(java.lang.String value)
ColumnConstraint<java.lang.String>
parseConstraintValue(java.lang.String newValue, java.lang.Object dataSource)
Parses the constraint value string for deserialization purposes.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface docking.widgets.table.constraint.ColumnConstraint
asString, compareTo, getName
-
-
-
-
Constructor Detail
-
StringColumnConstraint
protected StringColumnConstraint(java.lang.String patternString, java.lang.String errorMessage)
Constructs a new StringColumnConstraint using the given pattern and patternString.- Parameters:
patternString
- the user entered string to form the pattern used to accept column values.errorMessage
- the text to display in an empty editor textfield.
-
StringColumnConstraint
protected StringColumnConstraint(java.lang.String patternString)
Constructs a new StringColumnConstraint using the given pattern and patternString, using the default hint text that explains that you can use globbing characters.- Parameters:
patternString
- the user entered string to form the pattern used to accept column values.
-
-
Method Detail
-
getGroup
public java.lang.String getGroup()
Description copied from interface:ColumnConstraint
Returns a "group" string that is used to logically group column constraints for presentation to the user- Specified by:
getGroup
in interfaceColumnConstraint<java.lang.String>
- Returns:
- the group this constraint belongs to.
-
accepts
public boolean accepts(java.lang.String value, TableFilterContext context)
Description copied from interface:ColumnConstraint
Compares value against the current constraint value to determine acceptance; true if value satisfies the constraints' value, false otherwise- Specified by:
accepts
in interfaceColumnConstraint<java.lang.String>
- Parameters:
value
- the column value to be tested.context
- provides additional information about the the table and its data. This allows the filter to base its decision on information other than just the column value.- Returns:
- true if the column value passes the constraint, false otherwise
-
generateMatchesPattern
protected abstract java.util.regex.Pattern generateMatchesPattern(java.lang.String value)
-
generateFindsPattern
protected java.util.regex.Pattern generateFindsPattern()
-
getEditor
public ColumnConstraintEditor<java.lang.String> getEditor(ColumnData<java.lang.String> columnDataSource)
Description copied from interface:ColumnConstraint
Returns a ColumnConstraintEditor which will provide gui components for users to edit the constraint values.- Specified by:
getEditor
in interfaceColumnConstraint<java.lang.String>
- Parameters:
columnDataSource
- This provides the constraint with access to the column data in the table model as well as the DataProvider of the table (if it has one)- Returns:
- A columnConstraintEditor for editing the constraints value.
-
copy
public abstract ColumnConstraint<java.lang.String> copy(java.lang.String newPatternString)
subclasses must override to generate new versions of themselves but with a new pattern string.- Parameters:
newPatternString
- the new string to use for creating the match pattern.- Returns:
- a new ColumnConstraint that is the same type as this constraint but with a new range defined.
-
getPatternString
public java.lang.String getPatternString()
Returns the pattern string for this constraint.- Returns:
- the pattern string for this constraint.
-
getColumnType
public java.lang.Class<java.lang.String> getColumnType()
Description copied from interface:ColumnConstraint
Returns the column type that this constraint can be used to filter.- Specified by:
getColumnType
in interfaceColumnConstraint<java.lang.String>
- Returns:
- the column type
-
getConstraintValueTooltip
public java.lang.String getConstraintValueTooltip()
Description copied from interface:ColumnConstraint
returns a description of the constraint suitable for displaying in a tooltip- Specified by:
getConstraintValueTooltip
in interfaceColumnConstraint<java.lang.String>
- Returns:
- a description of the constraint.
-
getConstraintValueString
public java.lang.String getConstraintValueString()
Description copied from interface:ColumnConstraint
Returns the "value" of the constraint in string formThis is used for serializing the constraint.
- Specified by:
getConstraintValueString
in interfaceColumnConstraint<java.lang.String>
- Returns:
- the "value" of the constraint in string form.
-
parseConstraintValue
public ColumnConstraint<java.lang.String> parseConstraintValue(java.lang.String newValue, java.lang.Object dataSource)
Description copied from interface:ColumnConstraint
Parses the constraint value string for deserialization purposes.- Specified by:
parseConstraintValue
in interfaceColumnConstraint<java.lang.String>
- Parameters:
newValue
- the value of the constraint in string form.dataSource
- the DataSource from the Table.- Returns:
- a new ColumnConstraint
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
getHighlightMatcher
public java.util.regex.Matcher getHighlightMatcher(java.lang.String value)
-
isValidPatternString
public boolean isValidPatternString(java.lang.String value)
-
-