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 @ 40559
History | View | Annotate | Download (3.13 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 java.awt.Dimension; |
30 |
|
31 |
import org.cresques.Messages; |
32 |
import org.cresques.cts.IProjection; |
33 |
import org.cresques.ui.cts.CSSelectionDialogPanel; |
34 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
35 |
import org.gvsig.app.gui.panels.crs.ISelectCrsPanel; |
36 |
|
37 |
public class CSSelectionDialog extends CSSelectionDialogPanel implements ISelectCrsPanel { |
38 |
|
39 |
private boolean okPressed = false; |
40 |
private IProjection lastProj = null; |
41 |
|
42 |
/**
|
43 |
*
|
44 |
*/
|
45 |
public CSSelectionDialog() {
|
46 |
super();
|
47 |
this.init();
|
48 |
} |
49 |
|
50 |
/**
|
51 |
* This method initializes this
|
52 |
*
|
53 |
* @return void
|
54 |
*/
|
55 |
private void init() { |
56 |
getAcceptButton().addActionListener( |
57 |
new java.awt.event.ActionListener() {
|
58 |
|
59 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
60 |
closeWindow(); |
61 |
okPressed = true;
|
62 |
} |
63 |
}); |
64 |
getCancelButton().addActionListener( |
65 |
new java.awt.event.ActionListener() {
|
66 |
|
67 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
68 |
setProjection(lastProj); |
69 |
closeWindow(); |
70 |
okPressed = false;
|
71 |
} |
72 |
}); |
73 |
} |
74 |
|
75 |
public void closeWindow() { |
76 |
this.setVisible(false); |
77 |
} |
78 |
|
79 |
public boolean isOkPressed() { |
80 |
return okPressed;
|
81 |
} |
82 |
|
83 |
/**
|
84 |
* @return
|
85 |
*/
|
86 |
public IProjection getProjection() {
|
87 |
return getProjPanel().getProjection();
|
88 |
} |
89 |
|
90 |
/**
|
91 |
* @param proj
|
92 |
*/
|
93 |
public void setProjection(IProjection proj) { |
94 |
lastProj = proj; |
95 |
getProjPanel().setProjection(proj); |
96 |
} |
97 |
|
98 |
public WindowInfo getWindowInfo() {
|
99 |
WindowInfo m_viewinfo = |
100 |
new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
|
101 |
m_viewinfo.setTitle(Messages.getText("selecciona_sistema_de_referencia"));
|
102 |
Dimension dim = getPreferredSize();
|
103 |
m_viewinfo.setWidth(dim.width); |
104 |
m_viewinfo.setHeight(dim.height); |
105 |
return m_viewinfo;
|
106 |
} |
107 |
|
108 |
public Object getWindowProfile() { |
109 |
return WindowInfo.DIALOG_PROFILE;
|
110 |
} |
111 |
|
112 |
} |