Revision 35987 branches/v2_0_0_prep/extensions/extJCRS/src/org/gvsig/crs/gui/panels/ProjChooserPanel.java

View differences:

ProjChooserPanel.java
76 76
	boolean targetNad = false;
77 77
	String dataSource = "EPSG";
78 78
	
79
	private ActionListener actionListener = null;
80
	
81 79
	public ProjChooserPanel(IProjection proj) {
82 80
		super(proj);	
83 81
		IProjection pr = proj;
......
105 103
        this.add(getJLblProjName(), null);
106 104
        this.add(getJLblProj(), null);
107 105
        this.add(getJBtnChangeProj(), null);
108
        
109
        if (curProj != null){   
110
            dataSource = curProj.getCrsWkt().getAuthority()[0];
111
            jLblProj.setText(dataSource + ":" + String.valueOf(curProj.getCode()));              
112
        }
113 106
        initBtnChangeProj();
107
        refresh();
114 108
	}
115 109

  
116 110
	private void initBtnChangeProj() {
......
126 120
					//csSelect.setLayout(new GridLayout(0,1));
127 121
					
128 122
			        PluginServices.getMDIManager().addWindow(csSelect);
123
//			        abrev = curProj.getAbrev();
129 124
			        abrev = dataSource+ ":" +String.valueOf(curProj.getCode());
130 125
			        if (csSelect.isOkPressed()) {
131 126
			        	curProj = (ICrs) csSelect.getProjection();
......
133 128
			        	//dataSource = csSelect.getDataSource();
134 129
			        	abrev = dataSource+ ":" +String.valueOf(curProj.getCode());
135 130
			        	
136
			        	jLblProj.setText(dataSource+ ":" +String.valueOf(curProj.getCode()));//.getAbrev());
131
			        	getJLblProj().setText(dataSource+ ":" +String.valueOf(curProj.getCode()));//.getAbrev());
137 132
			        	AddLayerDialog.setLastProjection(curProj);
138 133
			        	okPressed = true;
139 134
			        	if (actionListener != null) {
140 135
			        		actionListener.actionPerformed(e);
141 136
			        	}
142
			        }else			        	
143
			        	jLblProj.setText(abrev);  
137
			        }else{
138
			        	getJLblProj().setText(abrev);  			        	
139
			        }
144 140
				}
145 141
				else {
146 142
					okPressed = false;										
......
159 155
			        	dataSource = curProj.getCrsWkt().getAuthority()[0];
160 156
			        	//dataSource = trSelect.getProjPanel().getDataSource();
161 157
			        	//abrev = trSelect.getProjectionName();
162
			        	jLblProj.setText(dataSource+ ":" +String.valueOf(curProj.getCode()));//abrev);
158
			        	getJLblProj().setText(dataSource+ ":" +String.valueOf(curProj.getCode()));//abrev);
163 159
			        	AddLayerDialog.setLastProjection(curProj);			        	
164 160
			        	okPressed = true;
165 161
			        	
166 162
			        	if (actionListener != null) {
167 163
			        		actionListener.actionPerformed(e);
168 164
			        	}
169
			        }else
170
			        	jLblProj.setText(dataSource+ ":" +String.valueOf(curProj.getCode()));//abrev);
171
					
165
			        }else{
166
			        	refresh();
167
			        }
172 168
				}
173 169
					        	
174 170
			}
175 171
		});
176 172
	}
177 173

  
174

  
175

  
178 176
	public JLabel getJLblProjName() {
179 177
		if (jLblProjName == null) {
180 178
	        jLblProjName = new JLabel("Proyeccion actual");
......
193 191
		}
194 192
		return jLblProj;
195 193
	}
196
	public void addBtnChangeProjActionListener(java.awt.event.ActionListener al) {
197
		jBtnChangeProj.addActionListener(al);
198
	}
199 194

  
200 195
	/**
201 196
	 * This method initializes jButton
......
225 220
	public IProjection getCurProj() {
226 221
		return curProj;
227 222
	}
223
	
228 224
	/**
229 225
	 * @param curProj The curProj to set.
230 226
	 */
231 227
	public void setCurProj(IProjection curProj) {
232 228
		this.curProj = (ICrs) curProj;
229
		refresh();
233 230
	}
231
	
232
	private void refresh() {
233
		if (curProj != null){   
234
            dataSource = curProj.getCrsWkt().getAuthority()[0];
235
            String text = dataSource + ":" + String.valueOf(curProj.getCode());
236
            getJLblProj().setText(text.trim());              
237
        }else{
238
        	getJLblProj().setText("");
239
        }
240
	}
241
	
234 242
	/**
235 243
	 * @return Returns the okPressed.
236 244
	 */
237 245
	public boolean isOkPressed() {
238 246
		return okPressed;
239 247
	}
248
	
240 249
	/**
241 250
	 * @param actionListener The actionListener to set.
242 251
	 */

Also available in: Unified diff