svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / colortable / ColorTableTocMenuEntry.java @ 18824
History | View | Annotate | Download (3.81 KB)
1 | 12344 | bsanchez | /* 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 | 12425 | nacho | import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
22 | 13703 | nacho | import org.gvsig.fmap.raster.layers.ILayerState; |
23 | 13300 | nacho | import org.gvsig.fmap.raster.layers.IRasterLayerActions; |
24 | 12344 | bsanchez | 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 | 13693 | bsanchez | *
|
34 | 12344 | bsanchez | * @version 26/06/2007
|
35 | 12369 | bsanchez | * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
|
36 | 12344 | bsanchez | */
|
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 | 12592 | bsanchez | return "RasterTools"; |
44 | 12344 | bsanchez | } |
45 | |||
46 | /*
|
||
47 | * (non-Javadoc)
|
||
48 | * @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroupOrder()
|
||
49 | */
|
||
50 | public int getGroupOrder() { |
||
51 | 12592 | bsanchez | return 55; |
52 | 12344 | bsanchez | } |
53 | |||
54 | /*
|
||
55 | * (non-Javadoc)
|
||
56 | * @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getOrder()
|
||
57 | */
|
||
58 | public int getOrder() { |
||
59 | 12592 | bsanchez | return 3; |
60 | 12344 | bsanchez | } |
61 | |||
62 | /*
|
||
63 | * (non-Javadoc)
|
||
64 | * @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getText()
|
||
65 | */
|
||
66 | public String getText() { |
||
67 | 12592 | bsanchez | return PluginServices.getText(this, "tablas_color"); |
68 | 12344 | bsanchez | } |
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 | 13703 | nacho | if(getNodeLayer(item) instanceof ILayerState) |
76 | if(!((ILayerState)getNodeLayer(item)).isOpen())
|
||
77 | return false; |
||
78 | |||
79 | 13693 | bsanchez | if (selectedItems.length != 1) |
80 | return false; |
||
81 | |||
82 | if (!(selectedItems[0] instanceof FLyrRasterSE)) |
||
83 | return false; |
||
84 | |||
85 | return true; |
||
86 | 12344 | bsanchez | } |
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 | 17667 | bsanchez | if ((isTocItemBranch(item)) &&
|
94 | (getNodeLayer(item) instanceof FLyrRasterSE) &&
|
||
95 | (((FLyrRasterSE) getNodeLayer(item)).getBandCount() == 1) &&
|
||
96 | (((FLyrRasterSE) getNodeLayer(item)).isActionEnabled(IRasterLayerActions.COLOR_TABLE))) |
||
97 | 12592 | bsanchez | return true; |
98 | 12344 | bsanchez | 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 | 13777 | bsanchez | ColorTableDialog colorTableDialog = new ColorTableDialog(660, 465); |
107 | 13693 | bsanchez | colorTableDialog.setLayer(selectedItems[0]);
|
108 | 12344 | bsanchez | PluginServices.getMDIManager().addWindow(colorTableDialog); |
109 | } |
||
110 | } |