svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / table / gui / TableProperties.java @ 8203
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 |
/**
|
59 |
* Dialogo de propiedades de la tabla
|
60 |
*
|
61 |
* @author Fernando Gonz?lez Cort?s
|
62 |
*/
|
63 |
public class TableProperties extends JPanel implements SingletonWindow { |
64 |
private javax.swing.JLabel jLabel = null; |
65 |
private javax.swing.JTextField txtName = null; |
66 |
private javax.swing.JLabel jLabel1 = null; |
67 |
private javax.swing.JTextField txtDate = null; |
68 |
private javax.swing.JTextField txtOwner = null; |
69 |
private javax.swing.JLabel jLabel2 = null; |
70 |
private javax.swing.JLabel jLabel3 = null; |
71 |
private javax.swing.JScrollPane jScrollPane = null; |
72 |
private javax.swing.JTextArea txtComments = null; |
73 |
private javax.swing.JScrollPane jScrollPane1 = null; |
74 |
private javax.swing.JTable tabla = null; |
75 |
private ProjectTable table;
|
76 |
private AcceptCancelPanel okCancelPanel = null; |
77 |
private javax.swing.JPanel jPanel = null; |
78 |
private javax.swing.JPanel jPanel1 = null; |
79 |
/**
|
80 |
* This is the default constructor
|
81 |
*
|
82 |
* @param f Frame padre del di?logo
|
83 |
* @param t Tabla que se representa en el di?logo
|
84 |
* @throws DriverException
|
85 |
*/
|
86 |
public TableProperties(ProjectTable t) {
|
87 |
table = t; |
88 |
|
89 |
initialize(); |
90 |
} |
91 |
|
92 |
/**
|
93 |
* This method initializes this
|
94 |
* @throws DriverException
|
95 |
*/
|
96 |
private void initialize() { |
97 |
|
98 |
java.awt.FlowLayout layFlowLayout7 = new java.awt.FlowLayout();
|
99 |
layFlowLayout7.setHgap(0);
|
100 |
setLayout(layFlowLayout7); |
101 |
add(getJPanel(), null);
|
102 |
add(getJPanel1(), null);
|
103 |
add(getJLabel3(), null);
|
104 |
add(getJScrollPane(), null);
|
105 |
add(getJScrollPane1(), null);
|
106 |
add(getOkCancelPanel(),null);
|
107 |
//add(getBtnOk(), null);
|
108 |
//add(getJLabel4(), null);
|
109 |
//add(getBtnCancel(), null);
|
110 |
|
111 |
txtName.setText(table.getName()); |
112 |
txtDate.setText(table.getCreationDate()); |
113 |
txtOwner.setText(table.getOwner()); |
114 |
txtComments.setText(table.getComment()); |
115 |
|
116 |
tabla.setModel(new TableModel(table)); |
117 |
|
118 |
// TODO: provisional hasta que revisemos lo del mapeado de campos.
|
119 |
tabla.setVisible(false);
|
120 |
tabla.getTableHeader().setVisible(false);
|
121 |
} |
122 |
|
123 |
/**
|
124 |
* This method initializes jLabel
|
125 |
*
|
126 |
* @return javax.swing.JLabel
|
127 |
*/
|
128 |
private javax.swing.JLabel getJLabel() {
|
129 |
if (jLabel == null) { |
130 |
jLabel = new javax.swing.JLabel();
|
131 |
jLabel.setText(PluginServices.getText(this, "nombre") + ":"); |
132 |
} |
133 |
|
134 |
return jLabel;
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* This method initializes txtName
|
139 |
*
|
140 |
* @return javax.swing.JTextField
|
141 |
*/
|
142 |
private javax.swing.JTextField getTxtName() {
|
143 |
if (txtName == null) { |
144 |
txtName = new javax.swing.JTextField();
|
145 |
txtName.setPreferredSize(new java.awt.Dimension(190, 20)); |
146 |
} |
147 |
|
148 |
return txtName;
|
149 |
} |
150 |
|
151 |
/**
|
152 |
* This method initializes jLabel1
|
153 |
*
|
154 |
* @return javax.swing.JLabel
|
155 |
*/
|
156 |
private javax.swing.JLabel getJLabel1() {
|
157 |
if (jLabel1 == null) { |
158 |
jLabel1 = new javax.swing.JLabel();
|
159 |
jLabel1.setText(PluginServices.getText(this, "creation_date") + ":"); |
160 |
} |
161 |
|
162 |
return jLabel1;
|
163 |
} |
164 |
|
165 |
/**
|
166 |
* This method initializes txtDate
|
167 |
*
|
168 |
* @return javax.swing.JTextField
|
169 |
*/
|
170 |
private javax.swing.JTextField getTxtDate() {
|
171 |
if (txtDate == null) { |
172 |
txtDate = new javax.swing.JTextField();
|
173 |
txtDate.setPreferredSize(new java.awt.Dimension(190, 20)); |
174 |
txtDate.setEditable(false);
|
175 |
txtDate.setBackground(java.awt.Color.white); |
176 |
} |
177 |
|
178 |
return txtDate;
|
179 |
} |
180 |
|
181 |
/**
|
182 |
* This method initializes txtOwner
|
183 |
*
|
184 |
* @return javax.swing.JTextField
|
185 |
*/
|
186 |
private javax.swing.JTextField getTxtOwner() {
|
187 |
if (txtOwner == null) { |
188 |
txtOwner = new javax.swing.JTextField();
|
189 |
txtOwner.setPreferredSize(new java.awt.Dimension(190, 20)); |
190 |
} |
191 |
|
192 |
return txtOwner;
|
193 |
} |
194 |
|
195 |
/**
|
196 |
* This method initializes jLabel2
|
197 |
*
|
198 |
* @return javax.swing.JLabel
|
199 |
*/
|
200 |
private javax.swing.JLabel getJLabel2() {
|
201 |
if (jLabel2 == null) { |
202 |
jLabel2 = new javax.swing.JLabel();
|
203 |
jLabel2.setText(PluginServices.getText(this, "owner") + ":"); |
204 |
} |
205 |
|
206 |
return jLabel2;
|
207 |
} |
208 |
|
209 |
/**
|
210 |
* This method initializes jLabel3
|
211 |
*
|
212 |
* @return javax.swing.JLabel
|
213 |
*/
|
214 |
private javax.swing.JLabel getJLabel3() {
|
215 |
if (jLabel3 == null) { |
216 |
jLabel3 = new javax.swing.JLabel();
|
217 |
jLabel3.setText(PluginServices.getText(this, "comentarios") + ":"); |
218 |
jLabel3.setPreferredSize(new java.awt.Dimension(320,16)); |
219 |
} |
220 |
|
221 |
return jLabel3;
|
222 |
} |
223 |
|
224 |
/**
|
225 |
* This method initializes jScrollPane
|
226 |
*
|
227 |
* @return javax.swing.JScrollPane
|
228 |
*/
|
229 |
private javax.swing.JScrollPane getJScrollPane() {
|
230 |
if (jScrollPane == null) { |
231 |
jScrollPane = new javax.swing.JScrollPane();
|
232 |
jScrollPane.setViewportView(getTxtComments()); |
233 |
jScrollPane.setPreferredSize(new java.awt.Dimension(320, 70)); |
234 |
} |
235 |
|
236 |
return jScrollPane;
|
237 |
} |
238 |
|
239 |
/**
|
240 |
* This method initializes txtComments
|
241 |
*
|
242 |
* @return javax.swing.JTextArea
|
243 |
*/
|
244 |
private javax.swing.JTextArea getTxtComments() {
|
245 |
if (txtComments == null) { |
246 |
txtComments = new javax.swing.JTextArea();
|
247 |
} |
248 |
|
249 |
return txtComments;
|
250 |
} |
251 |
|
252 |
/**
|
253 |
* This method initializes jTable
|
254 |
*
|
255 |
* @return javax.swing.JTable
|
256 |
*/
|
257 |
private javax.swing.JTable getJTable() {
|
258 |
if (tabla == null) { |
259 |
tabla = new javax.swing.JTable();
|
260 |
tabla.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
|
261 |
} |
262 |
|
263 |
return tabla;
|
264 |
} |
265 |
|
266 |
/**
|
267 |
* This method initializes jScrollPane1
|
268 |
*
|
269 |
* @return javax.swing.JScrollPane
|
270 |
*/
|
271 |
private javax.swing.JScrollPane getJScrollPane1() {
|
272 |
if (jScrollPane1 == null) { |
273 |
jScrollPane1 = new javax.swing.JScrollPane();
|
274 |
jScrollPane1.setViewportView(getJTable()); |
275 |
jScrollPane1.setPreferredSize(new java.awt.Dimension(320, 160)); |
276 |
} |
277 |
|
278 |
return jScrollPane1;
|
279 |
} |
280 |
|
281 |
private AcceptCancelPanel getOkCancelPanel() {
|
282 |
if (okCancelPanel == null) { |
283 |
okCancelPanel = new AcceptCancelPanel(
|
284 |
new java.awt.event.ActionListener() {
|
285 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
286 |
table.setName(txtName.getText()); |
287 |
table.setCreationDate(txtDate.getText()); |
288 |
table.setOwner(txtOwner.getText()); |
289 |
table.setComment(txtComments.getText()); |
290 |
|
291 |
TableModel tm = (TableModel) getJTable().getModel(); |
292 |
table.setAliases(tm.getAliases()); |
293 |
table.setMapping(tm.getFieldMapping()); |
294 |
|
295 |
PluginServices.getMDIManager().closeWindow(TableProperties.this); |
296 |
} |
297 |
} |
298 |
, |
299 |
new java.awt.event.ActionListener() {
|
300 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
301 |
PluginServices.getMDIManager().closeWindow(TableProperties.this); |
302 |
} |
303 |
} |
304 |
); |
305 |
okCancelPanel.setPreferredSize(new java.awt.Dimension(339, 30)); |
306 |
} |
307 |
return okCancelPanel;
|
308 |
} |
309 |
|
310 |
|
311 |
/**
|
312 |
* This method initializes jPanel
|
313 |
*
|
314 |
* @return javax.swing.JPanel
|
315 |
*/
|
316 |
private javax.swing.JPanel getJPanel() {
|
317 |
if (jPanel == null) { |
318 |
jPanel = new javax.swing.JPanel();
|
319 |
|
320 |
/*
|
321 |
java.awt.FlowLayout layFlowLayout9 = new java.awt.FlowLayout();
|
322 |
layFlowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
|
323 |
layFlowLayout9.setVgap(9);
|
324 |
jPanel.setLayout(layFlowLayout9);
|
325 |
|
326 |
*/
|
327 |
|
328 |
GridLayout layout = new GridLayout(3,1); |
329 |
layout.setVgap(5);
|
330 |
jPanel.setLayout(layout); |
331 |
|
332 |
|
333 |
jPanel.add(getJLabel(), null);
|
334 |
jPanel.add(getJLabel1(), null);
|
335 |
jPanel.add(getJLabel2(), null);
|
336 |
jPanel.setPreferredSize(new java.awt.Dimension(130, 80)); |
337 |
} |
338 |
|
339 |
return jPanel;
|
340 |
} |
341 |
|
342 |
/**
|
343 |
* This method initializes jPanel1
|
344 |
*
|
345 |
* @return javax.swing.JPanel
|
346 |
*/
|
347 |
private javax.swing.JPanel getJPanel1() {
|
348 |
if (jPanel1 == null) { |
349 |
jPanel1 = new javax.swing.JPanel();
|
350 |
|
351 |
java.awt.FlowLayout layFlowLayout8 = new java.awt.FlowLayout();
|
352 |
layFlowLayout8.setAlignment(java.awt.FlowLayout.LEFT); |
353 |
jPanel1.setLayout(layFlowLayout8); |
354 |
jPanel1.add(getTxtName(), null);
|
355 |
jPanel1.add(getTxtDate(), null);
|
356 |
jPanel1.add(getTxtOwner(), null);
|
357 |
jPanel1.setPreferredSize(new java.awt.Dimension(200, 80)); |
358 |
} |
359 |
|
360 |
return jPanel1;
|
361 |
} |
362 |
|
363 |
/**
|
364 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
365 |
*/
|
366 |
public WindowInfo getWindowInfo() {
|
367 |
WindowInfo m_viewinfo=new WindowInfo();
|
368 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_tabla")); |
369 |
m_viewinfo.setWidth(349);
|
370 |
m_viewinfo.setHeight(375);
|
371 |
|
372 |
return m_viewinfo;
|
373 |
} |
374 |
|
375 |
/**
|
376 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
377 |
*/
|
378 |
public void viewActivated() { |
379 |
} |
380 |
|
381 |
/**
|
382 |
* @see com.iver.andami.ui.mdiManager.SingletonWindow#getWindowModel()
|
383 |
*/
|
384 |
public Object getWindowModel() { |
385 |
return table;
|
386 |
} |
387 |
} |
388 |
|
389 |
|
390 |
// @jve:visual-info decl-index=0 visual-constraint="10,10"
|