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