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 @ 41937
History | View | Annotate | Download (19.9 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.MoveWithMiddleButtonBehavior; |
78 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior; |
79 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolygonBehavior; |
80 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolylineBehavior; |
81 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.RectangleBehavior; |
82 |
import org.gvsig.tools.observer.Observable; |
83 |
import org.gvsig.tools.observer.Observer; |
84 |
import org.gvsig.utils.console.JConsole; |
85 |
import org.gvsig.utils.console.JDockPanel; |
86 |
import org.gvsig.utils.console.ResponseListener; |
87 |
import org.gvsig.utils.console.jedit.JEditTextArea; |
88 |
|
89 |
/**
|
90 |
* <p>
|
91 |
* <b>Class View</b>. This class represents the gvSIG specific internal window
|
92 |
* where the maps are displayed and where the events coming from the user are
|
93 |
* captured.
|
94 |
* </p>
|
95 |
* <p>
|
96 |
* It is composed by three main visual areas:
|
97 |
* </p>
|
98 |
* <ol>
|
99 |
* <li>
|
100 |
* <b>Map control</b>: the map area located in the right area of the window. It
|
101 |
* takes up the biggest part of the window.</li>
|
102 |
* <li>
|
103 |
* <b>Table of contents (TOC)</b>: is a list of layers displayed in the view.
|
104 |
* The TOC is located on the left-top corner of the View and is the place where
|
105 |
* the user can modify the order, the legends, the visibility and other
|
106 |
* properties of the layers.</li>
|
107 |
* <li>
|
108 |
* <b>Map overview</b>: is a small MapControl located in the left-bottom corner
|
109 |
* of the View where the user can put some layers which summarizes the view. It
|
110 |
* is used to make the navigation easier and faster.</li>
|
111 |
* </ol>
|
112 |
*
|
113 |
* @author 2005- Vicente Caballero
|
114 |
* @author 2009- Joaquin del Cerro
|
115 |
*
|
116 |
*/
|
117 |
public class DefaultViewPanel extends AbstractViewPanel implements Observer { |
118 |
/**
|
119 |
*
|
120 |
*/
|
121 |
private static final long serialVersionUID = -4044661458841786519L; |
122 |
|
123 |
private JConsole console;
|
124 |
private JDockPanel dockConsole = null; |
125 |
protected ResponseAdapter consoleResponseAdapter = new ResponseAdapter(); |
126 |
protected boolean isShowConsole = false; |
127 |
private ViewPortListener viewPortListener;
|
128 |
|
129 |
private static MapControlManager mapControlManager = MapControlLocator |
130 |
.getMapControlManager(); |
131 |
|
132 |
/**
|
133 |
* Creates a new View object. Before being used, the object must be
|
134 |
* initialized.
|
135 |
*
|
136 |
* @see initialize()
|
137 |
*/
|
138 |
public DefaultViewPanel() {
|
139 |
super();
|
140 |
this.setName("View"); |
141 |
// TODO Remove this when the system lo load libraries is finished
|
142 |
if (mapControlManager == null) { |
143 |
mapControlManager = MapControlLocator.getMapControlManager(); |
144 |
} |
145 |
} |
146 |
|
147 |
public DefaultViewPanel(Document document) { |
148 |
this();
|
149 |
this.initialize(((ViewDocument)document).getMapContext());
|
150 |
this.setDocument(document);
|
151 |
} |
152 |
|
153 |
/**
|
154 |
* Create the internal componentes and populate the window with them.
|
155 |
* If the layout properties were set using the
|
156 |
* <code>setWindowData(WindowData)</code> method, the window will be
|
157 |
* populated according to this properties.
|
158 |
*/
|
159 |
protected void initialize(MapContext mapContext) { |
160 |
super.initialize();
|
161 |
initComponents(mapContext); |
162 |
hideConsole(); |
163 |
getConsolePanel().addResponseListener(consoleResponseAdapter); |
164 |
} |
165 |
|
166 |
public void setDocument(Document document) { |
167 |
setModel((ViewDocument) document); |
168 |
} |
169 |
|
170 |
public Document getDocument() { |
171 |
return this.modelo; |
172 |
} |
173 |
|
174 |
public void setModel(ViewDocument model) { |
175 |
this.modelo = model;
|
176 |
// Se registra como listener de cambios en FMap
|
177 |
MapContext fmap = modelo.getMapContext(); |
178 |
|
179 |
FLayers layers = fmap.getLayers(); |
180 |
for (int i = 0; i < layers.getLayersCount(); i++) { |
181 |
if (layers.getLayer(i).isEditing()
|
182 |
&& layers.getLayer(i) instanceof FLyrVect) {
|
183 |
this.showConsole();
|
184 |
} |
185 |
} |
186 |
|
187 |
// Se configura el mapControl
|
188 |
m_TOC.setMapContext(fmap); |
189 |
m_MapControl.getMapContext().getLayers().addLegendListener(m_TOC); |
190 |
|
191 |
m_MapControl.setBackground(new Color(255, 255, 255)); |
192 |
if (modelo.getMapOverViewContext() != null) { |
193 |
m_MapLoc.setModel(modelo.getMapOverViewContext()); |
194 |
} |
195 |
model.addPropertyChangeListener(new PropertyChangeListener() { |
196 |
public void propertyChange(PropertyChangeEvent evt) { |
197 |
if (evt.getPropertyName().equals("name")) { |
198 |
PluginServices.getMDIManager() |
199 |
.getWindowInfo(DefaultViewPanel.this) |
200 |
.setTitle( |
201 |
PluginServices.getText(this, "Vista") + ": " |
202 |
+ (String) evt.getNewValue());
|
203 |
} |
204 |
} |
205 |
}); |
206 |
if (m_MapControl.getViewPort() != null) { |
207 |
viewPortListener = new ViewPortListener() {
|
208 |
public void extentChanged(ExtentEvent e) { |
209 |
if (PluginServices.getMainFrame() != null) { |
210 |
PluginServices |
211 |
.getMainFrame() |
212 |
.getStatusBar() |
213 |
.setControlValue( |
214 |
"view-change-scale",
|
215 |
String.valueOf(m_MapControl
|
216 |
.getMapContext().getScaleView())); |
217 |
PluginServices |
218 |
.getMainFrame() |
219 |
.getStatusBar() |
220 |
.setMessage( |
221 |
"projection",
|
222 |
getMapControl().getViewPort() |
223 |
.getProjection().getAbrev()); |
224 |
} |
225 |
} |
226 |
|
227 |
public void backColorChanged(ColorEvent e) { |
228 |
// Do nothing
|
229 |
} |
230 |
|
231 |
public void projectionChanged(ProjectionEvent e) { |
232 |
m_MapLoc.setProjection(e.getNewProjection()); |
233 |
} |
234 |
}; |
235 |
m_MapControl.getViewPort().addViewPortListener(viewPortListener); |
236 |
} |
237 |
} |
238 |
|
239 |
public JConsole getConsolePanel() {
|
240 |
if (console == null) { |
241 |
console = new JConsole(true); |
242 |
// Para distinguir cuando se est? escribiendo sobre la consola y
|
243 |
// cuando no.
|
244 |
console.setJTextName("CADConsole");
|
245 |
} |
246 |
return console;
|
247 |
} |
248 |
|
249 |
private JDockPanel getDockConsole() {
|
250 |
if (dockConsole == null) { |
251 |
dockConsole = new JDockPanel(getConsolePanel());
|
252 |
} |
253 |
return dockConsole;
|
254 |
} |
255 |
|
256 |
public void addConsoleListener(String prefix, ResponseListener listener) { |
257 |
consoleResponseAdapter.putSpaceListener(prefix, listener); |
258 |
|
259 |
} |
260 |
|
261 |
public void removeConsoleListener(ResponseListener listener) { |
262 |
consoleResponseAdapter.deleteListener(listener); |
263 |
|
264 |
} |
265 |
|
266 |
public void focusConsole(String text) { |
267 |
getConsolePanel().addResponseText(text); |
268 |
|
269 |
JEditTextArea jeta = getConsolePanel().getTxt(); |
270 |
jeta.requestFocusInWindow(); |
271 |
jeta.setCaretPosition(jeta.getText().length()); |
272 |
|
273 |
} |
274 |
|
275 |
public void hideConsole() { |
276 |
isShowConsole = false;
|
277 |
getDockConsole().setVisible(false);
|
278 |
|
279 |
} |
280 |
|
281 |
public void showConsole() { |
282 |
if (isShowConsole || disableConsole) {
|
283 |
return;
|
284 |
} |
285 |
isShowConsole = true;
|
286 |
getMapControl().remove(getDockConsole()); |
287 |
getMapControl().setLayout(new BorderLayout()); |
288 |
getMapControl().add(getDockConsole(), BorderLayout.SOUTH);
|
289 |
getDockConsole().setVisible(true);
|
290 |
|
291 |
} |
292 |
|
293 |
static class ResponseAdapter implements ResponseListener { |
294 |
|
295 |
private HashMap<String, ResponseListener> spaceListener = |
296 |
new HashMap<String, ResponseListener>(); |
297 |
|
298 |
public void putSpaceListener(String namespace, ResponseListener listener) { |
299 |
spaceListener.put(namespace, listener); |
300 |
} |
301 |
|
302 |
public void acceptResponse(String response) { |
303 |
boolean nameSpace = false; |
304 |
int n = -1; |
305 |
if (response != null) { |
306 |
if ((n = response.indexOf(':')) != -1) { |
307 |
nameSpace = true;
|
308 |
} |
309 |
} |
310 |
|
311 |
if (nameSpace) {
|
312 |
ResponseListener listener = |
313 |
spaceListener.get(response.substring(0, n));
|
314 |
if (listener != null) { |
315 |
listener.acceptResponse(response.substring(n + 1));
|
316 |
} |
317 |
} else {
|
318 |
Iterator<ResponseListener> i =
|
319 |
spaceListener.values().iterator(); |
320 |
while (i.hasNext()) {
|
321 |
ResponseListener listener = i.next(); |
322 |
listener.acceptResponse(response); |
323 |
} |
324 |
} |
325 |
} |
326 |
|
327 |
/**
|
328 |
* @param listener
|
329 |
*/
|
330 |
public void deleteListener(ResponseListener listener) { |
331 |
Iterator<String> i = spaceListener.keySet().iterator(); |
332 |
while (i.hasNext()) {
|
333 |
String namespace = i.next();
|
334 |
ResponseListener l = spaceListener.get(namespace); |
335 |
if (l == listener) {
|
336 |
spaceListener.remove(namespace); |
337 |
} |
338 |
} |
339 |
} |
340 |
|
341 |
} |
342 |
|
343 |
protected void initComponents(MapContext mapContext) { // GEN-BEGIN:initComponents |
344 |
// Remember to activate it
|
345 |
try {
|
346 |
m_MapControl = mapControlManager.createJMapControlPanel(mapContext); |
347 |
m_MapControl.setMapControlDrawer(mapControlManager |
348 |
.createDefaultMapControlDrawer()); |
349 |
} catch (MapControlCreationException e) {
|
350 |
NotificationManager.addError(e); |
351 |
} |
352 |
|
353 |
m_MapControl.addExceptionListener(mapControlExceptionListener); |
354 |
m_TOC = new TOC();
|
355 |
|
356 |
// Ponemos el localizador
|
357 |
m_MapLoc = new MapOverview(m_MapControl);
|
358 |
try {
|
359 |
m_MapLoc.setMapControlDrawer(mapControlManager |
360 |
.createDefaultMapControlDrawer()); |
361 |
} catch (MapControlCreationException e) {
|
362 |
NotificationManager.addError(e); |
363 |
} |
364 |
removeAll(); |
365 |
tempMainSplit = new ViewSplitPane(JSplitPane.HORIZONTAL_SPLIT); |
366 |
|
367 |
if (windowLayout == null) { |
368 |
m_MapLoc.setPreferredSize(new Dimension(150, 200)); |
369 |
tempMainSplit.setPreferredSize(new Dimension(500, 300)); |
370 |
} |
371 |
|
372 |
if (!isPalette()) {
|
373 |
tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
374 |
tempSplitToc.setTopComponent(m_TOC); |
375 |
tempSplitToc.setBottomComponent(m_MapLoc); |
376 |
tempSplitToc.setResizeWeight(0.7);
|
377 |
tempMainSplit.setLeftComponent(tempSplitToc); |
378 |
} else {
|
379 |
tempMainSplit.setLeftComponent(m_TOC); |
380 |
} |
381 |
m_TOC.setVisible(true);
|
382 |
tempMainSplit.setRightComponent(m_MapControl); |
383 |
this.setLayout(new BorderLayout()); |
384 |
this.add(tempMainSplit, BorderLayout.CENTER); |
385 |
|
386 |
if (windowLayout != null) { |
387 |
try {
|
388 |
tempMainSplit.setDividerLocation(Integer.valueOf(
|
389 |
windowLayout.get("MainDivider.Location")).intValue());
|
390 |
if (windowLayout.get("TOCDivider.Location") != null) { |
391 |
tempSplitToc.setDividerLocation(Integer.valueOf(
|
392 |
windowLayout.get("TOCDivider.Location")).intValue());
|
393 |
} |
394 |
} catch (NumberFormatException ex) { |
395 |
PluginServices.getLogger().error( |
396 |
"Error restoring View properties");
|
397 |
} |
398 |
} |
399 |
|
400 |
// Listener de eventos de movimiento que pone las coordenadas del rat?n
|
401 |
// en la barra de estado
|
402 |
StatusBarListener sbl = new StatusBarListener(m_MapControl);
|
403 |
|
404 |
// Zoom out (pinchas y el mapa se centra y te muestra m?s).
|
405 |
// No es dibujando un rect?ngulo, es solo pinchando.
|
406 |
|
407 |
ZoomOutListener zol = new ZoomOutListener(m_MapControl);
|
408 |
|
409 |
m_MapControl.addBehavior("zoomOut", new Behavior[] { |
410 |
new PointBehavior(zol)});
|
411 |
|
412 |
// pan
|
413 |
|
414 |
PanListener pl = new PanListener(m_MapControl);
|
415 |
m_MapControl.addBehavior("pan", new Behavior[] { new MoveBehavior(pl)}); |
416 |
|
417 |
// Medir
|
418 |
|
419 |
MeasureListener mli = new MeasureListener(m_MapControl);
|
420 |
m_MapControl.addBehavior("medicion", new Behavior[] { |
421 |
new PolylineBehavior(mli)});
|
422 |
|
423 |
// Area
|
424 |
|
425 |
AreaListener ali = new AreaListener(m_MapControl);
|
426 |
m_MapControl.addBehavior("area", new Behavior[] { |
427 |
new PolygonBehavior(ali)});
|
428 |
|
429 |
// Seleccion por punto
|
430 |
PointSelectListener psl = new PointSelectListener(m_MapControl);
|
431 |
m_MapControl.addBehavior("pointSelection", new Behavior[] { |
432 |
new PointBehavior(psl)});
|
433 |
|
434 |
// Info por punto
|
435 |
InfoListener il = new InfoListener(m_MapControl);
|
436 |
m_MapControl.addBehavior("info", new Behavior[] { |
437 |
new PointBehavior(il)});
|
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)});
|
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)});
|
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 |
|
457 |
/*
|
458 |
SelectImageListener sil = new SelectImageListener(m_MapControl);
|
459 |
m_MapControl.addBehavior("selectImage", new Behavior[] {
|
460 |
new PointBehavior(sil), new MouseMovementBehavior(sbl) });
|
461 |
*/
|
462 |
|
463 |
m_MapControl.setTool("zoomIn"); // Por defecto |
464 |
m_MapControl.addCombinedBehavior(new MouseMovementBehavior(sbl));
|
465 |
m_MapControl.addCombinedBehavior(new MouseWheelBehavior());
|
466 |
m_MapControl.addCombinedBehavior(new MoveWithMiddleButtonBehavior(pl));
|
467 |
} |
468 |
|
469 |
public void windowActivated() { |
470 |
super.windowActivated();
|
471 |
|
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 |
private static boolean disableConsole = false; |
610 |
|
611 |
public static void setDisableConsole(boolean disable){ |
612 |
disableConsole = disable; |
613 |
} |
614 |
|
615 |
} |