Revision 12766

View differences:

tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/config/ApplicationContextAlone.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
3

  
4
<beans>
5

  
6
  <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
7
    <property name="location"><value>config/TestContext.properties</value></property>
8
  </bean>
9

  
10
  <!-- ========================= GENERAL DEFINITIONS ========================= -->
11

  
12
  <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
13
    <property name="basename"><value>messages</value></property>
14
  </bean>
15

  
16

  
17
  <!-- ========================= PERSISTENCE DEFINITIONS ========================= -->
18

  
19
  <!-- ========================= BUSINESS DEFINITIONS ========================= -->
20

  
21
  <bean id="OIDRegister" class="org.jzkit.a2j.codec.util.OIDRegister">
22
    <constructor-arg index="0"><value>/es/gva/cit/catalogClient/protocols/context/a2j.properties</value></constructor-arg>
23
  </bean>
24

  
25
  <!-- conversion rules -->
26
  <bean id="RPNToInternalRules" class="org.jzkit.util.PropsHolder">
27
    <constructor-arg index="0"><value>/es/gva/cit/catalogClient/protocols/context/InternalAttrTypes.properties</value></constructor-arg>
28
  </bean>
29

  
30
  <bean id="InternalToType1ConversionRules" class="org.jzkit.z3950.QueryModel.PropsBasedInternalToType1ConversionRules">
31
    <constructor-arg index="0"><value>/es/gva/cit/catalogClient/protocols/context/InternalToType1Rules.properties</value></constructor-arg>
32
  </bean>
33

  
34
</beans>
0 35

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/config/ApplicationContext.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
3
<beans>
4
	<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
5
    	<property name="location"><value>gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/config/TestContext.properties</value></property>
6
	</bean>
7
<!-- ========================= GENERAL DEFINITIONS ========================= -->
8
	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
9
    	<property name="basename"><value>messages</value></property>
10
	</bean>
11
<!-- ========================= PERSISTENCE DEFINITIONS ========================= -->
12

  
13
<!-- ========================= BUSINESS DEFINITIONS ========================= -->
14

  
15
	<bean id="OIDRegister" class="org.jzkit.a2j.codec.util.OIDRegister">
16
    	<constructor-arg index="0"><value>/es/gva/cit/catalogClient/protocols/context/a2j.properties</value></constructor-arg>
17
	</bean>
18

  
19
<!-- conversion rules -->
20
	<bean id="RPNToInternalRules" class="org.jzkit.util.PropsHolder">
21
    	<constructor-arg index="0"><value>/es/gva/cit/catalogClient/protocols/context/InternalAttrTypes.properties</value></constructor-arg>
22
	</bean>
23

  
24
  	<bean id="InternalToType1ConversionRules" class="org.jzkit.z3950.QueryModel.PropsBasedInternalToType1ConversionRules">
25
    	<constructor-arg index="0"><value>/es/gva/cit/catalogClient/protocols/context/InternalToType1Rules.properties</value></constructor-arg>
26
	</bean>
27
</beans>
0 28

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/.cvsignore
1
dist
0 2

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/.settings/org.eclipse.core.runtime.prefs
1
#Mon Jul 23 13:59:18 CEST 2007
2
eclipse.preferences.version=1
3
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
4
line.separator=\n
0 5

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/.settings/org.eclipse.core.resources.prefs
1
#Wed Jan 11 12:57:27 CET 2006
2
eclipse.preferences.version=1
3
encoding/<project>=ISO-8859-1
0 4

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/text.properties
1
catalog_search=B\u00fasqueda de Geodatos
2
gazetteer_search=Localizar por Nomencl\u00e1tor
3
gazetteer_connect=Localizar por Nomencl\u00e1tor
4
metadata_catalog=B\u00fasqueda de Geodatos - Conexi\u00f3n
5
metadata_tree=\u00c1rbol del Metadato
6
search_results=Resultados de la b\u00fasqueda
7
resourceTypeColumn=Tipo
8
resourceLinkColumn=Enlace
9
resourceShowColumn=Ver
10
concordancia=Concordancia
11
exactSentence=Frase Exacta
12
anyWord=Cualquier Palabra
13
allWords=Todas las Palabras
14
cathegoryAny=cualquiera
15
cathegoryBiota=biota
16
cathegoryBoundaries=boundaries
17
cathegoryClimatologyMeteorologyAtmosphere=climatologyMeteorologyAtmosphere
18
cathegoryEconomy=economy
19
cathegoryElevation=elevation
20
cathegoryEnvironment=environment
21
cathegoryFarming=farming
22
cathegoryGeoscientificInformation=geoscientificInformation
23
cathegoryHealth=health
24
cathegoryImageryBaseMapsEarthCover=imageryBaseMapsEarthCover
25
cathegoryInlandWaters=inlandWaters
26
cathegoryIntelligenceMilitary=intelligenceMilitary
27
cathegoryLocation=location
28
cathegoryOceans=oceans
29
cathegoryPlanningCadastre=planningCadastre
30
cathegorySociety=society
31
cathegoryStructure=structure
32
cathegoryTransportation=transportation
33
cathegoryUtilitiesCommunication=utilitiesCommunication
34
scaleAny=qualquiera
35
scaleI=>1.000.000
36
scaleII=1.000.000 - 250.000
37
scaleIII=250.000 - 50.000
38
scaleIV=50.000 - 10.000
39
scaleV=10.000 - 5000
40
scaleVI=<5.000
41
scale=Escala
42
provider=Proveedor
43
from=De:
44
to=A:
45
upperCoordinates=Superiores
46
lowerCoordinates=Inferiores
47
ULX=ULX:
48
ULY=ULY:
49
BRX=BRX:
50
BRY=BRY:
51
abstract=Resumen
52
coordinates=Coordenadas
53
coordinatesEqual=igual
54
coordinatesContains=contiene
55
coordinatesEnclose=incluye
56
coordinatesFullyOutsideOf=est\u00e1 totalmente fuera de
57
title=Titulo
58
restrictArea=Restringir el area de B\u00fasqueda
59
protocolsGroup=Protocolos
60
serverReply=Respuesta del servidor
61
serverURL=Introduzca la direcci\u00f3n donde se encuentra el servidor de cat\u00e1logo
62
serverURLCat=Introduzca la direcci\u00f3n donde se encuentra el servidor de nomencl\u00e1tor
63
database=Nombre de la base de datos
64
connectButton=Conectar
65
searchButton=Buscar
66
results=Resultados
67
of=de
68
description=Descripcion
69
layer=A\u00f1adir Capa
70
next=Siquiente
71
last=Anterior
72
close=Cerrar
73
value=Valor
74
attributes=Atributos
75
keyWords=Palabras Clave
76
cathegory=Categor\u00eda
77
lastUpdateDate=Fecha de \u00faltima actualizaci\u00f3n
78
purpose=Prop\u00f3sito
79
errorServerNotFound=No se encuentra el servidor
80
errorNotSupportedProtocol=El servidor no soporta el protocolo especificado
81
errorNotSupportedCapabilities=Error al hacer un GetCapabilities.Esto puede ser debido a dos razones: O bien ha habido un error al intentar hacer la operaci\u00f3n, o bien el servidor no soporta el protocolo especificado
82
errorNotParsedReply=Error al procesar la respuesta. Se ha encontrado el servidor, pero posiblemente no soporta el protocolo especificado
83
name=Nombre
84
resutsByPage=Resultados por p\u00e1gina
85
type=Tipo
86
localize=Localizar
87
page=P\u00e1gina
88
errorNotThesaurusSelected=El protocolo WFS no permite hacer b\u00fasquedas si no se elige un elemento del tesauro
89
chooseAttribute=Elige un atributo para hacer la b\u00fasqueda
90
errorGetRecords=Se ha producido un error al hacer el getRecords
91
anyResult=La b\u00fasqueda no ha producido ning\u00fan resultado
92
rootName=Ra\u00edz
93
wcsColumn=Cobertura
94
wmsColumn=Mapa
95
wfsColumn=Feature
96
postgisColumn=Postgis
97
linkColumn=P\u00e1gina Web
98
downloadColumn=Descarga
99
errorNotCSWSupportedProtocol=Se ha encontrado el servidor, pero parece ser que no soporta el protocolo CS-W
100
errorIsASRWServer=Es un servidor SRW!
101
errorServerException=El servidor ha devuelto una excepci\u00f3n
102
errorSOAPProtocol=Error en el protocolo SOAP
103
errorFENotSupported=De momento solo se pueden hacer querys usando la codificaci\u00f3n FILTER ENCODING que no est\u00e1 soportada por el servidor
104
mantainold=Eliminar las busquedas anteriores
105
goto=Hacer un zoom a la b\u00fasqueda
106
paint=Dibujar el resultado
107
aspect=Configuracion de aspecto
108
unknown=Desconocido
109
cancelSearchButton=Cancelar
110
wmsError=Ha ocurrido un error al cargar el mapa
111
loadWMS=Carga de WMS
112
wfsError=Ha ocurrido un error al cargar la feature
113
wfsLoad=Carga de WFS
114
wcsError=Ha ocurrido un error al cargar la cobertura
115
wcsLoad=Carga de WCS
116
postgisError=Ha ocurrido un error al cargar la base de datos
117
postgisLoad=Carga de Postgis
118
linkError=Ha ocurrido un error al cargar el enlace
119
linkLoad=carga de un recurso web
120
link=Enlace
121
server=Servidor
122
layer=Capa
123
parameters=Par\u00e1metros
124
pluginNotFound=No tienes ninguna extensi\u00f3n para cargar recursos de este tipo
125
pluginNotFoundTitle=Carga de capas
126
inteligentSearch=B\u00fasqueda inteligente
127
inteligentSearchAscii=Todas las formas de la palabra
128
reproyectar_aviso=La proyecci\u00F3n de la capa no es igual que la de la vista.\nAVISO\: Puede ser inexacto con algunas transformaciones.\nPor favor, lea la documentaci\u00F3n.
129
reproyectar_pregunta=\u00BFDesea reproyectar?
0 130

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>CatalogClientPrototype</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
	</buildSpec>
14
	<natures>
15
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
16
		<nature>org.eclipse.jdt.core.javanature</nature>
17
		<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
18
	</natures>
19
</projectDescription>
0 20

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/build.number
1
#Build Number for ANT. Do not edit!
2
#Wed Jun 27 09:17:12 CEST 2007
3
build.number=1005
0 4

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/utils/CatalogConstants.java
1
package es.gva.cit.catalogClient.utils;
2

  
3
import java.awt.Dimension;
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.2.4  2007-07-24 09:45:52  jorpiell
50
 * Fix some interface bugs
51
 *
52
 * Revision 1.1.2.3  2007/07/23 07:14:25  jorpiell
53
 * Catalog refactoring
54
 *
55
 * Revision 1.1.2.2  2007/07/11 13:01:50  jorpiell
56
 * Catalog UI updated
57
 *
58
 * Revision 1.1.2.1  2007/07/10 11:18:04  jorpiell
59
 * Added the registers
60
 *
61
 *
62
 */
63
/**
64
 * This class has some constants for the catalog client
65
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
66
 */
67
public class CatalogConstants {
68
	public static final int BUTTON_LENGHT = 80;
69
	public static final int BUTTON_WIDTH = 23;
70
	public static final Dimension BUTTON_SIZE = new Dimension(BUTTON_LENGHT,BUTTON_WIDTH);
71
	public static final int RESIZE_WINDOW_BUTTON_SIZE = 30;
72
	
73
	//Action commands
74
	public static final String CLOSE_BUTTON_ACTION_COMMAND = "close";
75
	public static final String NEXT_BUTTON_ACTION_COMMAND = "next";
76
	public static final String LAST_BUTTON_ACTION_COMMAND = "last";
77
	public static final String CANCEL_BUTTON_ACTION_COMMAND = "cancel";
78
	public static final String SEARCH_BUTTON_ACTION_COMMAND = "search";
79
	public static final String PROTOCOL_COMBO_ACTION_COMMAND = "protocolCombo";
80
	public static final String RESIZE_BUTTON_ACTION_COMMAND = "resize";
81
	public static final String CONNECT_BUTTON_ACTION_COMMAND = "connect";
82

  
83
	//conordancia
84
	public static final String EXACT_WORDS = "E";
85
	public static final String ANY_WORD = "Y";
86
	public static final String ALL_WORDS = "A";
87
	public static final String OR = "Or";
88
	public static final String AND = "And";
89
	
90
	//Connection 
91
	public static final int GET = 0;
92
	public static final int POST = 1;
93
	public static final int SOAP = 2;
94
	public static final int Z3950 = 4;
95
	
96
}
0 97

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/utils/xmltreetable/XMLTreeCellRenderer.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package es.gva.cit.catalogClient.utils.xmltreetable;
43

  
44
/**
45
 * 
46
 * 
47
 * 
48
 * @author Jorge Piera Llodra (piera_jor@gva.es)
49
 */
50
public class XMLTreeCellRenderer extends javax.swing.tree.DefaultTreeCellRenderer {
51

  
52
/**
53
 * 
54
 * 
55
 */
56
    public  XMLTreeCellRenderer() {        
57
        this.setClosedIcon(null);
58
        this.setOpenIcon(null);
59
        this.setLeafIcon(null);
60
    } 
61
 }
0 62

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/utils/xmltreetable/XMLTreeTable.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package es.gva.cit.catalogClient.utils.xmltreetable;
43
import javax.swing.JComponent;
44
import javax.swing.JTree;
45

  
46
import next.swing.JTreeTable;
47
import next.swing.TreeTableModel;
48

  
49
/**
50
 * 
51
 * 
52
 * 
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class XMLTreeTable extends JTreeTable {
56

  
57
/**
58
 * 
59
 * 
60
 * 
61
 * @param treeTableModel 
62
 */
63
    public  XMLTreeTable(TreeTableModel treeTableModel) {        
64
        super(treeTableModel);
65
        tree.setCellRenderer(new XMLTreeCellRenderer());
66
        setDefaultEditor(JComponent.class, new XMLTreeTableCellEditor());
67
    } 
68

  
69
/**
70
 * 
71
 * 
72
 * 
73
 * @return 
74
 */
75
    public JTree getTree() {        
76
        return tree;
77
    } 
78

  
79
/**
80
 * 
81
 * 
82
 * 
83
 * @return 
84
 * @param x 
85
 * @param y 
86
 */
87
    public boolean isCellEditable(int x, int y) {        
88
        return true;
89
    } 
90
 }
0 91

  
tags/CatalogYNomenclator_v1_1_1005_Build_0/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/utils/xmltreetable/XMLTreeTableModel.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package es.gva.cit.catalogClient.utils.xmltreetable;
43
import java.awt.Font;
44
import java.util.Enumeration;
45
import java.util.Vector;
46

  
47
import javax.swing.JEditorPane;
48
import javax.swing.JLabel;
49
import javax.swing.JScrollPane;
50
import javax.swing.JTree;
51
import javax.swing.tree.DefaultMutableTreeNode;
52
import javax.swing.tree.TreePath;
53

  
54
import next.swing.AbstractTreeTableModel;
55
import next.swing.TreeTableModel;
56

  
57
import org.amic.util.date.Date;
58

  
59
import es.gva.cit.catalogClient.metadataxml.XMLNode;
60
import es.gva.cit.catalogClient.utils.Strings;
61

  
62
/**
63
 * 
64
 * 
65
 * 
66
 * @author Jorge Piera Llodra (piera_jor@gva.es)
67
 */
68
public class XMLTreeTableModel extends AbstractTreeTableModel {
69

  
70
/**
71
 * 
72
 * 
73
 */
74
    private Vector columns = null;
75

  
76
/**
77
 * 
78
 * 
79
 */
80
    private String[] allowed = null;
81

  
82
/**
83
 * 
84
 * 
85
 */
86
    private String[] forbidden = null;
87

  
88
/**
89
 * 
90
 * 
91
 */
92
    private boolean dynamic = false;
93

  
94
/**
95
 * Creates new XmlTreeTableModel
96
 * 
97
 * 
98
 * @param node 
99
 */
100
    public  XMLTreeTableModel(XMLNode node) {        
101
        this(node, -1, null, null);
102
    } 
103

  
104
/**
105
 * 
106
 * 
107
 * 
108
 * @param node 
109
 * @param level 
110
 * @param allowed 
111
 * @param forbidden 
112
 */
113
    public  XMLTreeTableModel(XMLNode node, int level, String[] allowed, String[] forbidden) {        
114
        super(new DefaultMutableTreeNode(node));
115
        this.allowed = allowed;
116
        this.forbidden = forbidden;
117
        processChildren((DefaultMutableTreeNode) getRoot(), level);
118
    } 
119

  
120
/**
121
 * 
122
 * 
123
 */
124
    public final int ALIGN_LEFT = JLabel.LEFT;
125

  
126
/**
127
 * 
128
 * 
129
 */
130
    public final int ALIGN_RIGHT = JLabel.RIGHT;
131

  
132
/**
133
 * 
134
 * 
135
 */
136
    public final int ALIGN_CENTER = JLabel.CENTER;
137

  
138
/**
139
 * 
140
 * 
141
 * 
142
 * @param value 
143
 */
144
    public void setDynamic(boolean value) {        
145
        dynamic = value;
146
    } 
147

  
148
/**
149
 * 
150
 * 
151
 * 
152
 * @return 
153
 * @param node 
154
 */
155
    public boolean isLeaf(Object node) {        
156
        return (getChildCount(node) == 0) && !dynamic;
157
    } 
158

  
159
/**
160
 * 
161
 * 
162
 * 
163
 * @return 
164
 * @param node 
165
 * @param level 
166
 */
167
    public boolean processChildren(DefaultMutableTreeNode node, int level) {        
168
        if (level == 0) {
169
            return true;
170
        }
171
        boolean doIt = true;
172
        XMLNode n = (XMLNode) node.getUserObject();
173
        if (allowed != null) {
174
            String name = n.getName();
175
            doIt = false;
176
            for (int i = 0; i < allowed.length; i++)
177
                if (allowed[i].equals(name)) {
178
                    doIt = true;
179
                    break;
180
                }
181
        }
182
        if (forbidden != null) {
183
            String name = n.getName();
184
            for (int i = 0; i < forbidden.length; i++)
185
                if (forbidden[i].equals(name)) {
186
                    doIt = false;
187
                    break;
188
                }
189
        }
190
        if (!doIt) {
191
            return false;
192
        }
193
        XMLNode[] nodes = n.getSubnodes();
194
        DefaultMutableTreeNode newNode;
195
        for (int i=0 ; i<nodes.length ; i++) {
196
            newNode = new DefaultMutableTreeNode(nodes[i]);
197
            if (processChildren(newNode, level - 1)) {
198
                node.add(newNode);
199
            }
200
        }
201
        return true;
202
    } 
203

  
204
/**
205
 * 
206
 * 
207
 * 
208
 * @param ctt 
209
 */
210
    public void configureView(XMLTreeTable ctt) {        
211
        Column col;
212
        javax.swing.table.TableColumnModel tcm = ctt.getColumnModel();
213
        ctt.setRowHeight(20);
214
        int total = 0;
215
        for (int i = 1; i < tcm.getColumnCount(); i++) {
216
            col = ((Column) columns.elementAt(i - 1));
217
            tcm.getColumn(i).setPreferredWidth(50);
218
            total += col.width;
219
            tcm.getColumn(i).setCellRenderer(new XMLTreeTableCellRenderer());
220
        }
221
        tcm.getColumn(0).setWidth(100);
222
        setExpandedTree((DefaultMutableTreeNode) getRoot(), ctt.getTree());
223
    } 
224

  
225
/**
226
 * 
227
 * 
228
 * 
229
 * @return 
230
 * @param node 
231
 * @param tree 
232
 */
233
    public boolean setExpandedTree(DefaultMutableTreeNode node, JTree tree) {        
234
        boolean isExpanded = false;
235
        Enumeration children = node.children();
236
        while (children.hasMoreElements()) {
237
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();
238
            if (setExpandedTree(child, tree) && (isExpanded == false)) {
239
                isExpanded = true;
240
            }
241
        }
242
        if (node.isLeaf() && (isValueAt(node) || isAttributeAt(node))) {
243
            tree.expandPath(new TreePath(node.getPath()));
244
            return true;
245
        }
246
        if (isExpanded) {
247
            tree.expandPath(new TreePath(node.getPath()));
248
        }
249
        return isExpanded;
250
    } 
251

  
252
/**
253
 * 
254
 * 
255
 * 
256
 * @param name 
257
 * @param attribute 
258
 * @param label 
259
 * @param width 
260
 */
261
    public void addJScrollPaneColumn(String name, String attribute, String label, int width) {        
262
        addColumn(new Column(name, attribute, label, ALIGN_LEFT, width,
263
                JScrollPane.class, null));
264
    } 
265

  
266
/**
267
 * 
268
 * 
269
 * 
270
 * @param name 
271
 * @param attribute 
272
 * @param label 
273
 * @param width 
274
 */
275
    public void addStringColumn(String name, String attribute, String label, int width) {        
276
        addColumn(new Column(name, attribute, label, ALIGN_LEFT, width,
277
                String.class, null));
278
    } 
279

  
280
/**
281
 * 
282
 * 
283
 * 
284
 * @param name 
285
 * @param attribute 
286
 * @param label 
287
 * @param width 
288
 * @param format 
289
 */
290
    public void addNumberColumn(String name, String attribute, String label, int width, String format) {        
291
        addColumn(new Column(name, attribute, label, ALIGN_RIGHT, width,
292
                Double.class, format));
293
    } 
294

  
295
/**
296
 * 
297
 * 
298
 * 
299
 * @param name 
300
 * @param attribute 
301
 * @param label 
302
 * @param width 
303
 * @param format 
304
 */
305
    public void addDateColumn(String name, String attribute, String label, int width, String format) {        
306
        addColumn(new Column(name, attribute, label, ALIGN_LEFT, width,
307
                Date.class, format));
308
    } 
309

  
310
/**
311
 * 
312
 * 
313
 * 
314
 * @param column 
315
 */
316
    public void addColumn(Column column) {        
317
        if (columns == null) {
318
            columns = new Vector();
319
        }
320
        columns.add(column);
321
    } 
322

  
323
/**
324
 * 
325
 * 
326
 * 
327
 * @return 
328
 * @param parent 
329
 */
330
    public int getChildCount(Object parent) {        
331
        return ((DefaultMutableTreeNode) parent).getChildCount();
332
    } 
333

  
334
/**
335
 * 
336
 * 
337
 * 
338
 * @return 
339
 * @param parent 
340
 * @param index 
341
 */
342
    public Object getChild(Object parent, int index) {        
343
        return ((DefaultMutableTreeNode) parent).getChildAt(index);
344
    } 
345

  
346
/**
347
 * 
348
 * 
349
 * 
350
 * @return 
351
 * @param column 
352
 */
353
    public String getColumnName(int column) {        
354
        if (column == 0) {
355
            return "";
356
        }
357
        return ((Column) columns.elementAt(column - 1)).label;
358
    } 
359

  
360
/**
361
 * 
362
 * 
363
 * 
364
 * @return 
365
 * @param column 
366
 */
367
    public Class getColumnClass(int column) {        
368
        if (column == 0) {
369
            return TreeTableModel.class;
370
        }
371
        return ((Column) columns.elementAt(column - 1)).jClass;
372
    } 
373

  
374
/**
375
 * 
376
 * 
377
 * 
378
 * @return 
379
 * @param node 
380
 */
381
    public boolean isValueAt(Object node) {        
382
        DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) node;
383
        if (currentNode.getUserObject() instanceof XMLNode) {
384
            XMLNode xr = (XMLNode) currentNode.getUserObject();
385
            if (xr != null) {
386
                if (xr.getText() != null) {
387
                    if (!(Strings.replace(xr.getText(), " ", "").equals(""))) {
388
                        return true;
389
                    }
390
                }
391
            }
392
        }
393
        return false;
394
    } 
395

  
396
/**
397
 * 
398
 * 
399
 * 
400
 * @return 
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff