1
|
/**
|
2
|
* Copyright (C) 2017 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.vaadin.util;
|
10
|
|
11
|
import java.util.Objects;
|
12
|
|
13
|
import org.vaadin.viritin.fields.CaptionGenerator;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.occurrence.Collection;
|
16
|
|
17
|
/**
|
18
|
* @author a.kohlbecker
|
19
|
*
|
20
|
*/
|
21
|
public final class CollectionCaptionGenerator implements CaptionGenerator<Collection> {
|
22
|
|
23
|
private static final long serialVersionUID = 3151383366731447990L;
|
24
|
|
25
|
public CollectionCaptionGenerator(){
|
26
|
}
|
27
|
|
28
|
@Override
|
29
|
public String getCaption(Collection option) {
|
30
|
String caption = Objects.toString(option.getCode(), "");
|
31
|
option.getTitleCache();
|
32
|
if(option.getInstitute() != null){
|
33
|
caption += (caption.isEmpty() ? "" : " - ") + option.getInstitute().getTitleCache();
|
34
|
}
|
35
|
return caption;
|
36
|
}
|
37
|
}
|