svn-gvsig-desktop / branches / v10 / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / attributesTree / TreeTableModelWithCheckBoxes.java @ 8847
History | View | Annotate | Download (3.21 KB)
1 |
package com.iver.cit.gvsig.gui.panels.attributesTree; |
---|---|
2 |
|
3 |
import org.gvsig.gui.beans.swing.treeTable.AbstractTreeTableModel; |
4 |
import org.gvsig.remoteClient.gml.schemas.XMLElement; |
5 |
|
6 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
7 |
*
|
8 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
9 |
*
|
10 |
* This program is free software; you can redistribute it and/or
|
11 |
* modify it under the terms of the GNU General Public License
|
12 |
* as published by the Free Software Foundation; either version 2
|
13 |
* of the License, or (at your option) any later version.
|
14 |
*
|
15 |
* This program is distributed in the hope that it will be useful,
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
* GNU General Public License for more details.
|
19 |
*
|
20 |
* You should have received a copy of the GNU General Public License
|
21 |
* along with this program; if not, write to the Free Software
|
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
23 |
*
|
24 |
* For more information, contact:
|
25 |
*
|
26 |
* Generalitat Valenciana
|
27 |
* Conselleria d'Infraestructures i Transport
|
28 |
* Av. Blasco Ib??ez, 50
|
29 |
* 46010 VALENCIA
|
30 |
* SPAIN
|
31 |
*
|
32 |
* +34 963862235
|
33 |
* gvsig@gva.es
|
34 |
* www.gvsig.gva.es
|
35 |
*
|
36 |
* or
|
37 |
*
|
38 |
* IVER T.I. S.A
|
39 |
* Salamanca 50
|
40 |
* 46005 Valencia
|
41 |
* Spain
|
42 |
*
|
43 |
* +34 963163400
|
44 |
* dac@iver.es
|
45 |
*/
|
46 |
/* CVS MESSAGES:
|
47 |
*
|
48 |
* $Id: TreeTableModelWithCheckBoxes.java 8847 2006-11-17 11:29:00Z ppiqueras $
|
49 |
* $Log$
|
50 |
* Revision 1.2.2.2 2006-11-17 11:28:45 ppiqueras
|
51 |
* Corregidos bugs y a?adida nueva funcionalidad.
|
52 |
*
|
53 |
* Revision 1.2 2006/11/01 17:29:07 jorpiell
|
54 |
* Se ha elimiado el nodo virtual de la raiz. Adem?s ya se cargan los valores de un campo complejo en la pesta?a del filtro
|
55 |
*
|
56 |
* Revision 1.1 2006/10/27 11:33:19 jorpiell
|
57 |
* A?adida la treetable con los check box para seleccionar los atributos
|
58 |
*
|
59 |
*
|
60 |
*/
|
61 |
/**
|
62 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
63 |
*/
|
64 |
public class TreeTableModelWithCheckBoxes extends AttributesTreeTableModel{ |
65 |
|
66 |
public TreeTableModelWithCheckBoxes() {
|
67 |
super();
|
68 |
} |
69 |
|
70 |
public TreeTableModelWithCheckBoxes(Object root) { |
71 |
super(generateCheckBoxNodes(root));
|
72 |
} |
73 |
|
74 |
/*
|
75 |
* (non-Javadoc)
|
76 |
* @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object)
|
77 |
*/
|
78 |
public boolean isLeaf(Object node) { |
79 |
CheckBoxNode leaf = (CheckBoxNode)node; |
80 |
return super.isLeaf(leaf.getElement()); |
81 |
} |
82 |
|
83 |
/*
|
84 |
* (non-Javadoc)
|
85 |
* @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
|
86 |
*/
|
87 |
public int getChildCount(Object node) { |
88 |
CheckBoxNode leaf = (CheckBoxNode)node; |
89 |
return super.getChildCount(leaf.getElement()); |
90 |
} |
91 |
|
92 |
/*
|
93 |
* (non-Javadoc)
|
94 |
* @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
|
95 |
*/
|
96 |
public Object getChild(Object node, int i) { |
97 |
CheckBoxNode leaf = (CheckBoxNode)node; |
98 |
if (leaf.getChildren().size() > 0){ |
99 |
return leaf.getChildren().get(i);
|
100 |
} |
101 |
return null; |
102 |
} |
103 |
|
104 |
/*
|
105 |
* (non-Javadoc)
|
106 |
* @see org.gvsig.gui.beans.swing.treeTable.TreeTableModel#getValueAt(java.lang.Object, int)
|
107 |
*/
|
108 |
public Object getValueAt(Object node, int column) { |
109 |
CheckBoxNode leaf = (CheckBoxNode)node; |
110 |
return super.getValueAt(leaf.getElement(),column); |
111 |
} |
112 |
|
113 |
public static Object generateCheckBoxNodes(Object root){ |
114 |
Object newRoot = new CheckBoxNode((XMLElement)root,null); |
115 |
return newRoot;
|
116 |
} |
117 |
|
118 |
} |