Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / actioninfo / impl / TranslatedActionInfo.java @ 42161

History | View | Annotate | Download (3.67 KB)

1
package org.gvsig.andami.actioninfo.impl;
2

    
3
import java.awt.event.ActionEvent;
4
import java.beans.PropertyChangeListener;
5
import java.util.Collection;
6
import java.util.Map;
7

    
8
import javax.swing.Action;
9
import javax.swing.ImageIcon;
10
import javax.swing.KeyStroke;
11

    
12
import org.gvsig.andami.PluginServices;
13
import org.gvsig.andami.actioninfo.ActionInfo;
14
import org.gvsig.andami.plugins.IExtension;
15
import org.gvsig.tools.ToolsLocator;
16

    
17

    
18
public class TranslatedActionInfo implements ActionInfo {
19

    
20
    private ActionInfo actionInfo;
21

    
22
    TranslatedActionInfo(ActionInfo actionInfo) {
23
        this.actionInfo = actionInfo;
24
    }
25

    
26
    public Object getValue(String key) {
27
        if (Action.SHORT_DESCRIPTION.equalsIgnoreCase(key)) {
28
            return this.getLabel();
29
        }
30
        if (ActionInfo.TOOLTIP.equalsIgnoreCase(key)) {
31
            return this.getTooltip();
32
        }
33

    
34
        return this.actionInfo.getValue(key);
35
    }
36

    
37
    public void putValue(String key, Object value) {
38
        this.actionInfo.putValue(key, value);
39

    
40
    }
41

    
42
    public void setEnabled(boolean b) {
43
        this.actionInfo.setEnabled(b);
44

    
45
    }
46

    
47
    public void addPropertyChangeListener(PropertyChangeListener listener) {
48
        this.actionInfo.addPropertyChangeListener(listener);
49
    }
50

    
51
    public void removePropertyChangeListener(PropertyChangeListener listener) {
52
        this.actionInfo.removePropertyChangeListener(listener);
53
    }
54

    
55
    public void actionPerformed(ActionEvent e) {
56
        this.actionInfo.actionPerformed(e);
57
    }
58

    
59
    public PluginServices getPlugin() {
60
        return this.actionInfo.getPlugin();
61
    }
62

    
63
    public IExtension getExtension() {
64
        return this.actionInfo.getExtension();
65
    }
66

    
67
    public String getPluginName() {
68
        return this.actionInfo.getPluginName();
69
    }
70

    
71
    public String getExtensionName() {
72
        return this.actionInfo.getExtensionName();
73
    }
74

    
75
    public String getName() {
76
        return this.actionInfo.getName();
77
    }
78

    
79
    public String getLabel() {
80
        return ToolsLocator.getI18nManager().getTranslation(this.actionInfo.getLabel());
81
    }
82

    
83
    public String getCommand() {
84
        return this.actionInfo.getCommand();
85
    }
86

    
87
    public ImageIcon getIcon() {
88
        return this.actionInfo.getIcon();
89
    }
90

    
91
    public String getIconName() {
92
        return this.actionInfo.getIconName();
93
    }
94

    
95
    public String getAccelerator() {
96
        return this.actionInfo.getAccelerator();
97
    }
98

    
99
    public KeyStroke getKeyStroke() {
100
        return this.actionInfo.getKeyStroke();
101
    }
102

    
103
    public String getTooltip() {
104
        return ToolsLocator.getI18nManager().getTranslation(this.actionInfo.getTooltip());
105
    }
106

    
107
    public long getPosition() {
108
        return this.actionInfo.getPosition();
109
    }
110

    
111
    public boolean isVisible() {
112
        return this.actionInfo.isVisible();
113
    }
114

    
115
    public boolean isEnabled() {
116
        return this.actionInfo.isEnabled();
117
    }
118

    
119
    public void execute() {
120
        this.actionInfo.execute();
121

    
122
    }
123

    
124
    public void execute(Object[] args) {
125
        this.actionInfo.execute(args);
126

    
127
    }
128

    
129
    public void execute(Map args) {
130
        this.actionInfo.execute(args);
131
    }
132

    
133
    public void execute(Object arg) {
134
        this.actionInfo.execute(arg);
135

    
136
    }
137

    
138
    public boolean isActive() {
139
        return this.actionInfo.isActive();
140
    }
141

    
142
    public void setActive(boolean active) {
143
        this.actionInfo.setActive(active);
144

    
145
    }
146

    
147
    public Collection<ActionInfo> getRedirections() {
148
        return this.actionInfo.getRedirections();
149
    }
150

    
151
    public Object clone() throws CloneNotSupportedException {
152
        TranslatedActionInfo other = (TranslatedActionInfo) super.clone();
153
        other.actionInfo = (ActionInfo) this.actionInfo.clone();
154
        return other;
155
    }
156
}