Project

General

Profile

Download (1.32 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2018 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.FontAwesome;
12
import com.vaadin.server.FontIcon;
13

    
14
/**
15
 * @author a.kohlbecker
16
 * @since Jul 6, 2018
17
 *
18
 */
19
public enum ButtonFactory {
20

    
21
    CREATE_NEW("New", FontIcons.ICON_CREATE_NEW),
22
    DELETE("Delete", FontAwesome.TRASH),
23
    EDIT_ITEM("Edit", FontAwesome.EDIT),
24
    ADD_ITEM("Add item", FontAwesome.PLUS),
25
    REMOVE_ITEM("Remove item", FontAwesome.MINUS),
26
    REMOVE_ALL_ITEMS("Remove", FontAwesome.REMOVE);
27

    
28
    private String description;
29
    private FontIcon icon;
30

    
31
    ButtonFactory(String description, FontIcon icon){
32
        this.description  = description;
33
        this.icon = icon;
34
    }
35

    
36

    
37
    /**
38
     * @return the description
39
     */
40
    public String getDescription() {
41
        return description;
42
    }
43

    
44
    /**
45
     * @return the icon
46
     */
47
    public FontIcon getIcon() {
48
        return icon;
49
    }
50

    
51
    public com.vaadin.ui.Button createButton(){
52
        com.vaadin.ui.Button button = new com.vaadin.ui.Button(icon);
53
        button.setDescription(description);
54
        return button;
55
    }
56

    
57
}
(1-1/11)