import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
+import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
import eu.etaxonomy.cdm.model.description.Feature;
/**
* @since Nov 26, 2017
*
*/
-public class SpecimenColumnPropertyAccessor implements IColumnPropertyAccessor<RowWrapperDTO>{
+public class SpecimenColumnPropertyAccessor implements IColumnPropertyAccessor<Object>{
private CharacterMatrix matrix;
* {@inheritDoc}
*/
@Override
- public Object getDataValue(RowWrapperDTO rowObject, int columnIndex) {
+ public Object getDataValue(Object rowObject, int columnIndex) {
if(rowObject instanceof SpecimenRowWrapperDTO){
SpecimenRowWrapperDTO rowWrapper = (SpecimenRowWrapperDTO) rowObject;
switch (columnIndex) {
}
Feature feature = matrix.getIndexToFeatureMap().get(columnIndex);
return rowWrapper.getDataValueForFeature(feature);
- } else if (columnIndex == 0) {
+ } else if(rowObject instanceof TaxonRowWrapperDTO){
+ TaxonRowWrapperDTO taxonWrapper = (TaxonRowWrapperDTO)rowObject;
+ if(columnIndex==0){
+ return taxonWrapper.getDescription();
+ }
+ Feature feature = matrix.getIndexToFeatureMap().get(columnIndex);
+ return taxonWrapper.getDataValueForFeature(feature);
+
+ }
+ else if (columnIndex == 0) {
return rowObject;
}
return null;
* {@inheritDoc}
*/
@Override
- public void setDataValue(RowWrapperDTO rowObject, int columnIndex, Object newValue) {
- RowWrapperDTO rowWrapper = rowObject;
- Feature feature = matrix.getIndexToFeatureMap().get(columnIndex);
- rowWrapper.setDataValueForFeature(feature, newValue);
+ public void setDataValue(Object rowObject, int columnIndex, Object newValue) {
+ if(rowObject instanceof RowWrapperDTO){
+ RowWrapperDTO rowWrapper = (RowWrapperDTO)rowObject;
+ Feature feature = matrix.getIndexToFeatureMap().get(columnIndex);
+ rowWrapper.setDataValueForFeature(feature, newValue);
+ }
}
/**