X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/e5dadfea18f8c634578e1e008ad0312b05687ac2..cf3b8a2b6f8d0b31a62b23a5b7efe98f803dd3bf:/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java index 34d696947..909d80fe3 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java @@ -9,16 +9,16 @@ package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix; import java.util.Set; -import java.util.stream.Collectors; + +import org.eclipse.swt.graphics.Image; import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO; -import eu.etaxonomy.cdm.model.common.MarkerType; +import eu.etaxonomy.cdm.model.description.DescriptionType; import eu.etaxonomy.cdm.model.description.DescriptiveDataSet; import eu.etaxonomy.cdm.model.description.Feature; -import eu.etaxonomy.cdm.model.description.QuantitativeData; -import eu.etaxonomy.cdm.model.description.StatisticalMeasure; import eu.etaxonomy.cdm.model.taxon.Classification; import eu.etaxonomy.cdm.model.taxon.TaxonNode; +import eu.etaxonomy.taxeditor.model.ImageResources; /** * Utility class for the character matrix editor @@ -37,26 +37,6 @@ public class MatrixUtility { return feature.getLabel(); } - /** - * Returns a string representation for the given {@link QuantitativeData} - * @param data the quantitative data - * @return a string representation of the data - */ - public static String getQuantitativeLabel(QuantitativeData data) { - String label = ""; - Float min = data.getMin(); - Float max = data.getMax(); - if(min!=null||max!=null){ - label += "["+(min!=null?min.toString():"?")+"-"+(max!=null?max.toString():"?")+"] "; - } - label += data.getStatisticalValues().stream(). - filter(value->value.getType().equals(StatisticalMeasure.EXACT_VALUE())) - .map(exact->Float.toString(exact.getValue())) - .collect(Collectors.joining(", ")); - - return label; - } - /** * Returns a string representation for the given min/max values * @param minTotal the min value @@ -78,20 +58,32 @@ public class MatrixUtility { } public static boolean isDefaultTaxonDescription(TaxonRowWrapperDTO taxonRowWrapperDTO){ - return hasMarker(taxonRowWrapperDTO, MarkerType.USE()); + return hasType(taxonRowWrapperDTO, DescriptionType.DEFAULT_VALUES_FOR_AGGREGATION); } public static boolean isAggregatedTaxonDescription(TaxonRowWrapperDTO taxonRowWrapperDTO){ - return hasMarker(taxonRowWrapperDTO, MarkerType.COMPUTED()); + return hasType(taxonRowWrapperDTO, DescriptionType.AGGREGATED_STRUC_DESC); } public static boolean isLiteratureTaxonDescription(TaxonRowWrapperDTO taxonRowWrapperDTO){ - return hasMarker(taxonRowWrapperDTO, MarkerType.IN_BIBLIOGRAPHY()); + return hasType(taxonRowWrapperDTO, DescriptionType.SECONDARY_DATA); + } + + private static boolean hasType(TaxonRowWrapperDTO taxonRowWrapperDTO, DescriptionType descriptionType){ + return taxonRowWrapperDTO.getDescription().getDescription().getTypes().stream() + .anyMatch(type->type.equals(descriptionType)); + } + + public static Image getLiteratureDescriptionIcon() { + return ImageResources.getImage(ImageResources.HELP_TOPIC); + } + + public static Image getAggregatedDescriptionIcon() { + return ImageResources.getImage(ImageResources.FUNNEL_ICON); } - private static boolean hasMarker(TaxonRowWrapperDTO taxonRowWrapperDTO, MarkerType markerType){ - return taxonRowWrapperDTO.getDescription().getMarkers().stream() - .anyMatch(marker->marker.getMarkerType().equals(markerType)); + public static Image getDefaultDescriptionIcon() { + return ImageResources.getImage(ImageResources.VALIDATE_ICON); } }