svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / table / gui / TableProperties.java @ 10626
History | View | Annotate | Download (11 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.project.documents.table.gui; |
42 |
|
43 |
|
44 |
import java.awt.GridLayout; |
45 |
|
46 |
import javax.swing.JPanel; |
47 |
import javax.swing.JTable; |
48 |
|
49 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
50 |
|
51 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
52 |
import com.iver.andami.PluginServices; |
53 |
import com.iver.andami.ui.mdiManager.SingletonWindow; |
54 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
55 |
import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
56 |
|
57 |
/**
|
58 |
* Dialogo de propiedades de la tabla
|
59 |
*
|
60 |
* @author Fernando Gonz?lez Cort?s
|
61 |
*/
|
62 |
public class TableProperties extends JPanel implements SingletonWindow { |
63 |
private javax.swing.JLabel jLabel = null; |
64 |
private javax.swing.JTextField txtName = null; |
65 |
private javax.swing.JLabel jLabel1 = null; |
66 |
private javax.swing.JTextField txtDate = null; |
67 |
private javax.swing.JTextField txtOwner = null; |
68 |
private javax.swing.JLabel jLabel2 = null; |
69 |
private javax.swing.JLabel jLabel3 = null; |
70 |
private javax.swing.JScrollPane jScrollPane = null; |
71 |
private javax.swing.JTextArea txtComments = null; |
72 |
private javax.swing.JScrollPane jScrollPane1 = null; |
73 |
private javax.swing.JTable tabla = null; |
74 |
private ProjectTable table;
|
75 |
private AcceptCancelPanel okCancelPanel = null; |
76 |
private javax.swing.JPanel jPanel = null; |
77 |
private javax.swing.JPanel jPanel1 = null; |
78 |
/**
|
79 |
* This is the default constructor
|
80 |
*
|
81 |
* @param f Frame padre del di?logo
|
82 |
* @param t Tabla que se representa en el di?logo
|
83 |
* @throws DriverException
|
84 |
*/
|
85 |
public TableProperties(ProjectTable t) {
|
86 |
table = t; |
87 |
|
88 |
initialize(); |
89 |
} |
90 |
|
91 |
/**
|
92 |
* This method initializes this
|
93 |
* @throws DriverException
|
94 |
*/
|
95 |
private void initialize() { |
96 |
|
97 |
java.awt.FlowLayout layFlowLayout7 = new java.awt.FlowLayout();
|
98 |
layFlowLayout7.setHgap(0);
|
99 |
setLayout(layFlowLayout7); |
100 |
add(getJPanel(), null);
|
101 |
add(getJPanel1(), null);
|
102 |
add(getJLabel3(), null);
|
103 |
add(getJScrollPane(), null);
|
104 |
add(getJScrollPane1(), null);
|
105 |
add(getOkCancelPanel(),null);
|
106 |
//add(getBtnOk(), null);
|
107 |
//add(getJLabel4(), null);
|
108 |
//add(getBtnCancel(), null);
|
109 |
|
110 |
txtName.setText(table.getName()); |
111 |
txtDate.setText(table.getCreationDate()); |
112 |
txtOwner.setText(table.getOwner()); |
113 |
txtComments.setText(table.getComment()); |
114 |
|
115 |
tabla.setModel(new TableModelProperties(table));
|
116 |
|
117 |
// TODO: provisional hasta que revisemos lo del mapeado de campos.
|
118 |
tabla.setVisible(true);
|
119 |
tabla.getTableHeader().setVisible(true);
|
120 |
} |
121 |
|
122 |
/**
|
123 |
* This method initializes jLabel
|
124 |
*
|
125 |
* @return javax.swing.JLabel
|
126 |
*/
|
127 |
private javax.swing.JLabel getJLabel() {
|
128 |
if (jLabel == null) { |
129 |
jLabel = new javax.swing.JLabel();
|
130 |
jLabel.setText(PluginServices.getText(this, "nombre") + ":"); |
131 |
} |
132 |
|
133 |
return jLabel;
|
134 |
} |
135 |
|
136 |
/**
|
137 |
* This method initializes txtName
|
138 |
*
|
139 |
* @return javax.swing.JTextField
|
140 |
*/
|
141 |
private javax.swing.JTextField getTxtName() {
|
142 |
if (txtName == null) { |
143 |
txtName = new javax.swing.JTextField();
|
144 |
txtName.setPreferredSize(new java.awt.Dimension(190, 20)); |
145 |
} |
146 |
|
147 |
return txtName;
|
148 |
} |
149 |
|
150 |
/**
|
151 |
* This method initializes jLabel1
|
152 |
*
|
153 |
* @return javax.swing.JLabel
|
154 |
*/
|
155 |
private javax.swing.JLabel getJLabel1() {
|
156 |
if (jLabel1 == null) { |
157 |
jLabel1 = new javax.swing.JLabel();
|
158 |
jLabel1.setText(PluginServices.getText(this, "creation_date") + ":"); |
159 |
} |
160 |
|
161 |
return jLabel1;
|
162 |
} |
163 |
|
164 |
/**
|
165 |
* This method initializes txtDate
|
166 |
*
|
167 |
* @return javax.swing.JTextField
|
168 |
*/
|
169 |
private javax.swing.JTextField getTxtDate() {
|
170 |
if (txtDate == null) { |
171 |
txtDate = new javax.swing.JTextField();
|
172 |
txtDate.setPreferredSize(new java.awt.Dimension(190, 20)); |
173 |
txtDate.setEditable(false);
|
174 |
txtDate.setBackground(java.awt.Color.white); |
175 |
} |
176 |
|
177 |
return txtDate;
|
178 |
} |
179 |
|
180 |
/**
|
181 |
* This method initializes txtOwner
|
182 |
*
|
183 |
* @return javax.swing.JTextField
|
184 |
*/
|
185 |
private javax.swing.JTextField getTxtOwner() {
|
186 |
if (txtOwner == null) { |
187 |
txtOwner = new javax.swing.JTextField();
|
188 |
txtOwner.setPreferredSize(new java.awt.Dimension(190, 20)); |
189 |
} |
190 |
|
191 |
return txtOwner;
|
192 |
} |
193 |
|
194 |
/**
|
195 |
* This method initializes jLabel2
|
196 |
*
|
197 |
* @return javax.swing.JLabel
|
198 |
*/
|
199 |
private javax.swing.JLabel getJLabel2() {
|
200 |
if (jLabel2 == null) { |
201 |
jLabel2 = new javax.swing.JLabel();
|
202 |
jLabel2.setText(PluginServices.getText(this, "owner") + ":"); |
203 |
} |
204 |
|
205 |
return jLabel2;
|
206 |
} |
207 |
|
208 |
/**
|
209 |
* This method initializes jLabel3
|
210 |
*
|
211 |
* @return javax.swing.JLabel
|
212 |
*/
|
213 |
private javax.swing.JLabel getJLabel3() {
|
214 |
if (jLabel3 == null) { |
215 |
jLabel3 = new javax.swing.JLabel();
|
216 |
jLabel3.setText(PluginServices.getText(this, "comentarios") + ":"); |
217 |
jLabel3.setPreferredSize(new java.awt.Dimension(320,16)); |
218 |
} |
219 |
|
220 |
return jLabel3;
|
221 |
} |
222 |
|
223 |
/**
|
224 |
* This method initializes jScrollPane
|
225 |
*
|
226 |
* @return javax.swing.JScrollPane
|
227 |
*/
|
228 |
private javax.swing.JScrollPane getJScrollPane() {
|
229 |
if (jScrollPane == null) { |
230 |
jScrollPane = new javax.swing.JScrollPane();
|
231 |
jScrollPane.setViewportView(getTxtComments()); |
232 |
jScrollPane.setPreferredSize(new java.awt.Dimension(320, 70)); |
233 |
} |
234 |
|
235 |
return jScrollPane;
|
236 |
} |
237 |
|
238 |
/**
|
239 |
* This method initializes txtComments
|
240 |
*
|
241 |
* @return javax.swing.JTextArea
|
242 |
*/
|
243 |
private javax.swing.JTextArea getTxtComments() {
|
244 |
if (txtComments == null) { |
245 |
txtComments = new javax.swing.JTextArea();
|
246 |
} |
247 |
|
248 |
return txtComments;
|
249 |
} |
250 |
|
251 |
/**
|
252 |
* This method initializes jTable
|
253 |
*
|
254 |
* @return javax.swing.JTable
|
255 |
*/
|
256 |
private javax.swing.JTable getJTable() {
|
257 |
if (tabla == null) { |
258 |
tabla = new javax.swing.JTable();
|
259 |
tabla.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
|
260 |
} |
261 |
|
262 |
return tabla;
|
263 |
} |
264 |
|
265 |
/**
|
266 |
* This method initializes jScrollPane1
|
267 |
*
|
268 |
* @return javax.swing.JScrollPane
|
269 |
*/
|
270 |
private javax.swing.JScrollPane getJScrollPane1() {
|
271 |
if (jScrollPane1 == null) { |
272 |
jScrollPane1 = new javax.swing.JScrollPane();
|
273 |
jScrollPane1.setViewportView(getJTable()); |
274 |
jScrollPane1.setPreferredSize(new java.awt.Dimension(320, 160)); |
275 |
} |
276 |
|
277 |
return jScrollPane1;
|
278 |
} |
279 |
|
280 |
private AcceptCancelPanel getOkCancelPanel() {
|
281 |
if (okCancelPanel == null) { |
282 |
okCancelPanel = new AcceptCancelPanel(
|
283 |
new java.awt.event.ActionListener() {
|
284 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
285 |
table.setName(txtName.getText()); |
286 |
table.setCreationDate(txtDate.getText()); |
287 |
table.setOwner(txtOwner.getText()); |
288 |
table.setComment(txtComments.getText()); |
289 |
|
290 |
TableModelProperties tm = (TableModelProperties) getJTable().getModel(); |
291 |
table.setAliases(tm.getAliases()); |
292 |
table.setMapping(tm.getFieldMapping()); |
293 |
PluginServices.getMDIManager().closeWindow(TableProperties.this); |
294 |
} |
295 |
} |
296 |
, |
297 |
new java.awt.event.ActionListener() {
|
298 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
299 |
PluginServices.getMDIManager().closeWindow(TableProperties.this); |
300 |
} |
301 |
} |
302 |
); |
303 |
okCancelPanel.setPreferredSize(new java.awt.Dimension(339, 30)); |
304 |
} |
305 |
return okCancelPanel;
|
306 |
} |
307 |
|
308 |
|
309 |
/**
|
310 |
* This method initializes jPanel
|
311 |
*
|
312 |
* @return javax.swing.JPanel
|
313 |
*/
|
314 |
private javax.swing.JPanel getJPanel() {
|
315 |
if (jPanel == null) { |
316 |
jPanel = new javax.swing.JPanel();
|
317 |
|
318 |
/*
|
319 |
java.awt.FlowLayout layFlowLayout9 = new java.awt.FlowLayout();
|
320 |
layFlowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
|
321 |
layFlowLayout9.setVgap(9);
|
322 |
jPanel.setLayout(layFlowLayout9);
|
323 |
|
324 |
*/
|
325 |
|
326 |
GridLayout layout = new GridLayout(3,1); |
327 |
layout.setVgap(5);
|
328 |
jPanel.setLayout(layout); |
329 |
|
330 |
|
331 |
jPanel.add(getJLabel(), null);
|
332 |
jPanel.add(getJLabel1(), null);
|
333 |
jPanel.add(getJLabel2(), null);
|
334 |
jPanel.setPreferredSize(new java.awt.Dimension(130, 80)); |
335 |
} |
336 |
|
337 |
return jPanel;
|
338 |
} |
339 |
|
340 |
/**
|
341 |
* This method initializes jPanel1
|
342 |
*
|
343 |
* @return javax.swing.JPanel
|
344 |
*/
|
345 |
private javax.swing.JPanel getJPanel1() {
|
346 |
if (jPanel1 == null) { |
347 |
jPanel1 = new javax.swing.JPanel();
|
348 |
|
349 |
java.awt.FlowLayout layFlowLayout8 = new java.awt.FlowLayout();
|
350 |
layFlowLayout8.setAlignment(java.awt.FlowLayout.LEFT); |
351 |
jPanel1.setLayout(layFlowLayout8); |
352 |
jPanel1.add(getTxtName(), null);
|
353 |
jPanel1.add(getTxtDate(), null);
|
354 |
jPanel1.add(getTxtOwner(), null);
|
355 |
jPanel1.setPreferredSize(new java.awt.Dimension(200, 80)); |
356 |
} |
357 |
|
358 |
return jPanel1;
|
359 |
} |
360 |
|
361 |
/**
|
362 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
363 |
*/
|
364 |
public WindowInfo getWindowInfo() {
|
365 |
WindowInfo m_viewinfo=new WindowInfo();
|
366 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_tabla")); |
367 |
m_viewinfo.setWidth(349);
|
368 |
m_viewinfo.setHeight(375);
|
369 |
|
370 |
return m_viewinfo;
|
371 |
} |
372 |
|
373 |
/**
|
374 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
375 |
*/
|
376 |
public void viewActivated() { |
377 |
} |
378 |
|
379 |
/**
|
380 |
* @see com.iver.andami.ui.mdiManager.SingletonWindow#getWindowModel()
|
381 |
*/
|
382 |
public Object getWindowModel() { |
383 |
return table;
|
384 |
} |
385 |
} |
386 |
|
387 |
|
388 |
// @jve:visual-info decl-index=0 visual-constraint="10,10"
|