1
|
/**
|
2
|
* Copyright (C) 2019 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;
|
10
|
|
11
|
import com.vaadin.server.Resource;
|
12
|
import com.vaadin.ui.Button;
|
13
|
|
14
|
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles;
|
15
|
|
16
|
/**
|
17
|
* A button with badge. The caption of the Button is shown inside the badge.
|
18
|
*
|
19
|
* @author a.kohlbecker
|
20
|
* @since Feb 7, 2019
|
21
|
*
|
22
|
*/
|
23
|
public class BadgeButton extends Button {
|
24
|
|
25
|
private static final long serialVersionUID = -6408645355930129935L;
|
26
|
|
27
|
String badgeCaption = null;
|
28
|
|
29
|
|
30
|
/**
|
31
|
*
|
32
|
*/
|
33
|
public BadgeButton() {
|
34
|
super();
|
35
|
setCaptionAsHtml(true);
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* @param icon
|
40
|
*/
|
41
|
public BadgeButton(Resource icon) {
|
42
|
super(icon);
|
43
|
}
|
44
|
|
45
|
/**
|
46
|
* @param caption
|
47
|
* @param listener
|
48
|
*/
|
49
|
public BadgeButton(String caption, ClickListener listener) {
|
50
|
super(caption, listener);
|
51
|
}
|
52
|
|
53
|
/**
|
54
|
* @param caption
|
55
|
* @param icon
|
56
|
*/
|
57
|
public BadgeButton(String caption, Resource icon) {
|
58
|
super(caption, icon);
|
59
|
}
|
60
|
|
61
|
/**
|
62
|
* @param caption
|
63
|
*/
|
64
|
public BadgeButton(String caption) {
|
65
|
super(caption);
|
66
|
}
|
67
|
|
68
|
@Override
|
69
|
public String getCaption() {
|
70
|
return badgeCaption;
|
71
|
}
|
72
|
|
73
|
@Override
|
74
|
public void setCaption(String caption) {
|
75
|
setCaptionAsHtml(true);
|
76
|
super.setCaption("<span class=\"" + RegistrationStyles.BUTTON_BADGE +"\"> " + caption + "</span>");
|
77
|
}
|
78
|
|
79
|
|
80
|
|
81
|
}
|