gvsig-raster / org.gvsig.raster.tools / trunk / org.gvsig.raster.tools / org.gvsig.raster.tools.app.basic / src / main / java / org / gvsig / raster / tools / app / basic / tool / viewexport / SaveViewToImageTocMenuEntry.java @ 2123
History | View | Annotate | Download (3.01 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 |
package org.gvsig.raster.tools.app.basic.tool.viewexport; |
23 |
|
24 |
import java.beans.PropertyChangeEvent; |
25 |
import java.beans.PropertyChangeListener; |
26 |
|
27 |
import javax.swing.Icon; |
28 |
|
29 |
import org.gvsig.andami.plugins.Extension; |
30 |
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction; |
31 |
import org.gvsig.app.project.documents.view.toc.ITocItem; |
32 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
33 |
import org.gvsig.raster.mainplugin.toolbar.IGenericToolBarMenuItem; |
34 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
35 |
|
36 |
|
37 |
/**
|
38 |
* Entry point for save view to image
|
39 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
40 |
*/
|
41 |
public class SaveViewToImageTocMenuEntry extends AbstractTocContextMenuAction implements PropertyChangeListener, IGenericToolBarMenuItem { |
42 |
static private SaveViewToImageTocMenuEntry singleton = null; |
43 |
private Extension extension = null; |
44 |
|
45 |
/**
|
46 |
* Nadie puede crear una instancia a esta clase ?nica, hay que usar el
|
47 |
* getSingleton()
|
48 |
*/
|
49 |
private SaveViewToImageTocMenuEntry() {
|
50 |
|
51 |
} |
52 |
|
53 |
private Extension getExtension() {
|
54 |
if(extension == null) { |
55 |
extension = new Export();
|
56 |
extension.initialize(); |
57 |
extension.postInitialize(); |
58 |
} |
59 |
return extension;
|
60 |
} |
61 |
|
62 |
/**
|
63 |
* Devuelve un objeto unico a dicha clase
|
64 |
* @return
|
65 |
*/
|
66 |
static public SaveViewToImageTocMenuEntry getSingleton() { |
67 |
if (singleton == null) |
68 |
singleton = new SaveViewToImageTocMenuEntry();
|
69 |
return singleton;
|
70 |
} |
71 |
|
72 |
public String getGroup() { |
73 |
return "RasterExport"; |
74 |
} |
75 |
|
76 |
public int getGroupOrder() { |
77 |
return 50; |
78 |
} |
79 |
|
80 |
public int getOrder() { |
81 |
return 3; |
82 |
} |
83 |
|
84 |
public String getText() { |
85 |
return RasterToolsUtil.getText(this, "export_view_to_image"); |
86 |
} |
87 |
|
88 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
89 |
return getExtension().isEnabled();
|
90 |
} |
91 |
|
92 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
93 |
return getExtension().isVisible();
|
94 |
} |
95 |
|
96 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
97 |
getExtension().execute(null);
|
98 |
} |
99 |
|
100 |
public Icon getIcon() { |
101 |
return RasterToolsUtil.getIcon("view-export-image"); |
102 |
} |
103 |
|
104 |
public void propertyChange(PropertyChangeEvent evt) {} |
105 |
|
106 |
public boolean isEnableEvents() { |
107 |
return true; |
108 |
} |
109 |
} |