Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / AttributesTreeTable.java @ 8273

History | View | Annotate | Download (2.93 KB)

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

    
3
import java.util.Vector;
4

    
5
import org.gvsig.gui.beans.swing.treeTable.TreeTable;
6
import org.gvsig.gui.beans.swing.treeTable.TreeTableModel;
7
import org.gvsig.gui.beans.swing.treeTable.TreeTableModelAdapter;
8

    
9
import com.iver.cit.gvsig.gui.panels.AttributesTable.AttributesTableModel;
10

    
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: AttributesTreeTable.java 8273 2006-10-24 07:27:56Z jorpiell $
54
 * $Log$
55
 * Revision 1.1  2006-10-24 07:27:56  jorpiell
56
 * Algunos cambios en el modelo que usa la tabla
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
62
 */
63
public class AttributesTreeTable extends TreeTable{
64
        Object[] attributes = null;
65
        
66
        public AttributesTreeTable(TreeTableModel treeTableModel) {
67
                super(treeTableModel);                
68
        }
69
        
70
        /**
71
         * Sets the attributes
72
         * @param attributes
73
         */
74
        public void setAttributes(Vector vAttributes){
75
                attributes = new Object[vAttributes.size()];
76
                for (int i=0 ; i<vAttributes.size() ; i++){
77
                        attributes[i] = vAttributes.get(i);
78
                }
79
                setModel(new AttributesTreeTableModel(attributes,true));
80
                deleteIcons();
81
                setRootVisible(false);
82
        }
83
        
84
        /**
85
         * Gets the selected layer
86
         * @return
87
         */
88
        public Object[] getSelectedValues(){
89
                int[] selectedRows = getSelectedRows();
90
                TreeTableModelAdapter obj = (TreeTableModelAdapter)getModel();
91
                Object[] objects = new Object[selectedRows.length];
92
                for (int i=0 ; i<selectedRows.length ; i++){
93
                        objects[i] = obj.nodeForRow(selectedRows[i]);
94
                }
95
                return objects;
96
        }
97

    
98
        /**
99
         * Return all the attributes
100
         * @return
101
         */
102
        public Object[] getAllValues() {
103
                return attributes;
104
        }
105
        
106
        /**
107
         * Return true if the node is queryable
108
         * @param node
109
         * @return
110
         */
111
        public boolean isQueryable(Object node){
112
                for (int i=0 ; i<attributes.length ; i++){
113
                        if (node.equals(attributes[i])){
114
                                return true;
115
                        }
116
                }
117
                return false;
118
        }
119

    
120

    
121
}