svn-document-layout / trunk / org.gvsig.app.document.layout2.app / org.gvsig.app.document.layout2.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / fframes / gui / dialogs / FFrameViewDialog.java @ 250
History | View | Annotate | Download (27.2 KB)
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.layout.fframes.gui.dialogs; |
23 |
|
24 |
import java.awt.Dimension; |
25 |
import java.awt.GridBagConstraints; |
26 |
import java.awt.GridBagLayout; |
27 |
import java.awt.Insets; |
28 |
import java.awt.event.ActionEvent; |
29 |
import java.awt.event.ActionListener; |
30 |
import java.awt.geom.Rectangle2D; |
31 |
|
32 |
import javax.swing.BorderFactory; |
33 |
import javax.swing.ButtonGroup; |
34 |
import javax.swing.JButton; |
35 |
import javax.swing.JCheckBox; |
36 |
import javax.swing.JLabel; |
37 |
import javax.swing.JList; |
38 |
import javax.swing.JOptionPane; |
39 |
import javax.swing.JPanel; |
40 |
import javax.swing.JRadioButton; |
41 |
import javax.swing.JTextField; |
42 |
|
43 |
import org.gvsig.andami.messages.NotificationManager; |
44 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
45 |
import org.gvsig.andami.ui.mdiManager.SingletonWindow; |
46 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
47 |
import org.gvsig.app.ApplicationLocator; |
48 |
import org.gvsig.app.ApplicationManager; |
49 |
import org.gvsig.app.project.ProjectManager; |
50 |
import org.gvsig.app.project.documents.layout.FLayoutUtilities; |
51 |
import org.gvsig.app.project.documents.layout.LayoutManager; |
52 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGrid; |
53 |
import org.gvsig.app.project.documents.layout.fframes.FFrameView; |
54 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
55 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap.SCALE_TYPE; |
56 |
import org.gvsig.app.project.documents.layout.fframes.ListViewModel; |
57 |
import org.gvsig.app.project.documents.layout.fframes.gui.EnvelopePanel; |
58 |
import org.gvsig.app.project.documents.layout.fframes.gui.JPRotation; |
59 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
60 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
61 |
import org.gvsig.app.project.documents.view.ViewDocument; |
62 |
import org.gvsig.fmap.geom.primitive.Envelope; |
63 |
import org.gvsig.fmap.mapcontext.ViewPort; |
64 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
65 |
import org.gvsig.i18n.Messages; |
66 |
import org.gvsig.tools.observer.Observer; |
67 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
68 |
|
69 |
/**
|
70 |
* Dialog to add a view to the Layout document, by means of a FFrameView
|
71 |
*
|
72 |
* @author Vicente Caballero Navarro
|
73 |
* @author Cesar Martinez Izquierdo
|
74 |
*/
|
75 |
public class FFrameViewDialog extends AbstractFFrameDialog implements |
76 |
IFFrameDialog, SingletonWindow { |
77 |
|
78 |
private static final long serialVersionUID = -7223804566537544559L; |
79 |
|
80 |
private final LayoutManager layoutManager; |
81 |
private javax.swing.JLabel lViews = null; |
82 |
private javax.swing.JScrollPane jScrollPane = null; |
83 |
private javax.swing.JList liViews = null; // @jve:visual-info decl-index=0 |
84 |
// visual-constraint="98,-3"
|
85 |
private javax.swing.JCheckBox chbSyncLayers = null; |
86 |
private javax.swing.JButton bAceptar = null; |
87 |
private javax.swing.JButton bCancelar = null; |
88 |
private javax.swing.JLabel lCalidad = null; |
89 |
private javax.swing.JComboBox cbCalidad = null; |
90 |
private DefaultViewDocument m_projectView = null; |
91 |
private Rectangle2D rect = new Rectangle2D.Double(); |
92 |
private FFrameView fframeview = null; |
93 |
private boolean isAcepted = false; |
94 |
private JPRotation rotation = null; |
95 |
private FFrameView newFFrameView = null; |
96 |
private javax.swing.JButton bGrid = null; |
97 |
private javax.swing.JCheckBox chbShowGrid = null; |
98 |
private JPanel pnlFirstRow = null; |
99 |
private JCheckBox chbSyncExtent = null; |
100 |
|
101 |
private WindowInfo windowInfo = null; |
102 |
|
103 |
private GridBagLayoutPanel pnlSyncGroup = null; |
104 |
private GridBagLayoutPanel pnlScaleTypeGroup = null; |
105 |
private ButtonGroup grpScaleType = null; |
106 |
private JRadioButton btnNormalScale = null; |
107 |
private JRadioButton btnFixedScale = null; |
108 |
private JRadioButton btnFixedExtent = null; |
109 |
private JTextField fldScale = null; |
110 |
private EnvelopePanel pnlExtent = null; |
111 |
private JButton btConfigView = null; |
112 |
private JPanel pnlScale = null; |
113 |
|
114 |
|
115 |
/**
|
116 |
* This is the default constructor
|
117 |
*
|
118 |
* @param layoutPanel
|
119 |
* Referencia al Layout.
|
120 |
* @param fframe
|
121 |
* Referencia al fframe vista.
|
122 |
*/
|
123 |
public FFrameViewDialog(LayoutPanel layoutPanel, IFFrame frame) {
|
124 |
super(layoutPanel, frame);
|
125 |
fframeview = (FFrameView) frame; |
126 |
initComponents(); |
127 |
layoutManager = (LayoutManager) ProjectManager.getInstance()
|
128 |
.getDocumentManager("project.document.layout");
|
129 |
} |
130 |
|
131 |
/**
|
132 |
* This method initializes this
|
133 |
*/
|
134 |
private void initComponents() { |
135 |
this.setLayout(new GridBagLayout()); |
136 |
GridBagConstraints c = new GridBagConstraints(); |
137 |
Insets insets = new Insets(5, 5, 5, 5); |
138 |
int row = 0; |
139 |
c.gridx = 0;
|
140 |
c.gridy = row++; |
141 |
c.insets = new Insets(0,0,0,0); |
142 |
c.anchor = GridBagConstraints.LINE_START;
|
143 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
144 |
add(getFirstRowPnl(), c); |
145 |
c.insets = insets; |
146 |
c.gridx = 0;
|
147 |
c.gridy = row++; |
148 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
149 |
c.fill = GridBagConstraints.HORIZONTAL;
|
150 |
|
151 |
GridBagLayoutPanel pnl = getPnlSyncGroup(); |
152 |
pnl.addComponent(getChbSyncLayers(), insets); |
153 |
pnl.addComponent(getChbSyncExtent(), insets); |
154 |
add(pnl, c); |
155 |
|
156 |
getGrpScaleType().add(getBtnNormalScale()); |
157 |
getGrpScaleType().add(getBtnFixedScale()); |
158 |
getGrpScaleType().add(getBtnFixedExtent()); |
159 |
|
160 |
pnl = getPnlScaleTypeGroup(); |
161 |
pnl.addComponent(getBtnNormalScale(), insets); |
162 |
pnl.addComponent(getPnlScale(), insets); // pnlScale() contains btnFixedScale
|
163 |
pnl.addComponent(getBtnFixedExtent(), new Insets(5, 5, 0, 5)); |
164 |
pnl.addComponent(getPnlExtent(), GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5)); |
165 |
if (fframeview.getScaleType()==SCALE_TYPE.FIXED_SCALE) {
|
166 |
getBtnFixedScale().setSelected(true);
|
167 |
scaleTypeSet(SCALE_TYPE.FIXED_SCALE); |
168 |
} |
169 |
else if (fframeview.getScaleType()==SCALE_TYPE.FIXED_EXTENT) { |
170 |
getBtnFixedExtent().setSelected(true);
|
171 |
scaleTypeSet(SCALE_TYPE.FIXED_EXTENT); |
172 |
} |
173 |
else {
|
174 |
getBtnNormalScale().setSelected(true);
|
175 |
scaleTypeSet(SCALE_TYPE.NORMAL); |
176 |
} |
177 |
|
178 |
c.gridy = row++; |
179 |
add(pnl, c); |
180 |
|
181 |
c.fill = GridBagConstraints.NONE;
|
182 |
c.gridx = 0;
|
183 |
c.gridy = row++; |
184 |
c.gridwidth = 1;
|
185 |
add(getLCalidad(), c); |
186 |
c.gridx = 1;
|
187 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
188 |
add(getCbCalidad(), c); |
189 |
c.gridx = 0;
|
190 |
c.gridy = row++; |
191 |
c.gridwidth = 1;
|
192 |
add(getChbShowGrid(), c); |
193 |
c.gridx = 1;
|
194 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
195 |
add(getBGrid(), c); |
196 |
JPanel acceptCancelPnl = new JPanel(new GridBagLayout()); |
197 |
c.anchor = GridBagConstraints.LINE_START;
|
198 |
c.gridx = 0;
|
199 |
c.gridy = 0;
|
200 |
c.gridwidth = 1;
|
201 |
acceptCancelPnl.add(getbAceptar(), c); |
202 |
c.gridx = 1;
|
203 |
acceptCancelPnl.add(getBCancelar(), c); |
204 |
c.gridx = 0;
|
205 |
c.gridy = row++; |
206 |
c.anchor = GridBagConstraints.LINE_END;
|
207 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
208 |
add(acceptCancelPnl, c); |
209 |
} |
210 |
|
211 |
public void setRectangle(Rectangle2D r) { |
212 |
rect.setRect(r); |
213 |
} |
214 |
|
215 |
private JPanel getFirstRowPnl() { |
216 |
if (pnlFirstRow==null) { |
217 |
pnlFirstRow = new JPanel(new GridBagLayout()); |
218 |
GridBagConstraints c = new GridBagConstraints(); |
219 |
Insets insets = new Insets(5, 5, 5, 5); |
220 |
Insets insetsTop = new Insets(12, 5, 5, 5); |
221 |
c.gridx = 0;
|
222 |
c.gridy = 0;
|
223 |
c.insets = insetsTop; |
224 |
c.anchor = GridBagConstraints.PAGE_START;
|
225 |
pnlFirstRow.add(getLViews(), c); |
226 |
c.gridx = 1;
|
227 |
pnlFirstRow.add(getScrolledViewList(), c); |
228 |
c.insets = insets; |
229 |
c.gridx = 2;
|
230 |
c.gridheight = 2;
|
231 |
pnlFirstRow.add(getPRotation(), c); |
232 |
c.anchor = GridBagConstraints.LINE_END;
|
233 |
c.gridy = 1;
|
234 |
c.gridx = 1;
|
235 |
c.gridheight = 1;
|
236 |
pnlFirstRow.add(getBtnConfigView(), c); |
237 |
} |
238 |
return pnlFirstRow;
|
239 |
} |
240 |
|
241 |
protected ViewDocument getSelectedView() {
|
242 |
Object selected = getViewList().getSelectedValue();
|
243 |
if (selected instanceof ViewDocument) { |
244 |
return (ViewDocument) selected;
|
245 |
} |
246 |
return null; |
247 |
} |
248 |
|
249 |
private JButton getBtnConfigView() { |
250 |
UsabilitySwingManager manager = org.gvsig.tools.swing.api.ToolsSwingLocator.getUsabilitySwingManager(); |
251 |
btConfigView = manager.createJButton(Messages.getText("Configure_view"));
|
252 |
btConfigView.addActionListener(new ActionListener() { |
253 |
public void actionPerformed(ActionEvent e) { |
254 |
ViewDocument view = getSelectedView(); |
255 |
if (view!=null) { |
256 |
IWindow propWin = view.getPropertiesWindow(); |
257 |
ApplicationManager manager = ApplicationLocator.getManager(); |
258 |
manager.getUIManager().addWindow(propWin); |
259 |
} |
260 |
} |
261 |
}); |
262 |
return btConfigView;
|
263 |
} |
264 |
|
265 |
/**
|
266 |
* This method initializes lVistas
|
267 |
*
|
268 |
* @return javax.swing.JLabel
|
269 |
*/
|
270 |
private javax.swing.JLabel getLViews() {
|
271 |
if (lViews == null) { |
272 |
lViews = new javax.swing.JLabel();
|
273 |
lViews.setText(Messages.getText("Vista"));
|
274 |
} |
275 |
|
276 |
return lViews;
|
277 |
} |
278 |
|
279 |
/**
|
280 |
* This method initializes jScrollPane
|
281 |
*
|
282 |
* @return javax.swing.JScrollPane
|
283 |
*/
|
284 |
private javax.swing.JScrollPane getScrolledViewList() {
|
285 |
if (jScrollPane == null) { |
286 |
jScrollPane = new javax.swing.JScrollPane();
|
287 |
jScrollPane.setViewportView(getViewList()); |
288 |
jScrollPane.setPreferredSize(new java.awt.Dimension(300, 100)); |
289 |
} |
290 |
return jScrollPane;
|
291 |
} |
292 |
|
293 |
/**
|
294 |
* This method initializes liVistas
|
295 |
*
|
296 |
* @return javax.swing.JList
|
297 |
*/
|
298 |
private javax.swing.JList getViewList() {
|
299 |
if (liViews == null) { |
300 |
ListViewModel listmodel = new ListViewModel();
|
301 |
|
302 |
if (listmodel.addViews()) {
|
303 |
JOptionPane.showMessageDialog(
|
304 |
ApplicationLocator.getManager().getRootComponent(), |
305 |
Messages.getText("_Some_views_excluded_from_list_because_have_editing_layers"),
|
306 |
Messages.getText("propiedades_marco_vista"),
|
307 |
JOptionPane.WARNING_MESSAGE);
|
308 |
} |
309 |
|
310 |
liViews = new javax.swing.JList();
|
311 |
liViews.setModel(listmodel); |
312 |
for (int i = 0; i < liViews.getModel().getSize(); i++) { |
313 |
if (fframeview.getMapContext() != null) { |
314 |
|
315 |
DefaultViewDocument pvaux = |
316 |
(DefaultViewDocument) liViews.getModel().getElementAt( |
317 |
i); |
318 |
|
319 |
if (pvaux.getMapContext()
|
320 |
.equals(fframeview.getMapContext())) { |
321 |
liViews.setSelectedIndex(i); |
322 |
m_projectView = |
323 |
(DefaultViewDocument) liViews.getModel() |
324 |
.getElementAt(i); |
325 |
} |
326 |
} |
327 |
} |
328 |
|
329 |
liViews |
330 |
.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
331 |
|
332 |
private int selectIndex = -1; |
333 |
public void valueChanged( |
334 |
javax.swing.event.ListSelectionEvent e) { |
335 |
int selectInt =
|
336 |
((JList) e.getSource()).getSelectedIndex();
|
337 |
if (selectInt != selectIndex) {
|
338 |
selectIndex = selectInt; |
339 |
if (selectIndex == -1) { |
340 |
return;
|
341 |
} |
342 |
m_projectView = |
343 |
(DefaultViewDocument) liViews.getModel() |
344 |
.getElementAt(selectInt); |
345 |
ViewPort vp; |
346 |
try {
|
347 |
vp = |
348 |
(ViewPort) m_projectView.getMapContext() |
349 |
.getViewPort().clone(); |
350 |
vp.setImageSize(new Dimension((int) rect |
351 |
.getWidth(), (int) rect.getHeight()));
|
352 |
} catch (CloneNotSupportedException e1) { |
353 |
NotificationManager.addError("Excepci?n :", e1);
|
354 |
} |
355 |
} |
356 |
} |
357 |
}); |
358 |
} |
359 |
|
360 |
return liViews;
|
361 |
} |
362 |
|
363 |
/**
|
364 |
* This method initializes chbEnlaceVivo
|
365 |
*
|
366 |
* @return javax.swing.JCheckBox
|
367 |
*/
|
368 |
private javax.swing.JCheckBox getChbSyncLayers() {
|
369 |
if (chbSyncLayers == null) { |
370 |
chbSyncLayers = new javax.swing.JCheckBox();
|
371 |
chbSyncLayers.setText(Messages.getText("Synchronize_layers"));
|
372 |
chbSyncLayers.setSelected(fframeview.getLayerSynced()); |
373 |
chbSyncLayers.addActionListener(new ActionListener() { |
374 |
|
375 |
public void actionPerformed(ActionEvent e) { |
376 |
if (chbSyncLayers.isSelected()) {
|
377 |
JOptionPane.showMessageDialog(FFrameViewDialog.this,
|
378 |
Messages.getText("Warning_Enabling_layer_synchronization_will_discard_any_change_not_present_in_associated_view"),
|
379 |
Messages.getText("Warning_Layer_sync"),
|
380 |
JOptionPane.WARNING_MESSAGE);
|
381 |
} |
382 |
} |
383 |
|
384 |
}); |
385 |
} |
386 |
|
387 |
return chbSyncLayers;
|
388 |
} |
389 |
|
390 |
private javax.swing.JCheckBox getChbSyncExtent() {
|
391 |
if (chbSyncExtent==null) { |
392 |
chbSyncExtent = new javax.swing.JCheckBox();
|
393 |
chbSyncExtent.setText(Messages.getText("Synchronize_extents"));
|
394 |
chbSyncExtent.setSelected(fframeview.getExtentSynced()); |
395 |
} |
396 |
return chbSyncExtent;
|
397 |
} |
398 |
|
399 |
protected void disableChbSyncExtent() { |
400 |
getChbSyncExtent().setEnabled(false);
|
401 |
getChbSyncExtent().setToolTipText(Messages.getText("Extent_cant_be_synchronized_when_using_fixed_scale_or_fixed_extent"));
|
402 |
} |
403 |
|
404 |
protected void enableChbSyncExtent() { |
405 |
getChbSyncExtent().setEnabled(true);
|
406 |
getChbSyncExtent().setToolTipText(null);
|
407 |
} |
408 |
|
409 |
/**
|
410 |
* This method initializes jButton
|
411 |
*
|
412 |
* @return javax.swing.JButton
|
413 |
*/
|
414 |
private javax.swing.JButton getbAceptar() {
|
415 |
if (bAceptar == null) { |
416 |
bAceptar = new javax.swing.JButton();
|
417 |
bAceptar.setText(Messages.getText("Aceptar"));
|
418 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
419 |
|
420 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
421 |
try {
|
422 |
newFFrameView = (FFrameView) fframeview.clone(); |
423 |
newFFrameView.setBoundBox(FLayoutUtilities.toSheetRect( |
424 |
rect, layoutPanel.getLayoutControl().getAT())); |
425 |
newFFrameView.setRotation(getPRotation().getRotation()); |
426 |
newFFrameView.setHasToc(true);
|
427 |
newFFrameView.setLayerSynced(getChbSyncLayers() |
428 |
.isSelected()); |
429 |
newFFrameView.setExtentSynced(getChbSyncExtent().isSelected()); |
430 |
try {
|
431 |
if (getBtnFixedScale().isSelected()) {
|
432 |
Double d = Double.parseDouble(getFldScale().getText()); |
433 |
newFFrameView.setScaleType(SCALE_TYPE.FIXED_SCALE, d); |
434 |
} |
435 |
else if (getBtnFixedExtent().isSelected()) { |
436 |
Envelope envelope = getPnlExtent().getEnvelope(); |
437 |
if (envelope!=null) { |
438 |
newFFrameView.setScaleType(SCALE_TYPE.FIXED_EXTENT, envelope); |
439 |
} |
440 |
else {
|
441 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
442 |
} |
443 |
} |
444 |
else {
|
445 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
446 |
} |
447 |
} |
448 |
catch (Exception ex) { |
449 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
450 |
} |
451 |
if (m_projectView != null) { |
452 |
newFFrameView.setView(m_projectView); |
453 |
newFFrameView.setQuality(getCbCalidad() |
454 |
.getSelectedIndex()); |
455 |
if (fframeview.getGrid() != null) { |
456 |
((FFrameGrid) fframeview.getGrid()) |
457 |
.setFFrameDependence(newFFrameView); |
458 |
newFFrameView.setGrid(fframeview.getGrid()); |
459 |
} |
460 |
newFFrameView.showGrid(getChbShowGrid() |
461 |
.isSelected()); |
462 |
newFFrameView.setBoundBox(FLayoutUtilities |
463 |
.toSheetRect(rect, layoutPanel |
464 |
.getLayoutControl().getAT())); |
465 |
} |
466 |
} catch (CloneNotSupportedException e1) { |
467 |
LOG.error("It is not possible to clone the object", e);
|
468 |
} |
469 |
isAcepted = true;
|
470 |
ApplicationLocator.getManager().getUIManager().closeWindow( |
471 |
FFrameViewDialog.this); |
472 |
notifyDialogClosed(); |
473 |
layoutPanel.getLayoutControl().setDefaultTool(); |
474 |
} |
475 |
}); |
476 |
} |
477 |
|
478 |
return bAceptar;
|
479 |
} |
480 |
|
481 |
/**
|
482 |
* This method initializes bCancelar
|
483 |
*
|
484 |
* @return javax.swing.JButton
|
485 |
*/
|
486 |
private javax.swing.JButton getBCancelar() {
|
487 |
if (bCancelar == null) { |
488 |
bCancelar = new javax.swing.JButton();
|
489 |
bCancelar.setText(Messages.getText("Cancelar"));
|
490 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
491 |
|
492 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
493 |
newFFrameView = null;
|
494 |
ApplicationLocator.getManager().getUIManager().closeWindow( |
495 |
FFrameViewDialog.this); |
496 |
notifyDialogClosed(); |
497 |
} |
498 |
}); |
499 |
} |
500 |
|
501 |
return bCancelar;
|
502 |
} |
503 |
|
504 |
/**
|
505 |
* This method initializes lCalidad
|
506 |
*
|
507 |
* @return javax.swing.JLabel
|
508 |
*/
|
509 |
private javax.swing.JLabel getLCalidad() {
|
510 |
if (lCalidad == null) { |
511 |
lCalidad = new javax.swing.JLabel();
|
512 |
lCalidad.setText(Messages.getText("calidad"));
|
513 |
} |
514 |
|
515 |
return lCalidad;
|
516 |
} |
517 |
|
518 |
/**
|
519 |
* This method initializes cbCalidad
|
520 |
*
|
521 |
* @return javax.swing.JComboBox
|
522 |
*/
|
523 |
private javax.swing.JComboBox getCbCalidad() {
|
524 |
if (cbCalidad == null) { |
525 |
// String[] s={"Presentaci?n","Borrador"};
|
526 |
cbCalidad = new javax.swing.JComboBox();
|
527 |
cbCalidad.addItem(Messages.getText("presentacion"));
|
528 |
cbCalidad.addItem(Messages.getText("borrador"));
|
529 |
cbCalidad.setSelectedIndex(fframeview.getQuality()); |
530 |
} |
531 |
|
532 |
return cbCalidad;
|
533 |
} |
534 |
|
535 |
/*
|
536 |
* (non-Javadoc)
|
537 |
*
|
538 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
539 |
*/
|
540 |
public WindowInfo getWindowInfo() {
|
541 |
if (windowInfo==null) { |
542 |
windowInfo = new WindowInfo(WindowInfo.RESIZABLE);
|
543 |
windowInfo.setHeight(600);
|
544 |
windowInfo.setWidth(550);
|
545 |
windowInfo.setTitle(Messages.getText( |
546 |
"propiedades_marco_vista"));
|
547 |
} |
548 |
return windowInfo;
|
549 |
} |
550 |
|
551 |
/**
|
552 |
* @see org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
|
553 |
*/
|
554 |
public boolean getIsAcepted() { |
555 |
return isAcepted;
|
556 |
} |
557 |
|
558 |
/**
|
559 |
* This method initializes rotation
|
560 |
*
|
561 |
* @return javax.swing.JPanel
|
562 |
*/
|
563 |
private JPRotation getPRotation() {
|
564 |
if (rotation == null) { |
565 |
rotation = new JPRotation();
|
566 |
rotation.setRotation(fframeview.getRotation()); |
567 |
} |
568 |
return rotation;
|
569 |
} |
570 |
|
571 |
public IFFrame getFFrame() {
|
572 |
return newFFrameView;
|
573 |
} |
574 |
|
575 |
/**
|
576 |
* This method initializes bGrid
|
577 |
*
|
578 |
* @return javax.swing.JButton
|
579 |
*/
|
580 |
private JButton getBGrid() { |
581 |
if (bGrid == null) { |
582 |
bGrid = new JButton(); |
583 |
bGrid.setText(Messages.getText("configurar"));
|
584 |
bGrid.addActionListener(new java.awt.event.ActionListener() {
|
585 |
|
586 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
587 |
FFrameGrid fframeGrid = null;
|
588 |
|
589 |
if (fframeview.getGrid() != null) { |
590 |
fframeGrid = (FFrameGrid) fframeview.getGrid(); |
591 |
} else {
|
592 |
fframeGrid = (FFrameGrid) layoutManager.createFrame(FFrameGrid.PERSISTENCE_DEFINITION_NAME); |
593 |
fframeGrid.setFFrameDependence(fframeview); |
594 |
} |
595 |
|
596 |
FFrameGridDialog fframeGridDialog = |
597 |
(FFrameGridDialog)layoutManager.createFFrameDialog(fframeGrid, layoutPanel); |
598 |
fframeGridDialog.setFFrameView(fframeview); |
599 |
|
600 |
|
601 |
if (fframeGridDialog != null) { |
602 |
ApplicationLocator.getManager().getUIManager().addWindow(fframeGridDialog); |
603 |
} |
604 |
IFFrame newFrame = fframeGridDialog.getFFrame(); |
605 |
if (newFrame != null) { |
606 |
fframeview.setGrid(newFrame); |
607 |
} |
608 |
} |
609 |
}); |
610 |
} |
611 |
return bGrid;
|
612 |
} |
613 |
|
614 |
/**
|
615 |
* This method initializes chbShowGrid
|
616 |
*
|
617 |
* @return javax.swing.JCheckBox
|
618 |
*/
|
619 |
private JCheckBox getChbShowGrid() { |
620 |
if (chbShowGrid == null) { |
621 |
chbShowGrid = new JCheckBox(); |
622 |
chbShowGrid.setSelected(fframeview.isShowGrid()); |
623 |
chbShowGrid.setText(Messages.getText("Show_grid"));
|
624 |
} |
625 |
return chbShowGrid;
|
626 |
} |
627 |
|
628 |
private GridBagLayoutPanel getPnlSyncGroup() {
|
629 |
if (pnlSyncGroup ==null) { |
630 |
pnlSyncGroup = new GridBagLayoutPanel();
|
631 |
pnlSyncGroup.setBorder(BorderFactory.createTitledBorder(Messages.getText("Synchronization_of_the_view_and_the_frame_view"))); |
632 |
} |
633 |
return pnlSyncGroup;
|
634 |
} |
635 |
|
636 |
private GridBagLayoutPanel getPnlScaleTypeGroup() {
|
637 |
if (pnlScaleTypeGroup ==null) { |
638 |
pnlScaleTypeGroup = new GridBagLayoutPanel();
|
639 |
pnlScaleTypeGroup.setBorder(BorderFactory.createTitledBorder(Messages.getText("Fixed_scale_and_extent"))); |
640 |
} |
641 |
return pnlScaleTypeGroup;
|
642 |
} |
643 |
|
644 |
private ButtonGroup getGrpScaleType() { |
645 |
if (grpScaleType==null) { |
646 |
grpScaleType = new ButtonGroup(); |
647 |
} |
648 |
return grpScaleType;
|
649 |
} |
650 |
|
651 |
private JRadioButton getBtnNormalScale() { |
652 |
if (btnNormalScale==null) { |
653 |
btnNormalScale = new JRadioButton(Messages.getText("Non_fixed")); |
654 |
btnNormalScale.addActionListener(new ActionListener() { |
655 |
public void actionPerformed(ActionEvent e) { |
656 |
FFrameViewDialog.this.scaleTypeSet(SCALE_TYPE.NORMAL); |
657 |
FFrameViewDialog.this.enableChbSyncExtent(); |
658 |
} |
659 |
}); |
660 |
} |
661 |
return btnNormalScale;
|
662 |
} |
663 |
|
664 |
private JRadioButton getBtnFixedScale() { |
665 |
if (btnFixedScale==null) { |
666 |
btnFixedScale = new JRadioButton(Messages.getText("Fixed_scale")); |
667 |
btnFixedScale.addActionListener(new ActionListener() { |
668 |
public void actionPerformed(ActionEvent e) { |
669 |
FFrameViewDialog.this.scaleTypeSet(SCALE_TYPE.FIXED_SCALE); |
670 |
FFrameViewDialog.this.disableChbSyncExtent(); |
671 |
} |
672 |
}); |
673 |
} |
674 |
return btnFixedScale;
|
675 |
} |
676 |
|
677 |
private JPanel getPnlScale() { |
678 |
if (pnlScale==null) { |
679 |
pnlScale = new JPanel(new GridBagLayout()); |
680 |
GridBagConstraints c = new GridBagConstraints(); |
681 |
c.insets = new Insets(0, 0, 0, 0); |
682 |
c.gridx = 0;
|
683 |
pnlScale.add(getBtnFixedScale()); |
684 |
c.anchor = GridBagConstraints.LINE_START;
|
685 |
c.gridx = 1;
|
686 |
c.insets = new Insets(0, 25, 0, 5); |
687 |
c.anchor = GridBagConstraints.LINE_END;
|
688 |
pnlScale.add(getLblScale(), c); |
689 |
c.gridx = 2;
|
690 |
c.insets = new Insets(0, 5, 0, 5);; |
691 |
c.anchor = GridBagConstraints.LINE_START;
|
692 |
pnlScale.add(getFldScale(), c); |
693 |
} |
694 |
return pnlScale;
|
695 |
} |
696 |
|
697 |
private JTextField getFldScale() { |
698 |
if (fldScale==null) { |
699 |
fldScale = new JTextField(8); |
700 |
if (fframeview!=null && |
701 |
fframeview.getMapContext()!=null &&
|
702 |
fframeview.getMapContext().getViewPort().getEnvelope()!=null) {
|
703 |
fldScale.setText(Long.toString(fframeview.getMapContext().getScaleView()));
|
704 |
} |
705 |
} |
706 |
return fldScale;
|
707 |
} |
708 |
|
709 |
private JLabel getLblScale() { |
710 |
return new JLabel(Messages.getText("1__")); |
711 |
} |
712 |
|
713 |
private JRadioButton getBtnFixedExtent() { |
714 |
if (btnFixedExtent==null) { |
715 |
btnFixedExtent = new JRadioButton(Messages.getText("Fixed_extent")); |
716 |
btnFixedExtent.addActionListener(new ActionListener() { |
717 |
public void actionPerformed(ActionEvent e) { |
718 |
FFrameViewDialog.this.scaleTypeSet(SCALE_TYPE.FIXED_EXTENT); |
719 |
FFrameViewDialog.this.disableChbSyncExtent(); |
720 |
} |
721 |
}); |
722 |
} |
723 |
return btnFixedExtent;
|
724 |
} |
725 |
|
726 |
private EnvelopePanel getPnlExtent() {
|
727 |
if (pnlExtent==null) { |
728 |
pnlExtent = new EnvelopePanel();
|
729 |
if (fframeview!=null && |
730 |
fframeview.getMapContext()!=null &&
|
731 |
fframeview.getMapContext().getViewPort().getEnvelope()!=null) {
|
732 |
pnlExtent.setEnvelope(fframeview.getMapContext().getViewPort().getEnvelope()); |
733 |
} |
734 |
} |
735 |
return pnlExtent;
|
736 |
} |
737 |
|
738 |
public Object getWindowProfile() { |
739 |
return WindowInfo.DIALOG_PROFILE;
|
740 |
} |
741 |
|
742 |
public Object getWindowModel() { |
743 |
return fframeview;
|
744 |
} |
745 |
|
746 |
protected void scaleTypeSet(SCALE_TYPE type) { |
747 |
if (type==SCALE_TYPE.NORMAL) {
|
748 |
getFldScale().setEditable(false);
|
749 |
getFldScale().setEnabled(false);
|
750 |
getPnlExtent().setEditable(false);
|
751 |
getPnlExtent().setEnabled(false);
|
752 |
} |
753 |
else if (type==SCALE_TYPE.FIXED_SCALE) { |
754 |
getFldScale().setEditable(true);
|
755 |
getFldScale().setEnabled(true);
|
756 |
getPnlExtent().setEditable(false);
|
757 |
getPnlExtent().setEnabled(false);
|
758 |
} |
759 |
else if (type==SCALE_TYPE.FIXED_EXTENT) { |
760 |
getFldScale().setEditable(false);
|
761 |
getFldScale().setEnabled(false);
|
762 |
getPnlExtent().setEditable(true);
|
763 |
getPnlExtent().setEnabled(true);
|
764 |
} |
765 |
|
766 |
} |
767 |
|
768 |
protected SCALE_TYPE getSelectedScaleType() {
|
769 |
if (getBtnFixedScale().isSelected()) {
|
770 |
return SCALE_TYPE.FIXED_SCALE;
|
771 |
} |
772 |
else if (getBtnFixedExtent().isSelected()) { |
773 |
return SCALE_TYPE.FIXED_EXTENT;
|
774 |
} |
775 |
return SCALE_TYPE.NORMAL;
|
776 |
} |
777 |
|
778 |
} // @jve:decl-index=0:visual-constraint="10,10"
|