svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.projection / org.gvsig.projection.cresques / org.gvsig.projection.cresques.ui / src / main / java / org / gvsig / app / project / documents / view / info / gui / CSSelectionDialog.java @ 43213
History | View | Annotate | Download (2.66 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/*
|
25 |
* Created on 26-ene-2005
|
26 |
*/
|
27 |
package org.gvsig.app.project.documents.view.info.gui; |
28 |
|
29 |
import javax.swing.JComponent; |
30 |
|
31 |
import org.cresques.cts.IProjection; |
32 |
import org.cresques.ui.cts.CSSelectionDialogPanel; |
33 |
import org.gvsig.app.gui.panels.crs.ISelectCrsPanel; |
34 |
|
35 |
public class CSSelectionDialog extends CSSelectionDialogPanel implements ISelectCrsPanel { |
36 |
|
37 |
private boolean okPressed = false; |
38 |
private IProjection lastProj = null; |
39 |
|
40 |
/**
|
41 |
*
|
42 |
*/
|
43 |
public CSSelectionDialog() {
|
44 |
super();
|
45 |
this.init();
|
46 |
} |
47 |
|
48 |
/**
|
49 |
* This method initializes this
|
50 |
*
|
51 |
* @return void
|
52 |
*/
|
53 |
private void init() { |
54 |
getAcceptButton().addActionListener( |
55 |
new java.awt.event.ActionListener() {
|
56 |
|
57 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
58 |
closeWindow(); |
59 |
okPressed = true;
|
60 |
} |
61 |
}); |
62 |
getCancelButton().addActionListener( |
63 |
new java.awt.event.ActionListener() {
|
64 |
|
65 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
66 |
setProjection(lastProj); |
67 |
closeWindow(); |
68 |
okPressed = false;
|
69 |
} |
70 |
}); |
71 |
} |
72 |
|
73 |
public void closeWindow() { |
74 |
this.setVisible(false); |
75 |
} |
76 |
|
77 |
public boolean isOkPressed() { |
78 |
return okPressed;
|
79 |
} |
80 |
|
81 |
/**
|
82 |
* @return
|
83 |
*/
|
84 |
public IProjection getProjection() {
|
85 |
return getProjPanel().getProjection();
|
86 |
} |
87 |
|
88 |
/**
|
89 |
* @param proj
|
90 |
*/
|
91 |
public void setProjection(IProjection proj) { |
92 |
lastProj = proj; |
93 |
getProjPanel().setProjection(proj); |
94 |
} |
95 |
|
96 |
|
97 |
@Override
|
98 |
public JComponent asJComponent() { |
99 |
return this; |
100 |
} |
101 |
|
102 |
} |