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