svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / toc / TocItemBranch.java @ 3718
History | View | Annotate | Download (3.79 KB)
1 | 418 | fjp | /*
|
---|---|---|---|
2 | * Created on 03-dic-2004
|
||
3 | *
|
||
4 | * TODO To change the template for this generated file go to
|
||
5 | * Window - Preferences - Java - Code Generation - Code and Comments
|
||
6 | */
|
||
7 | 1103 | fjp | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 | *
|
||
9 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
10 | *
|
||
11 | * This program is free software; you can redistribute it and/or
|
||
12 | * modify it under the terms of the GNU General Public License
|
||
13 | * as published by the Free Software Foundation; either version 2
|
||
14 | * of the License, or (at your option) any later version.
|
||
15 | *
|
||
16 | * This program is distributed in the hope that it will be useful,
|
||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
19 | * GNU General Public License for more details.
|
||
20 | *
|
||
21 | * You should have received a copy of the GNU General Public License
|
||
22 | * along with this program; if not, write to the Free Software
|
||
23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
24 | *
|
||
25 | * For more information, contact:
|
||
26 | *
|
||
27 | * Generalitat Valenciana
|
||
28 | * Conselleria d'Infraestructures i Transport
|
||
29 | * Av. Blasco Ib??ez, 50
|
||
30 | * 46010 VALENCIA
|
||
31 | * SPAIN
|
||
32 | *
|
||
33 | * +34 963862235
|
||
34 | * gvsig@gva.es
|
||
35 | * www.gvsig.gva.es
|
||
36 | *
|
||
37 | * or
|
||
38 | *
|
||
39 | * IVER T.I. S.A
|
||
40 | * Salamanca 50
|
||
41 | * 46005 Valencia
|
||
42 | * Spain
|
||
43 | *
|
||
44 | * +34 963163400
|
||
45 | * dac@iver.es
|
||
46 | */
|
||
47 | 418 | fjp | package com.iver.cit.gvsig.gui.toc; |
48 | |||
49 | 423 | fjp | import java.awt.Dimension; |
50 | import java.awt.Image; |
||
51 | 418 | fjp | import java.awt.datatransfer.DataFlavor; |
52 | import java.awt.datatransfer.UnsupportedFlavorException; |
||
53 | import java.io.IOException; |
||
54 | |||
55 | import javax.swing.Icon; |
||
56 | 423 | fjp | import javax.swing.ImageIcon; |
57 | import javax.swing.UIManager; |
||
58 | 418 | fjp | |
59 | import com.iver.cit.gvsig.fmap.layers.FLayer; |
||
60 | 3479 | caballero | import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
61 | 418 | fjp | |
62 | /**
|
||
63 | * @author FJP
|
||
64 | *
|
||
65 | * TODO To change the template for this generated type comment go to
|
||
66 | * Window - Preferences - Java - Code Generation - Code and Comments
|
||
67 | */
|
||
68 | public class TocItemBranch implements ITocItem { |
||
69 | |||
70 | 423 | fjp | private final Icon icolayer = new ImageIcon("images/icolayer.png"); |
71 | |||
72 | 418 | fjp | private FLayer lyr;
|
73 | |||
74 | 423 | fjp | private Dimension sz; |
75 | |||
76 | 418 | fjp | final public static DataFlavor INFO_FLAVOR = |
77 | new DataFlavor(TocItemBranch.class, "ItemBranch"); |
||
78 | static DataFlavor flavors[] = {INFO_FLAVOR }; |
||
79 | |||
80 | public TocItemBranch(FLayer lyr)
|
||
81 | { |
||
82 | this.lyr = lyr;
|
||
83 | } |
||
84 | /* (non-Javadoc)
|
||
85 | * @see com.iver.cit.gvsig.gui.toc.ITocItem#getLabel()
|
||
86 | */
|
||
87 | public String getLabel() { |
||
88 | 3479 | caballero | /*if (lyr instanceof FLyrVect && ((FLyrVect)lyr).isBroken())
|
89 | {
|
||
90 | return lyr.getName() + "(broken)";
|
||
91 | }
|
||
92 | else*/
|
||
93 | return lyr.getName();
|
||
94 | 418 | fjp | } |
95 | |||
96 | /* (non-Javadoc)
|
||
97 | * @see com.iver.cit.gvsig.gui.toc.ITocItem#getIcon()
|
||
98 | */
|
||
99 | public Icon getIcon() { |
||
100 | // TODO Pedirle el icono a la capa. Por defecto habr? un icono
|
||
101 | // para vectoriales y otro para raster, pero se podr?n cambiar.
|
||
102 | 423 | fjp | return icolayer;
|
103 | 418 | fjp | } |
104 | |||
105 | public FLayer getLayer() {
|
||
106 | return lyr;
|
||
107 | } |
||
108 | |||
109 | /* (non-Javadoc)
|
||
110 | * @see java.awt.datatransfer.Transferable#getTransferDataFlavors()
|
||
111 | */
|
||
112 | public DataFlavor[] getTransferDataFlavors() { |
||
113 | return flavors;
|
||
114 | } |
||
115 | |||
116 | /* (non-Javadoc)
|
||
117 | * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor)
|
||
118 | */
|
||
119 | public boolean isDataFlavorSupported(DataFlavor dF) { |
||
120 | return dF.equals(INFO_FLAVOR);
|
||
121 | } |
||
122 | |||
123 | /* (non-Javadoc)
|
||
124 | * @see java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer.DataFlavor)
|
||
125 | */
|
||
126 | public Object getTransferData(DataFlavor dF) throws UnsupportedFlavorException, IOException { |
||
127 | if (dF.equals(INFO_FLAVOR)) {
|
||
128 | return this; |
||
129 | } |
||
130 | else throw new UnsupportedFlavorException(dF); |
||
131 | } |
||
132 | 423 | fjp | /* (non-Javadoc)
|
133 | * @see com.iver.cit.gvsig.gui.toc.ITocItem#getSize()
|
||
134 | */
|
||
135 | public Dimension getSize() { |
||
136 | return sz;
|
||
137 | } |
||
138 | /* (non-Javadoc)
|
||
139 | * @see com.iver.cit.gvsig.gui.toc.ITocItem#setSize(java.awt.Dimension)
|
||
140 | */
|
||
141 | public void setSize(Dimension sz) { |
||
142 | this.sz = sz;
|
||
143 | } |
||
144 | 418 | fjp | |
145 | } |