KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > application > swt > ModuleListener


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: ModuleListener.java,v 1.5 2007/01/07 06:14:22 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21  
22 package org.opensubsystems.core.application.swt;
23
24 import java.util.logging.Logger JavaDoc;
25
26 import org.eclipse.swt.events.DisposeEvent;
27 import org.eclipse.swt.events.DisposeListener;
28 import org.eclipse.swt.events.SelectionEvent;
29 import org.eclipse.swt.events.SelectionListener;
30 import org.opensubsystems.core.application.ThickClient;
31 import org.opensubsystems.core.util.Log;
32
33 /**
34  * Class processing events from the module toolbar of the SWT thick client
35  * responsible for switching between different modules. Once module is opened,
36  * it is kept opened which will allow us to switch quickly between modules. It
37  * may take more resources which we will have to investigate. Modules also have
38  * to account for changing data.
39  *
40  * @version $Id: ModuleListener.java,v 1.5 2007/01/07 06:14:22 bastafidli Exp $
41  * @author Miro Halas
42  * @code.reviewer Miro Halas
43  * @code.reviewed 1.3 2006/02/04 04:48:35 bastafidli
44  */

45 class ModuleListener implements SelectionListener,
46                                 DisposeListener
47 {
48    // Attributes ///////////////////////////////////////////////////////////////
49

50    /**
51     * The SWT thick client application
52     */

53    protected ThickClient m_client;
54
55    /**
56     * Module for which the listener is listening.
57     */

58    protected String JavaDoc m_strModuleName;
59    
60    // Cached values ////////////////////////////////////////////////////////////
61

62    /**
63     * Logger for this class
64     */

65    private static Logger JavaDoc s_logger = Log.getInstance(ModuleListener.class);
66
67    // Constructors /////////////////////////////////////////////////////////////
68

69    /**
70     * Constructor.
71     *
72     * @param client - client using this listener
73     * @param strModuleName - module for which this listener is listening to
74     */

75    public ModuleListener(
76       ThickClient client,
77       String JavaDoc strModuleName
78    )
79    {
80       m_client = client;
81       m_strModuleName = strModuleName;
82    }
83    
84    /**
85     * {@inheritDoc}
86     */

87    public void widgetSelected(
88       SelectionEvent event
89    )
90    {
91       m_client.activateModule(m_strModuleName);
92    }
93
94    /**
95     * {@inheritDoc}
96     */

97    public void widgetDefaultSelected(
98       SelectionEvent event
99    )
100    {
101       widgetSelected(event);
102    }
103
104    /**
105     * {@inheritDoc}
106     */

107    public void widgetDisposed(
108       DisposeEvent event
109    )
110    {
111       s_logger.fine("Dispose event received for module " + m_strModuleName);
112    }
113 }
114
Popular Tags