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.component.registration;
|
10
|
|
11
|
|
12
|
import static eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles.STYLE_LABEL_NOWRAP;
|
13
|
|
14
|
import org.apache.commons.lang.StringUtils;
|
15
|
|
16
|
import com.vaadin.server.FontAwesome;
|
17
|
import com.vaadin.shared.ui.label.ContentMode;
|
18
|
import com.vaadin.ui.Label;
|
19
|
|
20
|
import eu.etaxonomy.cdm.mock.RegistrationStatus;
|
21
|
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationType;
|
22
|
|
23
|
/**
|
24
|
* @author a.kohlbecker
|
25
|
* @since Mar 30, 2017
|
26
|
*
|
27
|
*/
|
28
|
public class TypeStateLabel extends Label {
|
29
|
|
30
|
|
31
|
/**
|
32
|
*
|
33
|
*/
|
34
|
private static final long serialVersionUID = -7462726193336938780L;
|
35
|
|
36
|
/**
|
37
|
*
|
38
|
*/
|
39
|
public TypeStateLabel() {
|
40
|
setStyleName(STYLE_LABEL_NOWRAP);
|
41
|
}
|
42
|
|
43
|
/**
|
44
|
*
|
45
|
*/
|
46
|
public TypeStateLabel update(RegistrationType type, RegistrationStatus status) {
|
47
|
|
48
|
FontAwesome icon;
|
49
|
if(type.equals(RegistrationType.NAME)) {
|
50
|
icon = FontAwesome.TAG;
|
51
|
} else if(type.equals(RegistrationType.TYPIFICATION)) {
|
52
|
icon = FontAwesome.TAGS;
|
53
|
} else {
|
54
|
icon = FontAwesome.WARNING;
|
55
|
}
|
56
|
setContentMode(ContentMode.HTML);
|
57
|
setValue(icon.getHtml() + " " + StringUtils.capitalize((status.name().toLowerCase())));
|
58
|
addStyleName("status-" + status.name());
|
59
|
return this;
|
60
|
}
|
61
|
|
62
|
|
63
|
|
64
|
|
65
|
}
|