Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.exportto / org.gvsig.exportto.lib / org.gvsig.exportto.lib.api / src / main / java / org / gvsig / export / spi / AbstractExportServiceFactory.java @ 43925

History | View | Annotate | Download (1.27 KB)

1
package org.gvsig.export.spi;
2

    
3
import java.util.HashMap;
4
import java.util.Map;
5
import org.gvsig.tools.ToolsLocator;
6
import org.gvsig.tools.i18n.I18nManager;
7

    
8
/**
9
 *
10
 * @author jjdelcerro
11
 */
12
public abstract class AbstractExportServiceFactory implements ExportServiceFactory {
13

    
14
    private final String name;
15
    private final String description;
16

    
17
    private static final Map<ExportServiceFactory, Boolean>serviceEnabled = new HashMap<>();
18
    private final String label;
19

    
20
    public AbstractExportServiceFactory(
21
            String name,
22
            String label,
23
            String description
24
        ) {
25
        I18nManager i18n = ToolsLocator.getI18nManager();
26
        this.name = name;
27
        this.label = i18n.getTranslation(label);
28
        this.description = i18n.getTranslation(description);
29
    }
30

    
31
    @Override
32
    public String getName() {
33
        return name;
34
    }
35

    
36
    @Override
37
    public String getLabel() {
38
        return label;
39
    }
40
    
41
    @Override
42
    public String getDescription() {
43
        return description;
44
    }
45

    
46
    @Override
47
    public boolean isEnabled() {
48
        Boolean enabled = serviceEnabled.getOrDefault(this, true);
49
        return enabled;
50
    }
51

    
52
    @Override
53
    public void setEnabled(boolean value) {
54
        serviceEnabled.put(this, value);
55
    }
56
    
57
}