Revision 26945 branches/v2_0_0_prep/extensions/extWMS/src/com/iver/cit/gvsig/gui/toc/WMSPropsTocMenuEntry.java
WMSPropsTocMenuEntry.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.gui.toc; |
42 | 42 |
|
43 |
import java.awt.event.ActionEvent;
|
|
43 |
import org.gvsig.fmap.mapcontext.layers.FLayer;
|
|
44 | 44 |
|
45 |
import javax.swing.JMenuItem; |
|
46 |
|
|
47 | 45 |
import com.iver.andami.PluginServices; |
48 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
49 | 46 |
import com.iver.cit.gvsig.fmap.layers.FLyrWMS; |
50 | 47 |
import com.iver.cit.gvsig.gui.dialogs.WMSPropsDialog; |
51 |
import com.iver.cit.gvsig.project.documents.view.toc.TocMenuEntry;
|
|
52 |
import com.iver.cit.gvsig.project.documents.view.toc.gui.FPopupMenu;
|
|
48 |
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
|
|
49 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
|
|
53 | 50 |
|
54 |
public class WMSPropsTocMenuEntry extends TocMenuEntry { |
|
55 |
private JMenuItem propsMenuItem; |
|
56 |
FLayer lyr = null; |
|
57 |
|
|
58 |
public void initialize(FPopupMenu m) { |
|
59 |
super.initialize(m); |
|
60 |
|
|
61 |
if (isTocItemBranch()) { |
|
62 |
lyr = getNodeLayer(); |
|
63 |
if ((lyr instanceof FLyrWMS)) { |
|
64 |
propsMenuItem = new JMenuItem(PluginServices.getText(this, "wms_properties")); |
|
65 |
getMenu().add( propsMenuItem ); |
|
66 |
propsMenuItem.setFont(FPopupMenu.theFont); |
|
67 |
getMenu().setEnabled(true); |
|
68 |
propsMenuItem.addActionListener(this); |
|
69 |
} |
|
70 |
} |
|
51 |
public class WMSPropsTocMenuEntry extends AbstractTocContextMenuAction { |
|
52 |
|
|
53 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
|
54 |
WMSPropsDialog dialog = new WMSPropsDialog(selectedItems[0]); |
|
55 |
PluginServices.getMDIManager().addWindow(dialog); |
|
71 | 56 |
} |
72 |
|
|
73 |
public void actionPerformed(ActionEvent e) { |
|
74 |
lyr = getNodeLayer(); |
|
75 |
if (lyr.isAvailable()) { |
|
76 |
WMSPropsDialog dialog = new WMSPropsDialog(lyr); |
|
77 |
PluginServices.getMDIManager().addWindow(dialog); |
|
57 |
|
|
58 |
public String getText() { |
|
59 |
return PluginServices.getText(this, "wms_properties"); |
|
60 |
} |
|
61 |
|
|
62 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
|
63 |
return selectedItems.length == 1 && selectedItems[0].isAvailable(); |
|
64 |
} |
|
65 |
|
|
66 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
|
67 |
if (selectedItems.length != 1) { |
|
68 |
return false; |
|
78 | 69 |
} |
70 |
return selectedItems[0] instanceof FLyrWMS; |
|
71 |
|
|
79 | 72 |
} |
80 | 73 |
|
81 | 74 |
} |
Also available in: Unified diff