Revision 38352

View differences:

tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Tue May 29 16:38:16 CEST 2012
3
buildNumber=13
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/test/resources/README.txt
1
Put into this folder the resources needed by your test classes.
2

  
3
This folder is added to the Tests classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your tests classes.
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.app.document.table">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<libraries library-dir="lib"/>
4
    <depends plugin-name="org.gvsig.app" />
5
	<resourceBundle name="text"/>
6
    <extensions>
7
		<extension class-name="org.gvsig.app.extension.TableExtension"
8
			description="Extensi?n encargada de a?adir soporte a documentos tabla."
9
			active="true"
10
			priority="10">
11

  
12
			<menu text="Tabla"
13
				position="400"
14
				is_separator="true"/>
15
				
16
		</extension>
17

  
18
		<extension class-name="org.gvsig.app.extension.ClearSelectionExtension"
19
			description="Extensi?n encargada de limpiar la selecci?n."
20
			active="true">
21
			<menu text="Capa/clear_selection" position="35010" action-command="DEL_SELECTION" icon="view-clear-selection"/>
22
			<tool-bar name="Tools_Select" position="6">
23
				<action-tool icon="view-clear-selection" action-command="DEL_SELECTION"  tooltip="clear_selection" position="4"/>
24
			</tool-bar>
25
		</extension>
26

  
27
		<extension class-name="org.gvsig.app.extension.ShowTable"
28
			description="Extensi?n encargada de abrir la tabla asociada a la capa seleccionado."
29
			active="true">
30
			<menu text="Capa/ver_tabla_atributos" position="35020" icon="layer-show-attribute-table"/>
31
			<tool-bar name="Acciones" position="13">
32
				<action-tool icon="layer-show-attribute-table"
33
					enableText="Un_Layer"
34
					tooltip="Muestra_atributos" position="1"/>
35
			</tool-bar>
36
		</extension>
37

  
38
		<extension class-name="org.gvsig.app.extension.TableOperations"
39
			description="Extensi?n encargada de gestionar las operaciones sobre las tablas."
40
			active="true">
41
			<menu text="Tabla/link" position="40010" icon="table-link" action-command="LINK"/>
42
			<tool-bar name="Herramientas" position="12">
43
				<action-tool icon="table-link" action-command="LINK" tooltip="link" position="2"/>
44
			</tool-bar>
45
		</extension>
46

  
47
		<extension class-name="org.gvsig.app.extension.RedoTableExtension"
48
			description="Extensi?n encargada de rehacer la edici?n sobre la capa activa."
49
			active="true">
50
			<menu text="Tabla/rehacer" position="40014" action-command="REDO" icon="table-redo"/>
51
			<tool-bar name="modificar" position="12">
52
				<action-tool name="rehacer" icon="table-redo" action-command="REDO" tooltip="rehacer" group="tabla" position="2"/>
53
			</tool-bar>
54
		</extension>
55

  
56
		<extension class-name="org.gvsig.app.extension.UndoTableExtension"
57
			description="Extensi?n encargada de dehacer la edici?n sobre la capa activa."
58
			active="true">
59
			<menu text="Tabla/deshacer" position="40016" action-command="UNDO" icon="table-undo"/>
60
			<tool-bar name="modificar" position="12">
61
				<action-tool name="deshacer" icon="table-undo" action-command="UNDO" tooltip="deshacer" group="tabla" position="1"/>
62
			</tool-bar>
63
		</extension>
64

  
65
		<extension class-name="org.gvsig.app.extension.TableEditStopExtension"
66
			description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas."
67
			active="true">
68
			<menu text="Tabla/stop_edition" position="40020" action-command="STOPEDITING"/>
69
		</extension>
70
		<extension class-name="org.gvsig.app.extension.TableEditStartExtension"
71
			description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas."
72
			active="true">
73
			<menu text="Tabla/start_edition" position="40024" action-command="STARTEDIT"/>
74
		</extension>
75
		<extension class-name="org.gvsig.app.extension.TableEditInsertExtension"
76
			description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas."
77
			active="true">
78
			<menu text="Tabla/insert_row" position="40026" action-command="INSERTROW"/>
79
		</extension>
80
		<extension class-name="org.gvsig.app.extension.TableEditRemoveRowExtension"
81
			description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas."
82
			active="true">
83
			<menu text="Tabla/remove_row" position="40030" action-command="REMOVEROW"/>
84
		</extension>
85
		<extension class-name="org.gvsig.app.extension.TableEditChangeColumnsExtension"
86
			description="Extensi?n encargada de gestionar las operaciones de edici?n de columnas sobre las tablas."
87
			active="true">
88
			<menu text="Tabla/add_column" position="40034" action-command="ADDCOLUMN"/>
89
			<menu text="Tabla/rename_column" position="40036" action-command="RENAMECOLUMN"/>
90
			<menu text="Tabla/remove_column" position="40040" action-command="REMOVECOLUMN"/>
91
		</extension>
92
		<extension class-name="org.gvsig.app.extension.TableEditAttributes"
93
			description="Extensi?n encargada de gestionar los campos de las tablas."
94
			active="true">
95
			<menu text="Tabla/manage_fields" position="40044" action-command="MANAGE_FIELDS"/>
96
		</extension>
97

  
98
		<extension class-name="org.gvsig.app.extension.TableEditCopyExtension"
99
			description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas."
100
			active="true">
101
			<menu text="Tabla/copy" position="40046" icon="edit-copy" action-command="COPY"/>
102
		</extension>
103

  
104
		<extension class-name="org.gvsig.app.extension.TableEditCutExtension"
105
			description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas."
106
			active="true">
107
			<menu text="Tabla/cut" position="40050" icon="edit-cut" action-command="CUT"/>
108
		</extension>
109

  
110
		<extension class-name="org.gvsig.app.extension.TableEditPasteExtension"
111
			description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas."
112
			active="true">
113
			<menu text="Tabla/paste" position="40054" icon="edit-paste" action-command="PASTE"/>
114
		</extension>
115

  
116
		<extension active="true" class-name="org.gvsig.app.extension.TableFieldOperations"
117
			description="Operaciones sobre los campos de las tablas">
118
			<menu text="Tabla/ascending_order" position="40056" icon="table-order-asc" action-command="ORDERASC"/>
119
			<menu text="Tabla/descending_order" position="40060" icon="table-order-desc" action-command="ORDERDESC"/>
120
			<tool-bar name="Herramientas" position="12">
121
				<action-tool icon="table-order-asc" tooltip="ascending_order_tooltip" action-command="ORDERASC" position="3"/>
122
				<action-tool icon="table-order-desc" tooltip="descending_order_tooltip" action-command="ORDERDESC" position="4"/>
123
			</tool-bar>
124
		</extension>
125

  
126
		<extension class-name="org.gvsig.app.extension.TableNumericFieldOperations"
127
			description="Extensi?n encargada de gestionar las operaciones sobre los campos num?ricos."
128
			active="true">
129
			<menu text="Tabla/statistics" position="40064" icon="table-statistics"/>
130
			<tool-bar name="Herramientas" position="12">
131
				<action-tool icon="table-statistics" tooltip="statistics" position="5"/>
132
			</tool-bar>
133
		</extension>
134

  
135
		<extension class-name="org.gvsig.app.extension.TableRowsOperations"
136
			description="Extensi?n encargada de gestionar la selecci?n en la tabla."
137
			active="true">
138
			<menu text="Tabla/selection_up" position="40066" action-command="SELECTIONUP" icon="table-selection-up"/>
139
			<menu text="Tabla/invert_selection" position="40070" action-command="INVERTSELECTION" icon="table-invert"/>
140
			<tool-bar name="Herramientas" position="12">
141
				<action-tool icon="table-selection-up" action-command="SELECTIONUP" tooltip="selection_up" position="6"/>
142
				<action-tool icon="table-invert" action-command="INVERTSELECTION" tooltip="invert_selection" position="7"/>
143
			</tool-bar>
144
		</extension>
145

  
146
		<extension class-name="org.gvsig.app.extension.RemoveTableLink"
147
			description="Extensi?n encargada de quitar los enlaces de las tablas."
148
			active="true">
149
			<menu text="Tabla/quitar_enlaces" position="40076" />
150
		</extension>
151

  
152
		<extension class-name="org.gvsig.app.extension.PrintTable"
153
			description="Extensi?n encargada de la impresi?n de las tablas."
154
			active="true">
155
			<menu text="Tabla/Imprimir" position="40080" icon="document-print" action-command="PRINTTABLE" tooltip="Imprimir"/>
156
			<tool-bar name="Tabla" position="10">
157
				<action-tool icon="document-print" action-command="PRINTTABLE" tooltip="Imprimir"/>
158
			</tool-bar>
159
		</extension>
160
        
161
        <extension class-name="org.gvsig.app.extension.ZoomToSelectExtension"
162
            description="Extensi?n encargada de gestionar los eventos realizados sobre una capa."
163
            active="true">
164
            <menu text="Vista/navegacion/Zoom_Select" position="3002090" action-command="ZOOM_SELECT" icon="view-zoom-to-seleccion"/>
165
            <tool-bar name="View_Tools_Zooms" position="3">
166
                <action-tool icon="view-zoom-to-seleccion" action-command="ZOOM_SELECT"  tooltip="Zoom_Select" position="7"/>
167
            </tool-bar>
168
        </extension>
169

  
170
        <extension class-name="org.gvsig.app.extension.FiltroExtension"
171
            description="Extensi?n encargada de abrir el di?logo para filtrar una tabla."
172
            active="true">
173
            <menu text="Tabla/filtro" position="40074" icon="table-filter" action-command="FILTRO"/>
174
            <tool-bar name="Herramientas" position="12">
175
                <action-tool icon="table-filter" action-command="FILTRO" tooltip="filtro" position="7"/>
176
            </tool-bar>
177
        </extension>
178

  
179
	</extensions>
180
	<icon src="gvsig-logo-icon" text="gvSIG"/>
181
</plugin-config>
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/TableSelectionModel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.app.project.documents.table;
23

  
24
import org.gvsig.utils.swing.objectSelection.ObjectSelectionModel;
25

  
26
/**
27
 * @author Fernando Gonz?lez Cort?s
28
 */
29
public class TableSelectionModel implements ObjectSelectionModel {
30

  
31
    private TableDocument[] tables;
32
    private String msg;
33

  
34
    public TableSelectionModel(TableDocument[] tables, String msg) {
35
        this.tables = tables;
36
        this.msg = msg;
37
    }
38

  
39
    /**
40
     * @see org.gvsig.app.project.documents.table.TableSelectionModel#getTables()
41
     */
42
    public Object[] getObjects() {
43
        return tables;
44
    }
45

  
46
    /**
47
     * @see org.gvsig.utils.swing.objectSelection.ObjectSelectionModel#getMsg()
48
     */
49
    public String getMsg() {
50
        return msg;
51
    }
52

  
53
}
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.landregistryviewer package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Table document support</p>
11

  
12
</body>
13
</html>
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/exceptions/TableEditingException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.app.project.documents.table.exceptions;
23

  
24
import org.gvsig.tools.exception.BaseException;
25

  
26
/**
27
 * @author gvSIG Team
28
 * @version $Id$
29
 */
30
public class TableEditingException extends BaseException {
31

  
32
    private static final long serialVersionUID = -3672330283934624242L;
33
    private static final String KEY = "error_editing_table";
34
    private static final String FORMAT = "Can't edit the table: %(table) ";
35

  
36
    public TableEditingException(String table, Throwable exception) {
37
        super(FORMAT, exception, KEY, serialVersionUID);
38
        setValue("table", table);
39
    }
40
}
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/exceptions/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.landregistryviewer package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Table document exceptions</p>
11

  
12
</body>
13
</html>
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/exceptions/CancelEditingTableException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.app.project.documents.table.exceptions;
23

  
24
/**
25
 * @author Vicente Caballero Navarro
26
 */
27
public class CancelEditingTableException extends TableEditingException {
28

  
29
    /**
30
	 * 
31
	 */
32
    private static final long serialVersionUID = 5231674331725098637L;
33

  
34
    public CancelEditingTableException(String table, Throwable exception) {
35
        super(table, exception);
36
        init();
37
        initCause(exception);
38
    }
39

  
40
    private void init() {
41
        messageKey = "error_cancel_editing_table";
42
        formatString = "Can�t cancel editing the table: %(table) ";
43
    }
44

  
45
}
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/exceptions/StopEditingTableException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.app.project.documents.table.exceptions;
23

  
24
/**
25
 * @author Vicente Caballero Navarro
26
 */
27
public class StopEditingTableException extends TableEditingException {
28

  
29
    /**
30
	 * 
31
	 */
32
    private static final long serialVersionUID = 1663393663065092896L;
33

  
34
    public StopEditingTableException(String table, Throwable exception) {
35
        super(table, exception);
36
        init();
37
        initCause(exception);
38
    }
39

  
40
    private void init() {
41
        messageKey = "error_stop_editing_table";
42
        formatString = "Can�t stop editing the table: %(table) ";
43
    }
44

  
45
}
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/exceptions/StartEditingTableException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.app.project.documents.table.exceptions;
23

  
24
/**
25
 * @author Vicente Caballero Navarro
26
 */
27
public class StartEditingTableException extends TableEditingException {
28

  
29
    /**
30
	 * 
31
	 */
32
    private static final long serialVersionUID = 8031152738000164873L;
33

  
34
    public StartEditingTableException(String table, Throwable exception) {
35
        super(table, exception);
36
        init();
37
        initCause(exception);
38
    }
39

  
40
    private void init() {
41
        messageKey = "error_start_editing_table";
42
        formatString = "Can�t start editing the table: %(table) ";
43
    }
44

  
45
}
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/TableManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2004-2009 IVER TI
26
 *   
27
 */
28

  
29
package org.gvsig.app.project.documents.table;
30

  
31
import java.util.Iterator;
32
import java.util.List;
33

  
34
import javax.swing.ImageIcon;
35

  
36
import org.gvsig.andami.PluginServices;
37
import org.gvsig.andami.messages.NotificationManager;
38
import org.gvsig.andami.ui.mdiManager.IWindow;
39
import org.gvsig.app.ApplicationLocator;
40
import org.gvsig.app.addlayer.AddLayerDialog;
41
import org.gvsig.app.extension.AddLayer;
42
import org.gvsig.app.gui.WizardPanel;
43
import org.gvsig.app.project.Project;
44
import org.gvsig.app.project.ProjectManager;
45
import org.gvsig.app.project.documents.AbstractDocument;
46
import org.gvsig.app.project.documents.AbstractDocumentManager;
47
import org.gvsig.app.project.documents.Document;
48
import org.gvsig.app.project.documents.gui.IDocumentWindow;
49
import org.gvsig.app.project.documents.gui.WindowLayout;
50
import org.gvsig.app.project.documents.table.TableDocument.TableLink;
51
import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel;
52
import org.gvsig.app.project.documents.table.gui.TableProperties;
53
import org.gvsig.fmap.dal.feature.FeatureQuery;
54
import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
55
import org.gvsig.fmap.dal.feature.FeatureStore;
56
import org.gvsig.fmap.dal.serverexplorer.filesystem.swing.FilesystemExplorerWizardPanel;
57
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
58
import org.gvsig.tools.ToolsLocator;
59
import org.gvsig.tools.dynobject.DynObjectManager;
60
import org.gvsig.tools.dynobject.DynStruct;
61
import org.gvsig.tools.evaluator.Evaluator;
62
import org.gvsig.tools.persistence.PersistenceManager;
63

  
64
/**
65
 * Factory of Table.
66
 * 
67
 * @author 2005- Vicente Caballero
68
 * @author 2009- Joaquin del Cerro
69
 * 
70
 */
71
public class TableManager extends AbstractDocumentManager {
72

  
73
    public static final String PERSISTENCE_TABLE_DOCUMENT_DEFINITION_NAME =
74
        "TableDocument";
75
    public static final String PERSISTENCE_TABLELINK_DEFINITION_NAME =
76
        "TableLink";
77

  
78
    public static String TYPENAME = "project.document.table";
79

  
80
    private DynStruct persistenceDefinition = null;
81

  
82
    public ImageIcon getIcon() {
83
        return PluginServices.getIconTheme().get("document-table-icon");
84
    }
85

  
86
    public ImageIcon getIconSelected() {
87
        return PluginServices.getIconTheme().get("document-table-icon-sel");
88
    }
89

  
90
    public String getTitle() {
91
        return PluginServices.getText(this, "Tabla");
92
    }
93

  
94
    public String getTypeName() {
95
        return TYPENAME;
96
    }
97

  
98
    public int getPriority() {
99
        return 1;
100
    }
101

  
102
    public Iterator<? extends Document> createDocumentsByUser() {
103
        AddLayerDialog fopen = null;
104
        try {
105
            fopen =
106
                new AddLayerDialog(PluginServices.getText(this, "Nueva_tabla"));
107
            List<WizardPanel> wizards =
108
                ApplicationLocator.getManager().getWizardPanels();
109
            WizardPanel panel;
110
            Iterator<WizardPanel> iter = wizards.iterator();
111
            while (iter.hasNext()) {
112
                panel = iter.next();
113
                fopen.addWizardTab(panel.getTabName(), panel);
114
                panel.initWizard();
115
            }
116
            PluginServices.getMDIManager().addWindow(fopen);
117
            if (fopen.isAccepted()) {
118
                panel = (WizardPanel) fopen.getSelectedTab();
119
                @SuppressWarnings("unchecked")
120
                List<TableDocument> docs =
121
                    (List<TableDocument>) panel.executeWizard();
122
                return docs.iterator();
123
            }
124
        } catch (Exception e) {
125
            NotificationManager.addError(e);
126
        } finally {
127
            if (fopen != null) {
128
                fopen.dispose();
129
                fopen = null;
130
            }
131
        }
132
        return null;
133
    }
134

  
135
    public AbstractDocument createDocumentByUser() {
136
        return (AbstractDocument) createDocumentsByUser().next();
137
    }
138

  
139
    /**
140
     * Registers in the points of extension the Factory with alias.
141
     * 
142
     */
143
    public static void register() {
144

  
145
        TableManager factory = new TableManager();
146
        // A?adimos nuestra extension para el tratamiento de la apertura de
147
        // ficheros
148
        // dentro de gvSIG
149
        ToolsLocator.getExtensionPointManager().add("FileTableOpenDialog", "")
150
            .append("FileOpenTable", "", FilesystemExplorerWizardPanel.class);
151

  
152
        ProjectManager.getInstance().registerDocumentFactory(factory);
153

  
154
        // ProjectFactory.getInstance().registerDocumentAction(TYPENAME,"copy",new
155
        // CopyDocumentContextMenuAction());
156
        // ProjectFactory.getInstance().registerDocumentAction(TYPENAME,"cut",new
157
        // CutDocumentContextMenuAction());
158
        // ProjectFactory.getInstance().registerDocumentAction(TYPENAME,"paste",new
159
        // PasteDocumentContextMenuAction());
160

  
161
        PluginServices.getIconTheme().registerDefault("document-table-icon",
162
            AddLayer.class.getClassLoader().getResource("images/tablas.png"));//
163

  
164
        PluginServices.getIconTheme().registerDefault(
165
            "document-table-icon-sel",
166
            AddLayer.class.getClassLoader()
167
                .getResource("images/tablas_sel.png"));
168

  
169
        PluginServices.getIconTheme().registerDefault("edit-copy",
170
            AddLayer.class.getClassLoader().getResource("images/editcopy.png"));//
171
        PluginServices.getIconTheme().registerDefault("edit-cut",
172
            AddLayer.class.getClassLoader().getResource("images/editcut.png"));
173
        PluginServices.getIconTheme()
174
            .registerDefault(
175
                "edit-paste",
176
                AddLayer.class.getClassLoader().getResource(
177
                    "images/editpaste.png"));
178
        PluginServices.getIconTheme().registerDefault(
179
            "edit-delete",
180
            AddLayer.class.getClassLoader()
181
                .getResource("images/editdelete.png"));
182

  
183
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
184
        manager.registerFactory(factory);
185

  
186
        if (factory.persistenceDefinition == null) {
187
            DynObjectManager dynman = ToolsLocator.getDynObjectManager();
188
            factory.persistenceDefinition =
189
                dynman.createDynClass(PersistenceManager.PERSISTENCE_NAMESPACE,
190
                    PERSISTENCE_TABLE_DOCUMENT_DEFINITION_NAME,
191
                    "Table document Persistence definition");
192
            factory.persistenceDefinition.extend(manager
193
                .getDefinition(AbstractDocument.PERSISTENCE_DEFINITION_NAME));
194

  
195
            factory.persistenceDefinition.addDynFieldObject("store")
196
                .setClassOfValue(FeatureStore.class).setMandatory(true);
197
            factory.persistenceDefinition.addDynFieldString("featureTypeId")
198
                .setMandatory(false);
199
            factory.persistenceDefinition.addDynFieldArray("attributeNames")
200
                .setClassOfItems(String.class).setMandatory(false);
201
            factory.persistenceDefinition.addDynFieldObject("associatedLayer")
202
                .setClassOfValue(FLyrVect.class).setMandatory(false);
203
            factory.persistenceDefinition.addDynFieldObject("query")
204
                .setClassOfValue(FeatureQuery.class).setMandatory(false);
205
            factory.persistenceDefinition.addDynFieldObject("baseFilter")
206
                .setClassOfValue(Evaluator.class).setMandatory(false);
207
            factory.persistenceDefinition.addDynFieldObject("baseOrder")
208
                .setClassOfValue(FeatureQueryOrder.class).setMandatory(false);
209
            factory.persistenceDefinition.addDynFieldList("linkTable")
210
                .setClassOfItems(TableLink.class).setMandatory(false);          
211
        }
212
        
213
        
214
        //Register also the TableLink
215
        if (manager.getDefinition(PERSISTENCE_TABLELINK_DEFINITION_NAME) == null){
216
            DynStruct tableLinkDefinition =
217
                manager.addDefinition(TableLink.class,
218
                    PERSISTENCE_TABLELINK_DEFINITION_NAME,
219
                    "TableLink Persistence definition", null, null);                 
220
            
221
            tableLinkDefinition.addDynFieldObject("source")
222
                .setClassOfValue(TableDocument.class).setMandatory(true);
223
            tableLinkDefinition.addDynFieldObject("target")
224
                .setClassOfValue(TableDocument.class).setMandatory(true);
225
            tableLinkDefinition.addDynFieldString("fieldSource").setMandatory(true);
226
            tableLinkDefinition.addDynFieldString("fieldTarget").setMandatory(true);
227
            tableLinkDefinition.addDynFieldBoolean("enabled").setMandatory(true);
228
        }  
229
    }
230

  
231
    /**
232
     * Create a new table document.
233
     * 
234
     * @return TableDocument.
235
     */
236
    public AbstractDocument createDocument() {
237
        return new TableDocument(this);
238
    }
239

  
240
    public Class<? extends IDocumentWindow> getMainWindowClass() {
241
        return FeatureTableDocumentPanel.class;
242
    }
243

  
244
    public IWindow getMainWindow(Document doc, WindowLayout layout) {
245
        IDocumentWindow tablePanel;
246
        tablePanel =
247
            (IDocumentWindow) PluginServices.getMDIManager()
248
                .getSingletonWindow(getMainWindowClass(), doc);
249
        if (tablePanel != null) {
250
            // The table window document is already created, return it.
251
            return tablePanel;
252
        }
253

  
254
        tablePanel = (IDocumentWindow) this.createDocumentWindow(doc);
255
        if (layout != null && tablePanel != null) {
256
            tablePanel.setWindowLayout(layout);
257
        }
258
        return tablePanel;
259
    }
260

  
261
    public IWindow getPropertiesWindow(Document doc) {
262

  
263
        // IWindow mainwin =
264
        // PluginServices.getMDIManager().getSingletonWindow(FeatureTableDocumentPanel.class,
265
        // doc);
266
        return new TableProperties((TableDocument) doc);
267
    }
268

  
269
    protected Class<? extends Document> getDocumentClass() {
270
        return TableDocument.class;
271
    }
272

  
273
    public DynStruct getDefinition(String className) {
274

  
275
        if (this.persistenceDefinition.getName().equalsIgnoreCase(className)) {
276
            return this.persistenceDefinition;
277
        }
278
        if (this.persistenceDefinition.getFullName()
279
            .equalsIgnoreCase(className)) {
280
            return this.persistenceDefinition;
281
        }
282
        if (this.getDocumentClass().getName().equals(className)) {
283
            return this.persistenceDefinition;
284
        }
285
        return null;
286
    }
287

  
288
    public boolean manages(Object object) {
289
        return object instanceof TableDocument;
290
    }
291

  
292
    public TableDocument getTableDocument(FLyrVect layer) {
293
        if (layer == null) {
294
            return null;
295
        }
296
        List<Document> tableDocs =
297
            getProject().getDocuments(TableManager.TYPENAME);
298
        for (Document document : tableDocs) {
299
            if (layer == ((TableDocument) document).getAssociatedLayer()) {
300
                return (TableDocument) document;
301
            }
302
        }
303
        return null;
304
    }
305

  
306
    public void removeTableDocument(FLyrVect layer) {
307
        TableDocument doc = getTableDocument(layer);
308
        // Only remove it if it exists
309
        if (doc != null) {
310
            PluginServices.getMDIManager().closeSingletonWindow(doc);
311
            getProject().remove(doc);
312
        }
313
    }
314

  
315
    private Project getProject() {
316
        return ProjectManager.getInstance().getCurrentProject();
317
    }
318
}
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/gui/Statistics.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.app.project.documents.table.gui;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.FlowLayout;
26
import java.awt.event.ActionEvent;
27
import java.awt.event.ActionListener;
28
import java.util.ArrayList;
29
import java.util.List;
30

  
31
import javax.swing.JButton;
32
import javax.swing.JPanel;
33
import javax.swing.JScrollPane;
34
import javax.swing.JTextArea;
35

  
36
import org.gvsig.andami.PluginServices;
37
import org.gvsig.andami.ui.mdiManager.IWindow;
38
import org.gvsig.andami.ui.mdiManager.WindowInfo;
39
import org.gvsig.app.project.documents.table.ExportStatisticsFile;
40
import org.gvsig.tools.swing.api.ToolsSwingLocator;
41

  
42
/**
43
 * @author Fernando Gonz?lez Cort?s
44
 */
45
public class Statistics extends JPanel implements IWindow {
46

  
47
    /**
48
	 * 
49
	 */
50
    private static final long serialVersionUID = 4121044001351869615L;
51
    private JScrollPane jScrollPane = null;
52
    private JTextArea txtStatistics = null;
53
    private JButton jButton = null;
54
    private JPanel jPanel = null;
55
    private JButton jButtonExport;
56

  
57
    // private Hashtable<String, Number> valores = new Hashtable<String,
58
    // Number>();
59
    // private TreeMap<String, Number> valores = new TreeMap<String, Number>();
60
    private List<MyObjectStatistics> valores =
61
        new ArrayList<MyObjectStatistics>();
62

  
63
    // private HashSet<String, Number> valores = new HashSet<String, Number>();
64
    /**
65
     * This is the default constructor
66
     */
67
    public Statistics() {
68
        super();
69
        initialize();
70
    }
71

  
72
    /**
73
     * This method initializes this
74
     * 
75
     * @return void
76
     */
77
    private void initialize() {
78
        this.setLayout(new BorderLayout());
79
        this.setSize(300, 200);
80
        this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
81
        this.add(getJPanel(), java.awt.BorderLayout.SOUTH);
82
    }
83

  
84
    /**
85
     * This method initializes jScrollPane
86
     * 
87
     * @return javax.swing.JScrollPane
88
     */
89
    private JScrollPane getJScrollPane() {
90
        if (jScrollPane == null) {
91
            jScrollPane = new JScrollPane();
92
            jScrollPane.setViewportView(getTxtStatistics());
93
        }
94
        return jScrollPane;
95
    }
96

  
97
    /**
98
     * This method initializes jTextArea
99
     * 
100
     * @return javax.swing.JTextArea
101
     */
102
    private JTextArea getTxtStatistics() {
103
        if (txtStatistics == null) {
104
            txtStatistics = new JTextArea();
105
        }
106
        return txtStatistics;
107
    }
108

  
109
    /**
110
     * This method initializes jButton
111
     * 
112
     * @return JButton
113
     */
114
    private JButton getJButton() {
115
        if (jButton == null) {
116
            jButton =
117
                ToolsSwingLocator.getUsabilitySwingManager().createJButton();
118
            jButton.setPreferredSize(new java.awt.Dimension(100, 18));
119
            jButton.setText(PluginServices.getText(this, "cerrar"));
120
            jButton.addActionListener(new ActionListener() {
121

  
122
                public void actionPerformed(ActionEvent e) {
123
                    PluginServices.getMDIManager().closeWindow(Statistics.this);
124
                }
125
            });
126
        }
127
        return jButton;
128
    }
129

  
130
    /**
131
     * This method initializes jButton
132
     * 
133
     * @return JButton
134
     *         - New JButton to Export the statistics
135
     */
136
    private JButton getJButtonExport() {
137
        if (jButtonExport == null) {
138
            jButtonExport =
139
                ToolsSwingLocator.getUsabilitySwingManager().createJButton();
140
            jButtonExport.setPreferredSize(new java.awt.Dimension(100, 18));
141
            jButtonExport.setText(PluginServices.getText(this, "exportar"));
142
            jButtonExport.addActionListener(new ActionListener() {
143

  
144
                public void actionPerformed(ActionEvent e) {
145
                    new ExportStatisticsFile(valores); // Class to export
146
                                                       // statistics to dbf or
147
                                                       // csv format
148
                }
149
            });// listener
150
        }
151
        return jButtonExport;
152
    }
153

  
154
    /**
155
     * This method initializes jPanel
156
     * 
157
     * @return javax.swing.JPanel
158
     */
159
    private JPanel getJPanel() {
160
        if (jPanel == null) {
161
            jPanel = new JPanel();
162
            FlowLayout layout = new FlowLayout();
163
            layout.setAlignment(FlowLayout.RIGHT);
164
            jPanel.setLayout(layout);
165
            jPanel.add(getJButtonExport(), null);
166
            jPanel.add(getJButton(), null);
167
        }
168
        return jPanel;
169
    }
170

  
171
    /**
172
     * @see org.gvsig.andami.ui.mdiManager.IWindow#getWindowInfo()
173
     */
174
    public WindowInfo getWindowInfo() {
175
        WindowInfo vi = new WindowInfo(WindowInfo.MODALDIALOG);
176
        vi.setTitle(PluginServices.getText(this, "estadisticas"));
177
        return vi;
178
    }
179

  
180
    /**
181
     * @param i
182
     * @param j
183
     * @param k
184
     * @param l
185
     * @param m
186
     * @param n
187
     * @param o
188
     * @param p
189
     */
190
    public void setStatistics(double media, double maximo, double minimo,
191
        double varianza, double desviacion, long numero, double ambito,
192
        double suma) {
193
        getTxtStatistics().setText(
194
            PluginServices.getText(this, "suma") + ": " + suma + "\n"
195
                + PluginServices.getText(this, "recuento") + ": " + numero
196
                + "\n" + PluginServices.getText(this, "media") + ": " + media
197
                + "\n" + PluginServices.getText(this, "maximo") + ": " + maximo
198
                + "\n" + PluginServices.getText(this, "minimo") + ": " + minimo
199
                + "\n" + PluginServices.getText(this, "ambito") + ": " + ambito
200
                + "\n" + PluginServices.getText(this, "varianza") + ": "
201
                + varianza + "\n"
202
                + PluginServices.getText(this, "desviacion_tipica") + ": "
203
                + desviacion);
204

  
205
        // Saving the statistics table values necessary in
206
        // ExportStatisticsFile.java
207
        valores.add(new MyObjectStatistics(
208
            PluginServices.getText(this, "suma"), suma));
209
        valores.add(new MyObjectStatistics(PluginServices.getText(this,
210
            "recuento"), numero));
211
        valores.add(new MyObjectStatistics(PluginServices
212
            .getText(this, "media"), media));
213
        valores.add(new MyObjectStatistics(PluginServices.getText(this,
214
            "maximo"), maximo));
215
        valores.add(new MyObjectStatistics(PluginServices.getText(this,
216
            "minimo"), minimo));
217
        valores.add(new MyObjectStatistics(PluginServices.getText(this,
218
            "ambito"), ambito));
219
        valores.add(new MyObjectStatistics(PluginServices.getText(this,
220
            "varianza"), varianza));
221
        valores.add(new MyObjectStatistics(PluginServices.getText(this,
222
            "desviacion_tipica"), desviacion));
223

  
224
    }
225

  
226
    /**
227
     * Class to create an object with key and value.
228
     * 
229
     * @author ?ngel Fraile Gri??n e-mail: angel.fraile@iver.es
230
     * 
231
     */
232

  
233
    public class MyObjectStatistics {
234

  
235
        private String key;
236
        private double value;
237

  
238
        public MyObjectStatistics(String key, double value) {
239
            this.key = key;
240
            this.value = value;
241
        }
242

  
243
        public String getKey() {
244
            return this.key;
245
        }
246

  
247
        public double getValue() {
248
            return this.value;
249
        }
250

  
251
    }
252

  
253
    public Object getWindowProfile() {
254
        return WindowInfo.DIALOG_PROFILE;
255
    }
256

  
257
}
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/gui/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.landregistryviewer package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Table document UI components</p>
11

  
12
</body>
13
</html>
tags/v2_0_0_Build_2047/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/gui/CreateNewAttributePanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.app.project.documents.table.gui;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.GridLayout;
26
import java.awt.LayoutManager;
27
import java.awt.event.ActionListener;
28
import java.awt.event.KeyEvent;
29
import java.awt.event.KeyListener;
30
import java.text.ParseException;
31

  
32
import javax.swing.JComboBox;
33
import javax.swing.JLabel;
34
import javax.swing.JPanel;
35
import javax.swing.JTextField;
36

  
37
import org.gvsig.andami.PluginServices;
38
import org.gvsig.andami.messages.NotificationManager;
39
import org.gvsig.andami.ui.mdiManager.IWindow;
40
import org.gvsig.andami.ui.mdiManager.WindowInfo;
41
import org.gvsig.fmap.dal.DataTypes;
42
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
43
import org.gvsig.fmap.dal.feature.EditableFeatureType;
44
import org.gvsig.gui.beans.AcceptCancelPanel;
45
import org.gvsig.tools.ToolsLocator;
46
import org.gvsig.tools.dataTypes.DataTypesManager;
47

  
48
/**
49
 * To create new FeatureAttributeDescriptor from the interface.
50
 * 
51
 * @author Vicente Caballero Navarro
52
 * 
53
 */
54
public class CreateNewAttributePanel extends JPanel implements IWindow {
55

  
56
    /**
57
	 * 
58
	 */
59
    private static final long serialVersionUID = 6447641307779709964L;
60
    private static final String DEFAULT_FIELD_LENGTH = "50";
61
    private JLabel jLblFieldName = null;
62
    private JTextField jTxtFieldName = null;
63
    private JLabel jLblFieldType = null;
64
    private JComboBox jCboFieldType = null;
65
    private JLabel jLblFieldLength = null;
66
    private JTextField jTxtFieldLength = null;
67
    private JLabel jLblFieldPrecision = null;
68
    private JTextField jTxtFieldPrecision = null;
69
    private JLabel jLblDefaultValue = null;
70
    private JTextField jTxtDefaultValue = null;
71
    private WindowInfo viewInfo;
72
    private JPanel jPanel = null;
73
    private AcceptCancelPanel jPanelOkCancel = null;
74
    private JPanel jPnlFields = null;
75
    private KeyListener checkInt = new KeyListener() {
76

  
77
        public void keyPressed(KeyEvent e) {
78
            // do nothing
79
        }
80

  
81
        public void keyReleased(KeyEvent e) {
82
            JTextField component = (JTextField) e.getComponent();
83

  
84
            try {
85
                component.setText(String.valueOf(Integer.parseInt(component
86
                    .getText())));
87

  
88
            } catch (Exception ex) {
89
                String text = component.getText();
90
                text =
91
                    (text.length() <= 1) ? "0" : text.substring(0,
92
                        text.length() - 1);
93
                component.setText(text);
94
            }
95
        }
96

  
97
        public void keyTyped(KeyEvent e) {
98
            // do nothing
99
        }
100
    };
101
    private String[] currentFieldNames;
102

  
103
    public CreateNewAttributePanel() {
104
        super();
105
        initialize();
106
    }
107

  
108
    public CreateNewAttributePanel(boolean isDoubleBuffered) {
109
        super(isDoubleBuffered);
110
        initialize();
111
    }
112

  
113
    public CreateNewAttributePanel(LayoutManager layout) {
114
        super(layout);
115
        initialize();
116
    }
117

  
118
    public CreateNewAttributePanel(LayoutManager layout,
119
        boolean isDoubleBuffered) {
120
        super(layout, isDoubleBuffered);
121
        initialize();
122
    }
123

  
124
    public WindowInfo getWindowInfo() {
125
        if (viewInfo == null) {
126
            viewInfo = new WindowInfo(WindowInfo.MODALDIALOG);
127
            viewInfo.setWidth(this.getWidth() + 8);
128
            viewInfo.setHeight(this.getHeight());
129
            viewInfo.setTitle(PluginServices.getText(this,
130
                "new_field_properties"));
131
        }
132
        return viewInfo;
133
    }
134

  
135
    /**
136
     * This method initializes this
137
     * 
138
     * @return void
139
     */
140
    private void initialize() {
141
        this.setLayout(new BorderLayout());
142
        this.setSize(300, 210);
143
        this.setPreferredSize(new java.awt.Dimension(300, 210));
144
        this.add(getJPanel(), java.awt.BorderLayout.CENTER);
145
        this.add(getJPanelOkCancel(), java.awt.BorderLayout.SOUTH);
146
    }
147

  
148
    /**
149
     * This method initializes jTxtFieldName
150
     * 
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff