svn-gvsig-desktop / tags / v2_0_0_Build_2060 / applications / appgvSIG / src / org / gvsig / app / project / documents / view / gui / DefaultViewPanel.java @ 39341
History | View | Annotate | Download (19.8 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 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2004-2009 IVER TI
|
26 |
*
|
27 |
*/
|
28 |
package org.gvsig.app.project.documents.view.gui; |
29 |
|
30 |
import java.awt.BorderLayout; |
31 |
import java.awt.Color; |
32 |
import java.awt.Dimension; |
33 |
import java.beans.PropertyChangeEvent; |
34 |
import java.beans.PropertyChangeListener; |
35 |
import java.util.HashMap; |
36 |
import java.util.Iterator; |
37 |
|
38 |
import javax.swing.JSplitPane; |
39 |
import javax.swing.SwingUtilities; |
40 |
|
41 |
import org.cresques.cts.IProjection; |
42 |
|
43 |
import org.gvsig.andami.PluginServices; |
44 |
import org.gvsig.andami.messages.NotificationManager; |
45 |
import org.gvsig.andami.ui.mdiFrame.NewStatusBar; |
46 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
47 |
import org.gvsig.app.project.DefaultProject; |
48 |
import org.gvsig.app.project.documents.Document; |
49 |
import org.gvsig.app.project.documents.view.MapOverview; |
50 |
import org.gvsig.app.project.documents.view.ViewDocument; |
51 |
import org.gvsig.app.project.documents.view.toc.gui.TOC; |
52 |
import org.gvsig.app.project.documents.view.toolListeners.AreaListener; |
53 |
import org.gvsig.app.project.documents.view.toolListeners.InfoListener; |
54 |
import org.gvsig.app.project.documents.view.toolListeners.MeasureListener; |
55 |
import org.gvsig.app.project.documents.view.toolListeners.PanListener; |
56 |
import org.gvsig.app.project.documents.view.toolListeners.PointSelectListener; |
57 |
import org.gvsig.app.project.documents.view.toolListeners.PolygonSelectListener; |
58 |
import org.gvsig.app.project.documents.view.toolListeners.RectangleSelectListener; |
59 |
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener; |
60 |
import org.gvsig.app.project.documents.view.toolListeners.ZoomInListener; |
61 |
import org.gvsig.app.project.documents.view.toolListeners.ZoomOutListener; |
62 |
import org.gvsig.fmap.dal.feature.FeatureStoreNotification; |
63 |
import org.gvsig.fmap.mapcontext.MapContext; |
64 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
65 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
66 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
67 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
68 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
69 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
70 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
71 |
import org.gvsig.fmap.mapcontrol.MapControl; |
72 |
import org.gvsig.fmap.mapcontrol.MapControlCreationException; |
73 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
74 |
import org.gvsig.fmap.mapcontrol.MapControlManager; |
75 |
import org.gvsig.fmap.mapcontrol.tools.ZoomOutRightButtonListener; |
76 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
77 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior; |
78 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseWheelBehavior; |
79 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MoveBehavior; |
80 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior; |
81 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolygonBehavior; |
82 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolylineBehavior; |
83 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.RectangleBehavior; |
84 |
import org.gvsig.tools.observer.Observable; |
85 |
import org.gvsig.tools.observer.Observer; |
86 |
import org.gvsig.utils.console.JConsole; |
87 |
import org.gvsig.utils.console.JDockPanel; |
88 |
import org.gvsig.utils.console.ResponseListener; |
89 |
import org.gvsig.utils.console.jedit.JEditTextArea; |
90 |
|
91 |
/**
|
92 |
* <p>
|
93 |
* <b>Class View</b>. This class represents the gvSIG specific internal window
|
94 |
* where the maps are displayed and where the events coming from the user are
|
95 |
* captured.
|
96 |
* </p>
|
97 |
* <p>
|
98 |
* It is composed by three main visual areas:
|
99 |
* </p>
|
100 |
* <ol>
|
101 |
* <li>
|
102 |
* <b>Map control</b>: the map area located in the right area of the window. It
|
103 |
* takes up the biggest part of the window.</li>
|
104 |
* <li>
|
105 |
* <b>Table of contents (TOC)</b>: is a list of layers displayed in the view.
|
106 |
* The TOC is located on the left-top corner of the View and is the place where
|
107 |
* the user can modify the order, the legends, the visibility and other
|
108 |
* properties of the layers.</li>
|
109 |
* <li>
|
110 |
* <b>Map overview</b>: is a small MapControl located in the left-bottom corner
|
111 |
* of the View where the user can put some layers which summarizes the view. It
|
112 |
* is used to make the navigation easier and faster.</li>
|
113 |
* </ol>
|
114 |
*
|
115 |
* @author 2005- Vicente Caballero
|
116 |
* @author 2009- Joaquin del Cerro
|
117 |
*
|
118 |
*/
|
119 |
public class DefaultViewPanel extends AbstractViewPanel implements Observer { |
120 |
/**
|
121 |
*
|
122 |
*/
|
123 |
private static final long serialVersionUID = -4044661458841786519L; |
124 |
|
125 |
private JConsole console;
|
126 |
private JDockPanel dockConsole = null; |
127 |
protected ResponseAdapter consoleResponseAdapter = new ResponseAdapter(); |
128 |
protected boolean isShowConsole = false; |
129 |
private ViewPortListener viewPortListener;
|
130 |
private static MapControlManager mapControlManager = MapControlLocator |
131 |
.getMapControlManager(); |
132 |
|
133 |
/**
|
134 |
* Creates a new View object. Before being used, the object must be
|
135 |
* initialized.
|
136 |
*
|
137 |
* @see initialize()
|
138 |
*/
|
139 |
public DefaultViewPanel() {
|
140 |
super();
|
141 |
this.setName("View"); |
142 |
// TODO Remove this when the system lo load libraries is finished
|
143 |
if (mapControlManager == null) { |
144 |
mapControlManager = MapControlLocator.getMapControlManager(); |
145 |
} |
146 |
} |
147 |
|
148 |
public DefaultViewPanel(Document document) { |
149 |
this();
|
150 |
this.initialize();
|
151 |
this.setDocument(document);
|
152 |
} |
153 |
|
154 |
/**
|
155 |
* Create the internal componentes and populate the window with them.
|
156 |
* If the layout properties were set using the
|
157 |
* <code>setWindowData(WindowData)</code> method, the window will be
|
158 |
* populated according to this properties.
|
159 |
*/
|
160 |
protected void initialize() { |
161 |
super.initialize();
|
162 |
initComponents(); |
163 |
hideConsole(); |
164 |
getConsolePanel().addResponseListener(consoleResponseAdapter); |
165 |
} |
166 |
|
167 |
public void setDocument(Document document) { |
168 |
setModel((ViewDocument) document); |
169 |
} |
170 |
|
171 |
public Document getDocument() { |
172 |
return this.modelo; |
173 |
} |
174 |
|
175 |
public void setModel(ViewDocument model) { |
176 |
this.modelo = model;
|
177 |
// Se registra como listener de cambios en FMap
|
178 |
MapContext fmap = modelo.getMapContext(); |
179 |
|
180 |
FLayers layers = fmap.getLayers(); |
181 |
for (int i = 0; i < layers.getLayersCount(); i++) { |
182 |
if (layers.getLayer(i).isEditing()
|
183 |
&& layers.getLayer(i) instanceof FLyrVect) {
|
184 |
this.showConsole();
|
185 |
} |
186 |
} |
187 |
|
188 |
// Se configura el mapControl
|
189 |
m_MapControl.setMapContext(fmap); |
190 |
m_TOC.setMapContext(fmap); |
191 |
m_MapControl.getMapContext().getLayers().addLegendListener(m_TOC); |
192 |
|
193 |
m_MapControl.setBackground(new Color(255, 255, 255)); |
194 |
if (modelo.getMapOverViewContext() != null) { |
195 |
m_MapLoc.setModel(modelo.getMapOverViewContext()); |
196 |
} |
197 |
model.addPropertyChangeListener(new PropertyChangeListener() { |
198 |
public void propertyChange(PropertyChangeEvent evt) { |
199 |
if (evt.getPropertyName().equals("name")) { |
200 |
PluginServices.getMDIManager() |
201 |
.getWindowInfo(DefaultViewPanel.this) |
202 |
.setTitle( |
203 |
PluginServices.getText(this, "Vista") + ": " |
204 |
+ (String) evt.getNewValue());
|
205 |
} |
206 |
} |
207 |
}); |
208 |
if (m_MapControl.getViewPort() != null) { |
209 |
viewPortListener = new ViewPortListener() {
|
210 |
public void extentChanged(ExtentEvent e) { |
211 |
if (PluginServices.getMainFrame() != null) { |
212 |
PluginServices |
213 |
.getMainFrame() |
214 |
.getStatusBar() |
215 |
.setControlValue( |
216 |
"view-change-scale",
|
217 |
String.valueOf(m_MapControl
|
218 |
.getMapContext().getScaleView())); |
219 |
PluginServices |
220 |
.getMainFrame() |
221 |
.getStatusBar() |
222 |
.setMessage( |
223 |
"projection",
|
224 |
getMapControl().getViewPort() |
225 |
.getProjection().getAbrev()); |
226 |
} |
227 |
} |
228 |
|
229 |
public void backColorChanged(ColorEvent e) { |
230 |
// Do nothing
|
231 |
} |
232 |
|
233 |
public void projectionChanged(ProjectionEvent e) { |
234 |
m_MapLoc.setProjection(e.getNewProjection()); |
235 |
} |
236 |
}; |
237 |
m_MapControl.getViewPort().addViewPortListener(viewPortListener); |
238 |
} |
239 |
} |
240 |
|
241 |
public JConsole getConsolePanel() {
|
242 |
if (console == null) { |
243 |
console = new JConsole();
|
244 |
// Para distinguir cuando se est? escribiendo sobre la consola y
|
245 |
// cuando no.
|
246 |
console.setJTextName("CADConsole");
|
247 |
} |
248 |
return console;
|
249 |
} |
250 |
|
251 |
private JDockPanel getDockConsole() {
|
252 |
if (dockConsole == null) { |
253 |
dockConsole = new JDockPanel(getConsolePanel());
|
254 |
} |
255 |
return dockConsole;
|
256 |
} |
257 |
|
258 |
public void addConsoleListener(String prefix, ResponseListener listener) { |
259 |
consoleResponseAdapter.putSpaceListener(prefix, listener); |
260 |
|
261 |
} |
262 |
|
263 |
public void removeConsoleListener(ResponseListener listener) { |
264 |
consoleResponseAdapter.deleteListener(listener); |
265 |
|
266 |
} |
267 |
|
268 |
public void focusConsole(String text) { |
269 |
getConsolePanel().addResponseText(text); |
270 |
|
271 |
JEditTextArea jeta = getConsolePanel().getTxt(); |
272 |
jeta.requestFocusInWindow(); |
273 |
jeta.setCaretPosition(jeta.getText().length()); |
274 |
|
275 |
} |
276 |
|
277 |
public void hideConsole() { |
278 |
isShowConsole = false;
|
279 |
getDockConsole().setVisible(false);
|
280 |
|
281 |
} |
282 |
|
283 |
public void showConsole() { |
284 |
if (isShowConsole) {
|
285 |
return;
|
286 |
} |
287 |
isShowConsole = true;
|
288 |
getMapControl().remove(getDockConsole()); |
289 |
getMapControl().setLayout(new BorderLayout()); |
290 |
getMapControl().add(getDockConsole(), BorderLayout.SOUTH);
|
291 |
getDockConsole().setVisible(true);
|
292 |
|
293 |
} |
294 |
|
295 |
static class ResponseAdapter implements ResponseListener { |
296 |
|
297 |
private HashMap<String, ResponseListener> spaceListener = |
298 |
new HashMap<String, ResponseListener>(); |
299 |
|
300 |
public void putSpaceListener(String namespace, ResponseListener listener) { |
301 |
spaceListener.put(namespace, listener); |
302 |
} |
303 |
|
304 |
public void acceptResponse(String response) { |
305 |
boolean nameSpace = false; |
306 |
int n = -1; |
307 |
if (response != null) { |
308 |
if ((n = response.indexOf(':')) != -1) { |
309 |
nameSpace = true;
|
310 |
} |
311 |
} |
312 |
|
313 |
if (nameSpace) {
|
314 |
ResponseListener listener = |
315 |
spaceListener.get(response.substring(0, n));
|
316 |
if (listener != null) { |
317 |
listener.acceptResponse(response.substring(n + 1));
|
318 |
} |
319 |
} else {
|
320 |
Iterator<ResponseListener> i =
|
321 |
spaceListener.values().iterator(); |
322 |
while (i.hasNext()) {
|
323 |
ResponseListener listener = i.next(); |
324 |
listener.acceptResponse(response); |
325 |
} |
326 |
} |
327 |
} |
328 |
|
329 |
/**
|
330 |
* @param listener
|
331 |
*/
|
332 |
public void deleteListener(ResponseListener listener) { |
333 |
Iterator<String> i = spaceListener.keySet().iterator(); |
334 |
while (i.hasNext()) {
|
335 |
String namespace = i.next();
|
336 |
ResponseListener l = spaceListener.get(namespace); |
337 |
if (l == listener) {
|
338 |
spaceListener.remove(namespace); |
339 |
} |
340 |
} |
341 |
} |
342 |
|
343 |
} |
344 |
|
345 |
protected void initComponents() { // GEN-BEGIN:initComponents |
346 |
m_MapControl = new MapControl(); // Default is paintEnabled = false. |
347 |
// Remember to activate it
|
348 |
try {
|
349 |
m_MapControl.setMapControlDrawer(mapControlManager |
350 |
.createDefaultMapControlDrawer()); |
351 |
} catch (MapControlCreationException e) {
|
352 |
NotificationManager.addError(e); |
353 |
} |
354 |
|
355 |
m_MapControl.addExceptionListener(mapControlExceptionListener); |
356 |
m_TOC = new TOC();
|
357 |
|
358 |
// Ponemos el localizador
|
359 |
m_MapLoc = new MapOverview(m_MapControl);
|
360 |
try {
|
361 |
m_MapLoc.setMapControlDrawer(mapControlManager |
362 |
.createDefaultMapControlDrawer()); |
363 |
} catch (MapControlCreationException e) {
|
364 |
NotificationManager.addError(e); |
365 |
} |
366 |
removeAll(); |
367 |
tempMainSplit = new ViewSplitPane(JSplitPane.HORIZONTAL_SPLIT); |
368 |
|
369 |
if (windowLayout == null) { |
370 |
m_MapLoc.setPreferredSize(new Dimension(150, 200)); |
371 |
tempMainSplit.setPreferredSize(new Dimension(500, 300)); |
372 |
} |
373 |
|
374 |
if (!isPalette()) {
|
375 |
tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
376 |
tempSplitToc.setTopComponent(m_TOC); |
377 |
tempSplitToc.setBottomComponent(m_MapLoc); |
378 |
tempSplitToc.setResizeWeight(0.7);
|
379 |
tempMainSplit.setLeftComponent(tempSplitToc); |
380 |
} else {
|
381 |
tempMainSplit.setLeftComponent(m_TOC); |
382 |
} |
383 |
m_TOC.setVisible(true);
|
384 |
tempMainSplit.setRightComponent(m_MapControl); |
385 |
this.setLayout(new BorderLayout()); |
386 |
this.add(tempMainSplit, BorderLayout.CENTER); |
387 |
|
388 |
if (windowLayout != null) { |
389 |
try {
|
390 |
tempMainSplit.setDividerLocation(Integer.valueOf(
|
391 |
windowLayout.get("MainDivider.Location")).intValue());
|
392 |
if (windowLayout.get("TOCDivider.Location") != null) { |
393 |
tempSplitToc.setDividerLocation(Integer.valueOf(
|
394 |
windowLayout.get("TOCDivider.Location")).intValue());
|
395 |
} |
396 |
} catch (NumberFormatException ex) { |
397 |
PluginServices.getLogger().error( |
398 |
"Error restoring View properties");
|
399 |
} |
400 |
} |
401 |
|
402 |
// Listener de eventos de movimiento que pone las coordenadas del rat?n
|
403 |
// en la barra de estado
|
404 |
StatusBarListener sbl = new StatusBarListener(m_MapControl);
|
405 |
|
406 |
// Zoom out (pinchas y el mapa se centra y te muestra m?s).
|
407 |
// No es dibujando un rect?ngulo, es solo pinchando.
|
408 |
|
409 |
ZoomOutListener zol = new ZoomOutListener(m_MapControl);
|
410 |
|
411 |
m_MapControl.addBehavior("zoomOut", new Behavior[] { |
412 |
new PointBehavior(zol), new MouseMovementBehavior(sbl) }); |
413 |
|
414 |
// pan
|
415 |
|
416 |
PanListener pl = new PanListener(m_MapControl);
|
417 |
m_MapControl.addBehavior("pan", new Behavior[] { new MoveBehavior(pl), |
418 |
new MouseMovementBehavior(sbl) });
|
419 |
|
420 |
// Medir
|
421 |
|
422 |
MeasureListener mli = new MeasureListener(m_MapControl);
|
423 |
m_MapControl.addBehavior("medicion", new Behavior[] { |
424 |
new PolylineBehavior(mli), new MouseMovementBehavior(sbl) }); |
425 |
|
426 |
// Area
|
427 |
|
428 |
AreaListener ali = new AreaListener(m_MapControl);
|
429 |
m_MapControl.addBehavior("area", new Behavior[] { |
430 |
new PolygonBehavior(ali), new MouseMovementBehavior(sbl) }); |
431 |
|
432 |
// Seleccion por punto
|
433 |
PointSelectListener psl = new PointSelectListener(m_MapControl);
|
434 |
m_MapControl.addBehavior("pointSelection", new Behavior[] { |
435 |
new PointBehavior(psl), new MouseMovementBehavior(sbl) }); |
436 |
|
437 |
// Info por punto
|
438 |
InfoListener il = new InfoListener(m_MapControl);
|
439 |
m_MapControl.addBehavior("info", new Behavior[] { |
440 |
new PointBehavior(il), new MouseMovementBehavior(sbl) }); |
441 |
|
442 |
// Selecci?n por rect?ngulo
|
443 |
RectangleSelectListener rsl = new RectangleSelectListener(m_MapControl);
|
444 |
m_MapControl.addBehavior("rectSelection", new Behavior[] { |
445 |
new RectangleBehavior(rsl), new MouseMovementBehavior(sbl) }); |
446 |
|
447 |
// Selecci?n por pol?gono
|
448 |
PolygonSelectListener poligSel = |
449 |
new PolygonSelectListener(m_MapControl);
|
450 |
m_MapControl.addBehavior("polSelection", new Behavior[] { |
451 |
new PolygonBehavior(poligSel), new MouseMovementBehavior(sbl) }); |
452 |
|
453 |
// Zoom por rect?ngulo
|
454 |
ZoomOutRightButtonListener zoil = |
455 |
new ZoomOutRightButtonListener(m_MapControl);
|
456 |
ZoomInListener zil = new ZoomInListener(m_MapControl);
|
457 |
m_MapControl.addBehavior("zoomIn", new Behavior[] { |
458 |
new RectangleBehavior(zil), new PointBehavior(zoil), |
459 |
new MouseMovementBehavior(sbl) });
|
460 |
|
461 |
/*
|
462 |
SelectImageListener sil = new SelectImageListener(m_MapControl);
|
463 |
m_MapControl.addBehavior("selectImage", new Behavior[] {
|
464 |
new PointBehavior(sil), new MouseMovementBehavior(sbl) });
|
465 |
*/
|
466 |
|
467 |
m_MapControl.setTool("zoomIn"); // Por defecto |
468 |
m_MapControl.addCombinedBehavior(new MouseWheelBehavior());
|
469 |
} |
470 |
|
471 |
public void windowActivated() { |
472 |
NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar(); |
473 |
MapContext mapContext = this.getMapControl().getMapContext();
|
474 |
|
475 |
statusbar.setMessage("units",
|
476 |
PluginServices.getText(this, mapContext.getDistanceName()));
|
477 |
statusbar.setControlValue("view-change-scale",
|
478 |
String.valueOf(mapContext.getScaleView()));
|
479 |
IProjection proj = getMapControl().getViewPort().getProjection(); |
480 |
if (proj != null) { |
481 |
statusbar.setMessage("projection", proj.getAbrev());
|
482 |
} else {
|
483 |
statusbar.setMessage("projection", ""); |
484 |
} |
485 |
} |
486 |
|
487 |
public void windowClosed() { |
488 |
super.windowClosed();
|
489 |
if (viewPortListener != null) { |
490 |
getMapControl().getViewPort().removeViewPortListener( |
491 |
viewPortListener); |
492 |
} |
493 |
if (getMapOverview() != null) { |
494 |
getMapOverview().getViewPort().removeViewPortListener( |
495 |
getMapOverview()); |
496 |
} |
497 |
|
498 |
} |
499 |
|
500 |
public void toPalette() { |
501 |
isPalette = true;
|
502 |
m_MapLoc.setPreferredSize(new Dimension(200, 150)); |
503 |
m_MapLoc.setSize(new Dimension(200, 150)); |
504 |
movp = new MapOverViewPalette(m_MapLoc, this); |
505 |
PluginServices.getMDIManager().addWindow(movp); |
506 |
FLayer[] layers =
|
507 |
getViewDocument().getMapContext().getLayers().getActives(); |
508 |
if (layers.length > 0 && layers[0] instanceof FLyrVect) { |
509 |
if (((FLyrVect) layers[0]).isEditing()) { |
510 |
showConsole(); |
511 |
return;
|
512 |
} |
513 |
} |
514 |
hideConsole(); |
515 |
|
516 |
} |
517 |
|
518 |
public void restore() { |
519 |
isPalette = false;
|
520 |
PluginServices.getMDIManager().closeWindow(movp); |
521 |
FLayer[] layers =
|
522 |
getViewDocument().getMapContext().getLayers().getActives(); |
523 |
if (layers.length > 0 && layers[0] instanceof FLyrVect) { |
524 |
if (((FLyrVect) layers[0]).isEditing()) { |
525 |
showConsole(); |
526 |
return;
|
527 |
} |
528 |
} |
529 |
hideConsole(); |
530 |
JSplitPane tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
531 |
tempSplitToc.setTopComponent(m_TOC); |
532 |
tempSplitToc.setBottomComponent(m_MapLoc); |
533 |
tempSplitToc.setResizeWeight(0.7);
|
534 |
tempMainSplit.setLeftComponent(tempSplitToc); |
535 |
} |
536 |
|
537 |
/**
|
538 |
* Sets the default map overview background color that will be used in
|
539 |
* subsequent projects.
|
540 |
*
|
541 |
* @param color
|
542 |
* @deprecated use instead
|
543 |
* Project.getPreferences().setDefaultMapoverViewBackColor
|
544 |
*/
|
545 |
public static void setDefaultMapOverViewBackColor(Color color) { |
546 |
DefaultProject.getPreferences().setDefaultOverviewBackColor(color); |
547 |
} |
548 |
|
549 |
/**
|
550 |
* Returns the current default map overview background color defined which
|
551 |
* is the color defined when the user does not define any other one
|
552 |
*
|
553 |
* @return java.awt.Color
|
554 |
* @deprecated use instead
|
555 |
* Project.getPreferences().setDefaultMapoverViewBackColor
|
556 |
*/
|
557 |
public static Color getDefaultMapOverViewBackColor() { |
558 |
return DefaultProject.getPreferences().getDefaultOverviewBackColor();
|
559 |
} |
560 |
|
561 |
/**
|
562 |
* Returns the current default view background color defined which is the
|
563 |
* color defined when the user does not define any other one
|
564 |
*
|
565 |
* @return java.awt.Color
|
566 |
* @deprecated use instead Project.getPreferences().getDefaultViewBackColor
|
567 |
*/
|
568 |
public static Color getDefaultBackColor() { |
569 |
return DefaultProject.getPreferences().getDefaultViewBackColor();
|
570 |
} |
571 |
|
572 |
/**
|
573 |
* @deprecated use instead Project.getPreferences().setDefaultViewBackColor
|
574 |
*/
|
575 |
public static void setDefaultBackColor(Color color) { |
576 |
DefaultProject.getPreferences().setDefaultViewBackColor(color); |
577 |
} |
578 |
|
579 |
public Object getWindowProfile() { |
580 |
return WindowInfo.EDITOR_PROFILE;
|
581 |
} |
582 |
|
583 |
/* (non-Javadoc)
|
584 |
* @see org.gvsig.tools.observer.Observer#update(org.gvsig.tools.observer.Observable, java.lang.Object)
|
585 |
*/
|
586 |
public void update(final Observable observable, final Object notification) { |
587 |
|
588 |
if (notification instanceof FeatureStoreNotification) { |
589 |
FeatureStoreNotification event = |
590 |
(FeatureStoreNotification) notification; |
591 |
if (event.getType() == FeatureStoreNotification.AFTER_CANCELEDITING
|
592 |
|| event.getType() == FeatureStoreNotification.AFTER_FINISHEDITING) { |
593 |
|
594 |
if (!SwingUtilities.isEventDispatchThread()) { |
595 |
SwingUtilities.invokeLater(new Runnable() { |
596 |
public void run() { |
597 |
update(observable, notification); |
598 |
} |
599 |
}); |
600 |
return;
|
601 |
} |
602 |
getMapControl().setTool("zoomIn");
|
603 |
hideConsole(); |
604 |
repaintMap(); |
605 |
} |
606 |
} |
607 |
} |
608 |
|
609 |
} |