svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.image.extension / src / main / java / org / gvsig / arcims / image / gui / toc / ArcImsLayerScaleTocMenuEntry.java @ 32321
History | View | Annotate | Download (3.07 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2010 Prodevelop S.L. main development
|
26 |
* http://www.prodevelop.es
|
27 |
*/
|
28 |
|
29 |
package org.gvsig.arcims.image.gui.toc; |
30 |
|
31 |
import java.awt.event.ActionEvent; |
32 |
|
33 |
import javax.swing.JMenuItem; |
34 |
|
35 |
import org.gvsig.andami.PluginServices; |
36 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
37 |
import org.gvsig.app.project.documents.view.gui.IView; |
38 |
import org.gvsig.app.project.documents.view.toc.TocMenuEntry; |
39 |
import org.gvsig.app.project.documents.view.toc.gui.FPopupMenu; |
40 |
import org.gvsig.arcims.image.fmap.layers.FRasterLyrArcIMS; |
41 |
import org.gvsig.arcims.image.gui.dialogs.LayerScaleDialog; |
42 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
43 |
|
44 |
|
45 |
/**
|
46 |
* This class implements the scale limits status properties menu item that is
|
47 |
* added to the ArcIMS layer's popup menu.
|
48 |
|
49 |
* @author jldominguez
|
50 |
*/
|
51 |
public class ArcImsLayerScaleTocMenuEntry extends TocMenuEntry { |
52 |
private JMenuItem scaleMenuItem; |
53 |
FLayer lyr = null;
|
54 |
private LayerScaleDialog scaleDialog;
|
55 |
|
56 |
public void initialize(FPopupMenu m) { |
57 |
super.initialize(m);
|
58 |
|
59 |
if (isTocItemBranch()) {
|
60 |
lyr = getNodeLayer(); |
61 |
|
62 |
// ArcIMS layer
|
63 |
if ((lyr instanceof FRasterLyrArcIMS)) { |
64 |
scaleMenuItem = new JMenuItem(PluginServices.getText(this, |
65 |
"layer_scale_status"));
|
66 |
getMenu().addSeparator(); |
67 |
getMenu().add(scaleMenuItem); |
68 |
scaleMenuItem.setFont(FPopupMenu.theFont); |
69 |
getMenu().setEnabled(true);
|
70 |
scaleMenuItem.addActionListener(this);
|
71 |
} |
72 |
} |
73 |
} |
74 |
|
75 |
/**
|
76 |
* Creates an LayerScaleDialog object and adds it to the MDIManager.
|
77 |
*/
|
78 |
public void actionPerformed(ActionEvent e) { |
79 |
if (scaleDialog != null) { |
80 |
PluginServices.getMDIManager().closeWindow(scaleDialog); |
81 |
} |
82 |
|
83 |
lyr = getNodeLayer(); |
84 |
|
85 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
86 |
IView vista = null;
|
87 |
|
88 |
if (v instanceof IView) { |
89 |
vista = (IView) v; |
90 |
} |
91 |
|
92 |
// vista.get
|
93 |
scaleDialog = new LayerScaleDialog((FRasterLyrArcIMS) lyr, vista);
|
94 |
PluginServices.getMDIManager().addWindow(scaleDialog); |
95 |
} |
96 |
} |