Skip to content

Commit

Permalink
adapt ViewExcelExporter to AbstractExcelExporter.getValueAt changes
Browse files Browse the repository at this point in the history
i.e. return CellValue instead of Object

#608
  • Loading branch information
teosarca committed Sep 22, 2017
1 parent d111d83 commit aa233cc
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/java/de/metas/ui/web/view/ViewExcelExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import org.adempiere.exceptions.AdempiereException;
import org.adempiere.impexp.AbstractExcelExporter;
import org.adempiere.impexp.CellValue;
import org.adempiere.impexp.CellValues;

import com.google.common.collect.ImmutableList;

Expand Down Expand Up @@ -162,7 +164,7 @@ public int getDisplayType(final int rowIndex_NOTUSED, final int columnIndex)
}

@Override
public Object getValueAt(final int rowIndex, final int columnIndex)
public CellValue getValueAt(final int rowIndex, final int columnIndex)
{
final String fieldName = getFieldName(columnIndex);

Expand All @@ -181,14 +183,17 @@ public Object getValueAt(final int rowIndex, final int columnIndex)
final DocumentFieldWidgetType widgetType = getWidgetType(columnIndex);
if (widgetType.isDateOrTime())
{
return JSONDate.fromJson(value.toString(), widgetType);
return CellValue.ofDate(JSONDate.fromJson(value.toString(), widgetType));
}
else if (value instanceof JSONLookupValue)
{
return ((JSONLookupValue)value).getName();
final String valueStr = ((JSONLookupValue)value).getName();
return CellValues.toCellValue(valueStr, widgetType.getDisplayType());
}
else
{
return CellValues.toCellValue(value, widgetType.getDisplayType());
}

return value;
}

@Override
Expand Down

0 comments on commit aa233cc

Please sign in to comment.