KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > patterns > thickclient > application > swt > EventNotifierSelectionAdapter


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: EventNotifierSelectionAdapter.java,v 1.3 2007/01/07 06:14:15 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.patterns.thickclient.application.swt;
23
24 import org.eclipse.swt.events.SelectionEvent;
25 import org.opensubsystems.patterns.thickclient.application.EventProcessor;
26
27 /**
28  * Adapter used to process selection events which result in notification about
29  * that event to registered listener.
30  *
31  * @version $Id: EventNotifierSelectionAdapter.java,v 1.3 2007/01/07 06:14:15 bastafidli Exp $
32  * @author Miro Halas
33  * @code.reviewer Miro Halas
34  * @code.reviewed 1.1 2006/02/16 14:40:49 bastafidli
35  */

36 public class EventNotifierSelectionAdapter extends DelegatingSelectionAdapter
37 {
38    // Attributes ///////////////////////////////////////////////////////////////
39

40    /**
41     * Listener which will be notified when widget is selected.
42     */

43    protected EventProcessor m_listener;
44    
45    /**
46     * Name of the event which will be sent to listener when widget is selected.
47     */

48    protected String JavaDoc m_strEventName;
49    
50    /**
51     * Integer value representing the event. It will be sent to listener when
52     * widget is selected.
53     */

54    protected Integer JavaDoc m_intEventId;
55
56    // Constructors /////////////////////////////////////////////////////////////
57

58    /**
59     * Construct new adapter processing events from special button.
60     *
61     * @param listener - listener to call when event needs to be processed
62     * @param strEventName - name of the event which will be sent to listener
63     * when widget is selected.
64     * @param intEventId - Integer value representing the event. It will be sent
65     * to listener when widget is selected.
66     */

67    public EventNotifierSelectionAdapter(
68       EventProcessor listener,
69       String JavaDoc strEventName,
70       Integer JavaDoc intEventId
71    )
72    {
73       m_listener = listener;
74       m_strEventName = strEventName;
75       m_intEventId = intEventId;
76    }
77    
78    /**
79     * {@inheritDoc}
80     */

81    public void widgetSelected(
82       SelectionEvent event
83    )
84    {
85       m_listener.processEvent(m_strEventName, m_intEventId);
86    }
87 }
88
Popular Tags