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