svn-gvsig-desktop / trunk / libraries / libJCRS / src / org / gvsig / crs / gui / CRSSelectionDialog.java @ 8294
History | View | Annotate | Download (3.08 KB)
1 |
package org.gvsig.crs.gui; |
---|---|
2 |
|
3 |
import javax.swing.JPanel; |
4 |
import javax.swing.ListSelectionModel; |
5 |
import org.cresques.cts.IProjection; |
6 |
import org.gvsig.crs.gui.listeners.CRSSelectionDialogListener; |
7 |
import com.iver.andami.PluginServices; |
8 |
import com.iver.andami.ui.mdiManager.IWindow; |
9 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
10 |
|
11 |
/**
|
12 |
* Di?logo contenedor para la selecci?n de CRS.
|
13 |
* (para el CRS de la vista)
|
14 |
*/
|
15 |
public class CRSSelectionDialog extends JPanel implements IWindow { |
16 |
|
17 |
private static final long serialVersionUID = 1L; |
18 |
|
19 |
JPanel contentPane = null; |
20 |
private CRSMainPanel crsMainPanel = null; |
21 |
private IProjection lastProj = null; |
22 |
int code = 0; |
23 |
String dataSource = ""; |
24 |
|
25 |
private boolean okPressed = false; |
26 |
|
27 |
public CRSSelectionDialog(){
|
28 |
super();
|
29 |
initialize(); |
30 |
} |
31 |
|
32 |
public void initialize(){ |
33 |
crsMainPanel = new CRSMainPanel();
|
34 |
this.add(getContentPanel(), null); |
35 |
setListeners(); |
36 |
crsMainPanel.getRecentsPanel().loadRecents(); |
37 |
} |
38 |
|
39 |
public boolean isOkPressed() { return okPressed; } |
40 |
|
41 |
public CRSMainPanel getProjPanel() {
|
42 |
return (CRSMainPanel) getContentPanel();
|
43 |
} |
44 |
|
45 |
public JPanel getContentPanel() { |
46 |
if (contentPane == null) { |
47 |
contentPane = crsMainPanel; |
48 |
|
49 |
} |
50 |
return contentPane;
|
51 |
} |
52 |
|
53 |
public void setListeners(){ |
54 |
|
55 |
CRSSelectionDialogListener listener = new CRSSelectionDialogListener(this); |
56 |
|
57 |
ListSelectionModel rowSM = crsMainPanel.getEpsgPanel().getJTable().getSelectionModel();
|
58 |
rowSM.addListSelectionListener(listener); |
59 |
|
60 |
ListSelectionModel rowSMiau = crsMainPanel.getIauPanel().getJTable().getSelectionModel();
|
61 |
rowSMiau.addListSelectionListener(listener); |
62 |
|
63 |
ListSelectionModel rowSMrecents = crsMainPanel.getRecentsPanel().getJTable().getSelectionModel();
|
64 |
rowSMrecents.addListSelectionListener(listener); |
65 |
|
66 |
crsMainPanel.getJComboOptions().addItemListener(listener); |
67 |
crsMainPanel.getJButtonAccept().addActionListener(listener); |
68 |
crsMainPanel.getJButtonCancel().addActionListener(listener); |
69 |
crsMainPanel.getEsriPanel().getJTextOpen().getDocument().addDocumentListener(listener); |
70 |
} |
71 |
|
72 |
public void setCode(int cod){ |
73 |
code = cod; |
74 |
} |
75 |
|
76 |
public int getCode(){ |
77 |
return code;
|
78 |
} |
79 |
|
80 |
public IProjection getProjection() {
|
81 |
return (IProjection) getProjPanel().getProjection();
|
82 |
} |
83 |
/**
|
84 |
* @param proj
|
85 |
*/
|
86 |
public void setProjection(IProjection proj) { |
87 |
lastProj = proj; |
88 |
getProjPanel().setProjection(proj); |
89 |
} |
90 |
|
91 |
public String getProjectionAbrev(){ |
92 |
return (String) getProjPanel().getProjection().getAbrev(); |
93 |
} |
94 |
|
95 |
|
96 |
|
97 |
public void setDataSource(String sour){ |
98 |
dataSource = sour; |
99 |
} |
100 |
|
101 |
public String getDataSource(){ |
102 |
return dataSource;
|
103 |
} |
104 |
|
105 |
public WindowInfo getWindowInfo() {
|
106 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
107 |
m_viewinfo.setTitle(PluginServices.getText(this, "nuevo_crs")); |
108 |
return m_viewinfo;
|
109 |
} |
110 |
|
111 |
public IProjection getLastProj() {
|
112 |
return lastProj;
|
113 |
} |
114 |
|
115 |
public void setLastProj(IProjection lastProj) { |
116 |
this.lastProj = lastProj;
|
117 |
} |
118 |
|
119 |
public void setOkPressed(boolean okPressed) { |
120 |
this.okPressed = okPressed;
|
121 |
} |
122 |
|
123 |
public CRSMainPanel getCrsMainPanel() {
|
124 |
return crsMainPanel;
|
125 |
} |
126 |
} |