Skip to content
Permalink
Browse files

#1172 format numbers in thumbnail view

  • Loading branch information
haarli committed Dec 2, 2019
1 parent 6f4bb92 commit bca202e5aa135c57a7c31ec1487f1410fd2222c1
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/main/java/de/mpg/imeji/presentation/item/browse/ThumbnailBean.java
@@ -2,7 +2,9 @@

import java.io.Serializable;
import java.net.URI;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

import javax.faces.event.ValueChangeEvent;
@@ -104,8 +106,12 @@ public void initPath(HierarchyService service) {
private final String value;

public SimpleMetadata(Metadata metadata) {
NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH);
nf.setMinimumFractionDigits(0);
nf.setMaximumFractionDigits(999999999);
nf.setGroupingUsed(false);
this.name = metadata.getIndex();
this.value = metadata.getText() + metadata.getName() + (!Double.isNaN(metadata.getNumber()) ? metadata.getNumber() : "")
this.value = metadata.getText() + metadata.getName() + (!Double.isNaN(metadata.getNumber()) ? nf.format(metadata.getNumber()) : "")
+ metadata.getDate() + (metadata.getPerson() != null ? metadata.getPerson().getCompleteNameWithOrga() : "")
+ (StringHelper.isNullOrEmptyTrim(metadata.getUrl()) ? metadata.getTitle() : metadata.getUrl())
+ (!Double.isNaN(metadata.getLongitude()) ? " (" + metadata.getLongitude() + "/" + metadata.getLatitude() + ")" : "");

0 comments on commit bca202e

Please sign in to comment.
You can’t perform that action at this time.