svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / colortable / ColorTableTocMenuEntry.java @ 18277
History | View | Annotate | Download (3.81 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package org.gvsig.rastertools.colortable; |
20 |
|
21 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
22 |
import org.gvsig.fmap.raster.layers.ILayerState; |
23 |
import org.gvsig.fmap.raster.layers.IRasterLayerActions; |
24 |
import org.gvsig.rastertools.colortable.ui.ColorTableDialog; |
25 |
|
26 |
import com.iver.andami.PluginServices; |
27 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
28 |
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction; |
29 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem; |
30 |
/**
|
31 |
* <code>ColorTableTocMenuEntry</code> es el punto de entrada del menu de la
|
32 |
* tabla de color
|
33 |
*
|
34 |
* @version 26/06/2007
|
35 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
|
36 |
*/
|
37 |
public class ColorTableTocMenuEntry extends AbstractTocContextMenuAction { |
38 |
/*
|
39 |
* (non-Javadoc)
|
40 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroup()
|
41 |
*/
|
42 |
public String getGroup() { |
43 |
return "RasterTools"; |
44 |
} |
45 |
|
46 |
/*
|
47 |
* (non-Javadoc)
|
48 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroupOrder()
|
49 |
*/
|
50 |
public int getGroupOrder() { |
51 |
return 55; |
52 |
} |
53 |
|
54 |
/*
|
55 |
* (non-Javadoc)
|
56 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getOrder()
|
57 |
*/
|
58 |
public int getOrder() { |
59 |
return 3; |
60 |
} |
61 |
|
62 |
/*
|
63 |
* (non-Javadoc)
|
64 |
* @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getText()
|
65 |
*/
|
66 |
public String getText() { |
67 |
return PluginServices.getText(this, "tablas_color"); |
68 |
} |
69 |
|
70 |
/*
|
71 |
* (non-Javadoc)
|
72 |
* @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#isEnabled(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
73 |
*/
|
74 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
75 |
if(getNodeLayer(item) instanceof ILayerState) |
76 |
if(!((ILayerState)getNodeLayer(item)).isOpen())
|
77 |
return false; |
78 |
|
79 |
if (selectedItems.length != 1) |
80 |
return false; |
81 |
|
82 |
if (!(selectedItems[0] instanceof FLyrRasterSE)) |
83 |
return false; |
84 |
|
85 |
return true; |
86 |
} |
87 |
|
88 |
/*
|
89 |
* (non-Javadoc)
|
90 |
* @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#isVisible(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
91 |
*/
|
92 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
93 |
if ((isTocItemBranch(item)) &&
|
94 |
(getNodeLayer(item) instanceof FLyrRasterSE) &&
|
95 |
(((FLyrRasterSE) getNodeLayer(item)).getBandCount() == 1) &&
|
96 |
(((FLyrRasterSE) getNodeLayer(item)).isActionEnabled(IRasterLayerActions.COLOR_TABLE))) |
97 |
return true; |
98 |
return false; |
99 |
} |
100 |
|
101 |
/*
|
102 |
* (non-Javadoc)
|
103 |
* @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#execute(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
104 |
*/
|
105 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
106 |
ColorTableDialog colorTableDialog = new ColorTableDialog(660, 465); |
107 |
colorTableDialog.setLayer(selectedItems[0]);
|
108 |
PluginServices.getMDIManager().addWindow(colorTableDialog); |
109 |
} |
110 |
} |