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