svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.coreplugin.app / org.gvsig.coreplugin.app.mainplugin / src / main / java / org / gvsig / coreplugin / StatusBar.java @ 43305
History | View | Annotate | Download (3.06 KB)
1 | 40558 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40558 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | *
|
||
6 | 40435 | jjdelcerro | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | 40558 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * of the License, or (at your option) any later version.
|
10 | 40558 | jjdelcerro | *
|
11 | 40435 | jjdelcerro | * 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 | 40558 | jjdelcerro | *
|
16 | 40435 | jjdelcerro | * 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 | 40558 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | 40435 | jjdelcerro | * MA 02110-1301, USA.
|
20 | 40558 | jjdelcerro | *
|
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 | 40435 | jjdelcerro | */
|
24 | package org.gvsig.coreplugin; |
||
25 | |||
26 | import javax.swing.JOptionPane; |
||
27 | |||
28 | import org.gvsig.andami.PluginServices; |
||
29 | 41282 | jjdelcerro | import org.gvsig.andami.PluginsLocator; |
30 | import org.gvsig.andami.PluginsManager; |
||
31 | 40435 | jjdelcerro | import org.gvsig.andami.messages.MessageEvent; |
32 | import org.gvsig.andami.messages.NotificationListener; |
||
33 | import org.gvsig.andami.messages.NotificationManager; |
||
34 | import org.gvsig.andami.plugins.Extension; |
||
35 | 41282 | jjdelcerro | import org.gvsig.andami.ui.mdiFrame.NewStatusBar; |
36 | import org.gvsig.tools.dynobject.DynObject; |
||
37 | 40435 | jjdelcerro | |
38 | 41282 | jjdelcerro | import static org.gvsig.coreplugin.Consola.consolaFrame; |
39 | |||
40 | 40435 | jjdelcerro | /**
|
41 | * Plugin que escucha las notificaciones que recive la aplicaci?n y las muestra
|
||
42 | * en la barra de estado
|
||
43 | */
|
||
44 | public class StatusBar extends Extension implements NotificationListener { |
||
45 | |||
46 | public void initialize() { |
||
47 | 41282 | jjdelcerro | PluginsManager pluginsManager = PluginsLocator.getManager(); |
48 | PluginServices plugin = pluginsManager.getPlugin(this.getClass());
|
||
49 | |||
50 | DynObject pluginProperties = plugin.getPluginProperties(); |
||
51 | Boolean showNotificationsInStatusbar = (Boolean) pluginProperties.getDynValue("showNotificationsInStatusbar"); |
||
52 | if ( showNotificationsInStatusbar == null || showNotificationsInStatusbar.booleanValue() ) { |
||
53 | NotificationManager.addNotificationListener(this);
|
||
54 | } |
||
55 | 40435 | jjdelcerro | } |
56 | |||
57 | public void errorEvent(MessageEvent e) { |
||
58 | String msg = e.getMessages()[0]; |
||
59 | 41282 | jjdelcerro | NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar(); |
60 | statusbar.message(msg, JOptionPane.ERROR_MESSAGE);
|
||
61 | 40435 | jjdelcerro | } |
62 | |||
63 | public void warningEvent(MessageEvent e) { |
||
64 | 41282 | jjdelcerro | String msg = e.getMessages()[0]; |
65 | NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar(); |
||
66 | statusbar.message(msg, JOptionPane.WARNING_MESSAGE);
|
||
67 | 40435 | jjdelcerro | } |
68 | |||
69 | public void infoEvent(MessageEvent e) { |
||
70 | 41282 | jjdelcerro | String msg = e.getMessages()[0]; |
71 | NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar(); |
||
72 | statusbar.message(msg, JOptionPane.INFORMATION_MESSAGE);
|
||
73 | 40435 | jjdelcerro | } |
74 | |||
75 | public void execute(String actionCommand) { |
||
76 | 41282 | jjdelcerro | // Do nothing
|
77 | 40435 | jjdelcerro | } |
78 | |||
79 | public boolean isEnabled() { |
||
80 | return false; |
||
81 | } |
||
82 | |||
83 | public boolean isVisible() { |
||
84 | return false; |
||
85 | } |
||
86 | |||
87 | } |