svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / toc / AbstractActionInfoAdapterToTocContextMenuAction.java @ 44601
History | View | Annotate | Download (2.58 KB)
1 |
package org.gvsig.app.project.documents.view.toc; |
---|---|
2 |
|
3 |
import java.awt.Image; |
4 |
import javax.swing.ImageIcon; |
5 |
import org.gvsig.andami.PluginsLocator; |
6 |
import org.gvsig.andami.actioninfo.ActionInfo; |
7 |
import org.gvsig.app.project.documents.view.IContextMenuActionWithIcon; |
8 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
9 |
import org.gvsig.tools.ToolsLocator; |
10 |
import org.gvsig.tools.i18n.I18nManager; |
11 |
import org.slf4j.Logger; |
12 |
import org.slf4j.LoggerFactory; |
13 |
|
14 |
public class AbstractActionInfoAdapterToTocContextMenuAction extends AbstractTocContextMenuAction implements IContextMenuActionWithIcon { |
15 |
|
16 |
private static final Logger logger = LoggerFactory.getLogger(AbstractActionInfoAdapterToTocContextMenuAction.class); |
17 |
protected ActionInfo action = null; |
18 |
protected String group = null; |
19 |
protected int groupOrder = 1; |
20 |
protected int order = 1; |
21 |
|
22 |
protected AbstractActionInfoAdapterToTocContextMenuAction(ActionInfo action, String group, int groupOrder, int order) { |
23 |
this.action = action;
|
24 |
this.group = group;
|
25 |
this.groupOrder = groupOrder;
|
26 |
this.order = order;
|
27 |
} |
28 |
|
29 |
protected AbstractActionInfoAdapterToTocContextMenuAction(ActionInfo action, String group, int groupOrder) { |
30 |
this(action, group, groupOrder, (int) action.getPosition()); |
31 |
} |
32 |
|
33 |
protected AbstractActionInfoAdapterToTocContextMenuAction(String actionName, String group, int groupOrder, int order) { |
34 |
this(
|
35 |
PluginsLocator.getActionInfoManager().getAction(actionName), |
36 |
group, groupOrder, order |
37 |
); |
38 |
} |
39 |
|
40 |
protected AbstractActionInfoAdapterToTocContextMenuAction(String actionName, String group, int groupOrder) { |
41 |
this(
|
42 |
PluginsLocator.getActionInfoManager().getAction(actionName), |
43 |
group, groupOrder |
44 |
); |
45 |
} |
46 |
|
47 |
public String getGroup() { |
48 |
return this.group; |
49 |
} |
50 |
|
51 |
public int getGroupOrder() { |
52 |
return this.groupOrder; |
53 |
} |
54 |
|
55 |
public int getOrder() { |
56 |
return this.order; |
57 |
} |
58 |
|
59 |
public String getText() { |
60 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
61 |
return i18nManager.getTranslation(this.action.getLabel()); |
62 |
} |
63 |
|
64 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
65 |
return this.action.isEnabled(); |
66 |
} |
67 |
|
68 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
69 |
boolean n = this.action.isVisible(); |
70 |
return n;
|
71 |
} |
72 |
|
73 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
74 |
this.action.execute(selectedItems);
|
75 |
} |
76 |
|
77 |
public ImageIcon getIcon() { |
78 |
return this.action.getIcon(); |
79 |
} |
80 |
} |