svn-gvsig-desktop / trunk / extensions / extWMS / src / com / iver / cit / gvsig / gui / wizards / LayerTreeModel.java @ 4305
History | View | Annotate | Download (3.65 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 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 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.gui.wizards; |
42 |
|
43 |
import java.util.ArrayList; |
44 |
import java.util.Hashtable; |
45 |
import java.util.Vector; |
46 |
|
47 |
import javax.swing.event.TreeModelListener; |
48 |
import javax.swing.tree.TreeModel; |
49 |
import javax.swing.tree.TreePath; |
50 |
|
51 |
import com.iver.cit.gvsig.fmap.layers.WMSLayerNode; |
52 |
|
53 |
|
54 |
public class LayerTreeModel implements TreeModel { |
55 |
|
56 |
WMSLayerNode root; |
57 |
|
58 |
public LayerTreeModel(WMSLayerNode root){
|
59 |
this.root = root;
|
60 |
} |
61 |
|
62 |
public Object getRoot() { |
63 |
return root;
|
64 |
} |
65 |
|
66 |
public int getChildCount(Object parent) { |
67 |
return ((WMSLayerNode)parent).getChildren().size();
|
68 |
} |
69 |
|
70 |
public boolean isLeaf(Object node) { |
71 |
return ((WMSLayerNode)node).getChildren().size() == 0; |
72 |
} |
73 |
|
74 |
public void addTreeModelListener(TreeModelListener l) { |
75 |
} |
76 |
|
77 |
public void removeTreeModelListener(TreeModelListener l) { |
78 |
} |
79 |
|
80 |
public Object getChild(Object parent, int index) { |
81 |
return (WMSLayerNode)((WMSLayerNode)parent).getChildren().get(index);
|
82 |
} |
83 |
|
84 |
public int getIndexOfChild(Object parent, Object child) { |
85 |
WMSLayerNode pare = (WMSLayerNode) parent; |
86 |
for (int i = 0; i < pare.getChildren().size(); i++) |
87 |
if (child == pare.getChildren().get(i)) return i; |
88 |
return -1; |
89 |
} |
90 |
|
91 |
public void valueForPathChanged(TreePath path, Object newValue) { |
92 |
} |
93 |
|
94 |
/**
|
95 |
* @param node, the tree's desired node.
|
96 |
* @return Returns the name of the node.
|
97 |
*/
|
98 |
public String getName(Object node) { |
99 |
return ((WMSLayerNode) node).getName();
|
100 |
} |
101 |
|
102 |
/**
|
103 |
* @param node, the tree's desired node.
|
104 |
* @return Returns the namedStyles.
|
105 |
*/
|
106 |
public ArrayList getStyles(Object node) { |
107 |
return ((WMSLayerNode) node).getStyles();
|
108 |
} |
109 |
/**
|
110 |
* @param node, the tree's desired node.
|
111 |
* @return Returns the queryable.
|
112 |
*/
|
113 |
public boolean isQueryable(Object node) { |
114 |
return ((WMSLayerNode) node).isQueryable();
|
115 |
} |
116 |
|
117 |
/**
|
118 |
* @param node, the tree's desired node.
|
119 |
* @return Returns the srs.
|
120 |
*/
|
121 |
public Vector getSrs(Object node) { |
122 |
return ((WMSLayerNode) node).getAllSrs();
|
123 |
} |
124 |
/**
|
125 |
* @param node, the tree's desired node.
|
126 |
* @return Returns the title.
|
127 |
*/
|
128 |
public String getTitle(Object node) { |
129 |
return ((WMSLayerNode) node).getTitle();
|
130 |
} |
131 |
/**
|
132 |
* @param node, the tree's desired node.
|
133 |
* @return Returns the transparency.
|
134 |
*/
|
135 |
public boolean hasTransparency(Object node) { |
136 |
return ((WMSLayerNode) node).isTransparent();
|
137 |
} |
138 |
|
139 |
public String toString(){ |
140 |
return getTitle(this); |
141 |
} |
142 |
} |