Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / fieldstree / TreeTableModelWithCheckBoxes.java @ 27077

History | View | Annotate | Download (3.49 KB)

1
package com.iver.cit.gvsig.gui.panels.fieldstree;
2

    
3
import org.gvsig.remoteClient.gml.schemas.XMLElement;
4

    
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
/* CVS MESSAGES:
46
 *
47
 * $Id$
48
 * $Log$
49
 * Revision 1.1  2006-12-26 09:12:48  ppiqueras
50
 * Cambiado "atttibutes" en todas las aparaciones en atributos, m?todos, clases, paquetes o comentarios por "fields". (S?lo a aquellas que afectan a clases dentro del proyecto extWFS2). (En este caso se ha cambiado el nombre del paquete aparte de alguno otro nombre que puede haber cambiado).
51
 *
52
 * Revision 1.2  2006/11/01 17:29:07  jorpiell
53
 * 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
54
 *
55
 * Revision 1.1  2006/10/27 11:33:19  jorpiell
56
 * A?adida la treetable con los check box para seleccionar los atributos
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
62
 */
63
public class TreeTableModelWithCheckBoxes extends FieldsTreeTableModel{
64

    
65
        public TreeTableModelWithCheckBoxes() {
66
                super();
67
        }
68

    
69
        public TreeTableModelWithCheckBoxes(Object root) {
70
                super(generateCheckBoxNodes(root));                
71
        }
72
        
73
        /*
74
         *  (non-Javadoc)
75
         * @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object)
76
         */ 
77
        public boolean isLeaf(Object node) { 
78
                CheckBoxNode leaf = (CheckBoxNode)node;        
79
                return super.isLeaf(leaf.getElement());
80
        }
81
        
82
        /*
83
         *  (non-Javadoc)
84
         * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
85
         */
86
        public int getChildCount(Object node) { 
87
                CheckBoxNode leaf = (CheckBoxNode)node;        
88
                return super.getChildCount(leaf.getElement());
89
        }
90
        
91
        /*
92
         *  (non-Javadoc)
93
         * @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
94
         */
95
        public Object getChild(Object node, int i) { 
96
                CheckBoxNode leaf = (CheckBoxNode)node;        
97
                if (leaf.getChildren().size() > 0){
98
                        return leaf.getChildren().get(i);
99
                }
100
                return null;
101
        }
102
        
103
        /*
104
         *  (non-Javadoc)
105
         * @see org.gvsig.gui.beans.swing.treeTable.TreeTableModel#getValueAt(java.lang.Object, int)
106
         */
107
        public Object getValueAt(Object node, int column) {
108
                CheckBoxNode leaf = (CheckBoxNode)node;        
109
                return super.getValueAt(leaf.getElement(),column);
110
        }
111
        
112
        public static Object generateCheckBoxNodes(Object root){
113
                Object newRoot = new CheckBoxNode((XMLElement)root,null);
114
                return newRoot;
115
        }        
116
        
117
}