Skip to content
Snippets Groups Projects
Commit fb8236b7 authored by felmer's avatar felmer
Browse files

LMS-1186 use property data type for cell value type

SVN: 12702
parent 88af0f91
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,22 @@ public class EntityPropertyColDef<T extends IEntityPropertiesHolder> extends ...@@ -106,6 +106,22 @@ public class EntityPropertyColDef<T extends IEntityPropertiesHolder> extends
return null; return null;
} }
@Override
public Comparable<?> getComparableValue(T rowModel)
{
String valueAsString = tryGetValue(rowModel);
DataTypeCode dataType = propertyType.getDataType().getCode();
switch (dataType)
{
case INTEGER:
return valueAsString == null ? new Integer(Integer.MIN_VALUE) : new Integer(valueAsString);
case REAL:
return valueAsString == null ? new Double(-Double.MAX_VALUE) : new Double(valueAsString);
default:
return super.getComparableValue(rowModel);
}
}
public IEntityProperty tryGetProperty(T entity) public IEntityProperty tryGetProperty(T entity)
{ {
for (IEntityProperty prop : getProperties(entity)) for (IEntityProperty prop : getProperties(entity))
......
...@@ -55,14 +55,14 @@ public class FilterUtils ...@@ -55,14 +55,14 @@ public class FilterUtils
this.row = row; this.row = row;
} }
public String get(String columnID) public Object get(String columnID)
{ {
IColumnDefinition<T> columnDefinition = map.get(columnID); IColumnDefinition<T> columnDefinition = map.get(columnID);
if (columnDefinition == null) if (columnDefinition == null)
{ {
throw new IllegalArgumentException("Undefined column: " + columnID); throw new IllegalArgumentException("Undefined column: " + columnID);
} }
return columnDefinition.getValue(row); return columnDefinition.getComparableValue(row);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment