~ubuntu-branches/ubuntu/natty/aspectj/natty

« back to all changes in this revision

Viewing changes to org.aspectj/modules/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2009-10-04 16:37:23 UTC
  • mfrom: (1.1.3 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091004163723-ck4y7j7fhjxskkie
Tags: 1.6.6+dfsg-1
* New upstream release.
  - Update 02_use_gjdoc.diff patch
* Update my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java;
2
 
 
3
 
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
4
 
 *
5
 
 * This file is part of the design patterns project at UBC
6
 
 *
7
 
 * The contents of this file are subject to the Mozilla Public License
8
 
 * Version 1.1 (the "License"); you may not use this file except in
9
 
 * compliance with the License. You may obtain a copy of the License at
10
 
 * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
11
 
 *
12
 
 * Software distributed under the License is distributed on an "AS IS" basis,
13
 
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14
 
 * for the specific language governing rights and limitations under the
15
 
 * License.
16
 
 *
17
 
 * The Original Code is ca.ubc.cs.spl.aspectPatterns.
18
 
 * 
19
 
 * For more details and the latest version of this code, please see:
20
 
 * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
21
 
 *
22
 
 * Contributor(s):   
23
 
 */
24
 
 
25
 
import javax.swing.JButton;
26
 
import java.awt.event.ActionListener;
27
 
import java.awt.event.ActionEvent;
28
 
 
29
 
/** 
30
 
 * Basically a <code>JButton</code> with an <code>ActionListener</code>. 
31
 
 * The listener calls <code>clicked()</code> when the button gets pressed. 
32
 
 *
33
 
 * @author  Jan Hannemann
34
 
 * @author  Gregor Kiczales
35
 
 * @version 1.1, 02/12/04
36
 
 */
37
 
 
38
 
public class Button extends JButton implements GUIColleague {   
39
 
    
40
 
    private GUIMediator mediator;
41
 
    
42
 
    /**
43
 
     * Creates a new <code>Button</code> object with the provided label.
44
 
     *
45
 
     * @param name the label for the new <code>Button</code> object 
46
 
     */
47
 
 
48
 
        public Button(String name) {
49
 
                super(name);
50
 
                this.setActionCommand(name);
51
 
                this.addActionListener(new ActionListener() {
52
 
                        public void actionPerformed(ActionEvent e) {
53
 
                                clicked(); 
54
 
                        }
55
 
                }); 
56
 
        }
57
 
        
58
 
        public void clicked() {
59
 
            mediator.colleagueChanged(this);
60
 
        }  
61
 
        
62
 
    /**
63
 
     * Allows to set the <i>Mediator</i> for this <i>Colleague</i>
64
 
     *
65
 
     * @param mediator the new mediator
66
 
     */
67
 
    
68
 
        public void setMediator(GUIMediator mediator) {
69
 
            this.mediator = mediator;
70
 
        }
71
 
}
 
 
b'\\ No newline at end of file'