Statistics
| Revision:

gvsig-projects-pool / org.gvsig.winmgr / trunk / org.gvsig.winmgr.app / org.gvsig.winmgr.app.mainplugin / src / main / java / org / gvsig / coreplugin / StatusBar.java @ 682

History | View | Annotate | Download (3.06 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
package org.gvsig.coreplugin;
25

    
26
import javax.swing.JOptionPane;
27

    
28
import org.gvsig.andami.PluginServices;
29
import org.gvsig.andami.PluginsLocator;
30
import org.gvsig.andami.PluginsManager;
31
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
import org.gvsig.andami.ui.mdiFrame.NewStatusBar;
36
import org.gvsig.tools.dynobject.DynObject;
37

    
38
import static org.gvsig.coreplugin.Consola.consolaFrame;
39

    
40
/**
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
        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
    }
56

    
57
    public void errorEvent(MessageEvent e) {
58
            String msg = e.getMessages()[0];
59
        NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar();
60
        statusbar.message(msg, JOptionPane.ERROR_MESSAGE);
61
    }
62

    
63
    public void warningEvent(MessageEvent e) {
64
        String msg = e.getMessages()[0];
65
        NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar();
66
        statusbar.message(msg, JOptionPane.WARNING_MESSAGE);
67
    }
68

    
69
    public void infoEvent(MessageEvent e) {
70
        String msg = e.getMessages()[0];
71
        NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar();
72
        statusbar.message(msg, JOptionPane.INFORMATION_MESSAGE);
73
    }
74

    
75
    public void execute(String actionCommand) {
76
        // Do nothing
77
    }
78

    
79
    public boolean isEnabled() {
80
        return false;
81
    }
82

    
83
    public boolean isVisible() {
84
        return false;
85
    }
86

    
87
}