source: trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseButtonInteraction.java @ 681

Last change on this file since 681 was 681, checked in by sherbold, 12 years ago
  • added getStringIdentifier() to interface IEventTarget
  • all event types and targets now implement equals and hashCode
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1package de.ugoe.cs.quest.eventcore.gui;
2
3/**
4 * TODO comment
5 *
6 * @version $Revision: $ $Date: $
7 * @author 2011, last modified by $Author: $
8 */
9public abstract class MouseButtonInteraction extends MouseInteraction {
10
11    /**  */
12    private static final long serialVersionUID = 1L;
13
14    /** */
15    public static enum Button {
16        LEFT, MIDDLE, RIGHT, X;
17    }
18
19    /** the button used for mouse interaction */
20    private Button button;
21
22    /**
23     *
24     */
25    public MouseButtonInteraction(Button button) {
26        this.button = button;
27    }
28
29    /**
30     * @return Returns the button.
31     */
32    public Button getButton() {
33        return button;
34    }
35   
36    /*
37     * (non-Javadoc)
38     *
39     * @see java.lang.Object#equals(java.lang.Object)
40     */
41    @Override
42    public boolean equals(Object obj) {
43        if (obj instanceof MouseButtonInteraction) {
44            return getButton().equals(((MouseButtonInteraction) obj).getButton());
45        }
46        return false;
47    }
48
49    /*
50     * (non-Javadoc)
51     *
52     * @see java.lang.Object#hashCode()
53     */
54    @Override
55    public int hashCode() {
56        return getButton().hashCode();
57    }
58}
Note: See TracBrowser for help on using the repository browser.