Package docking.widgets.table.constraint
Class MappedColumnConstraint<T,M>
- java.lang.Object
-
- docking.widgets.table.constraint.MappedColumnConstraint<T,M>
-
- Type Parameters:
T
- The column typeM
- the converted (mapped) type
- All Implemented Interfaces:
ColumnConstraint<T>
,java.lang.Comparable<ColumnConstraint<T>>
public class MappedColumnConstraint<T,M> extends java.lang.Object implements ColumnConstraint<T>
Class that maps one type of column constraint into another. Typically, these are created automatically based onColumnTypeMapper
that are discovered by the system. For example, if you have a column type of "Foo", and you create a ColumnTypeMapper<Foo, String>, then all the string constraints would now be available that column.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MappedColumnConstraint.DelegateColumnData
Class for converting a ColumnDataSource<T> to a ColumnDataSource<W> to be used when getting the editor for the delegateColumnConstraint<W>.
-
Constructor Summary
Constructors Constructor Description MappedColumnConstraint(ColumnTypeMapper<T,M> mapper, ColumnConstraint<M> delegate)
Constructs a new Mapped ColumnConstraint
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(T value, TableFilterContext context)
Compares value against the current constraint value to determine acceptance; true if value satisfies the constraints' value, false otherwiseColumnConstraint<T>
copy(ColumnConstraint<M> newDelegate)
Creates a copy of this class using the same mapper but with a different mapped delegate.boolean
equals(java.lang.Object obj)
java.lang.Class<T>
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 formColumnConstraint<M>
getDelegate()
Returns the delegate constraint (current value for this mapped constraint)ColumnConstraintEditor<T>
getEditor(ColumnData<T> 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.lang.String
getName()
Returns the name of the constraintint
hashCode()
ColumnConstraint<T>
parseConstraintValue(java.lang.String valueString, 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, getConstraintValueTooltip
-
-
-
-
Constructor Detail
-
MappedColumnConstraint
public MappedColumnConstraint(ColumnTypeMapper<T,M> mapper, ColumnConstraint<M> delegate)
Constructs a new Mapped ColumnConstraint- Parameters:
mapper
- a mapper from from the column type to a mapped type.delegate
- the column constraint of the mapped type.
-
-
Method Detail
-
accepts
public boolean accepts(T 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<T>
- 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
-
getName
public java.lang.String getName()
Description copied from interface:ColumnConstraint
Returns the name of the constraint- Specified by:
getName
in interfaceColumnConstraint<T>
- Returns:
- the name of the constraint.
-
getColumnType
public java.lang.Class<T> getColumnType()
Description copied from interface:ColumnConstraint
Returns the column type that this constraint can be used to filter.- Specified by:
getColumnType
in interfaceColumnConstraint<T>
- Returns:
- the column type
-
getEditor
public ColumnConstraintEditor<T> getEditor(ColumnData<T> 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<T>
- 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.
-
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<T>
- Returns:
- the group this constraint belongs to.
-
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<T>
- Returns:
- the "value" of the constraint in string form.
-
parseConstraintValue
public ColumnConstraint<T> parseConstraintValue(java.lang.String valueString, java.lang.Object dataSource)
Description copied from interface:ColumnConstraint
Parses the constraint value string for deserialization purposes.- Specified by:
parseConstraintValue
in interfaceColumnConstraint<T>
- Parameters:
valueString
- the value of the constraint in string form.dataSource
- the DataSource from the Table.- Returns:
- a new ColumnConstraint
-
copy
public ColumnConstraint<T> copy(ColumnConstraint<M> newDelegate)
Creates a copy of this class using the same mapper but with a different mapped delegate.- Parameters:
newDelegate
- the new M type delegate column constraint.- Returns:
- a copy of this class using the same mapper but with a different mapped delegate.
-
getDelegate
public ColumnConstraint<M> getDelegate()
Returns the delegate constraint (current value for this mapped constraint)- Returns:
- the delegate constraint.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-