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

Last change on this file since 786 was 786, checked in by sherbold, 12 years ago
  • code documentation
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1
2package de.ugoe.cs.quest.eventcore.gui;
3
4/**
5 * <p>
6 * Base class for all mouse interaction event types.
7 * </p>
8 *
9 * @version 1.0
10 * @author Patrick Harms
11 */
12public abstract class MouseButtonInteraction extends MouseInteraction {
13
14    /**
15     * <p>
16     * Id for object serialization.
17     * </p>
18     */
19    private static final long serialVersionUID = 1L;
20
21    /**
22     * <p>
23     * Describes the pressed mouse button.
24     * </p>
25     *
26     * @version 1.0
27     * @author Patrick Harms
28     */
29    public static enum Button {
30        LEFT, MIDDLE, RIGHT, X;
31    }
32
33    /**
34     * <p>
35     * The button used for mouse interaction
36     * </p>
37     */
38    private Button button;
39
40    /**
41     * <p>
42     * Constructor. Creates a new {@link MouseButtonInteraction}
43     * </p>
44     *
45     * @param button
46     *            the button associated with the interaction
47     */
48    public MouseButtonInteraction(Button button) {
49        this.button = button;
50    }
51
52    /**
53     * <p>
54     * Returns the button associated with the interaction.
55     * </p>
56     *
57     * @return the button
58     */
59    public Button getButton() {
60        return button;
61    }
62
63    /*
64     * (non-Javadoc)
65     *
66     * @see java.lang.Object#equals(java.lang.Object)
67     */
68    @Override
69    public boolean equals(Object obj) {
70        if (obj instanceof MouseButtonInteraction) {
71            return getButton().equals(((MouseButtonInteraction) obj).getButton());
72        }
73        return false;
74    }
75
76    /*
77     * (non-Javadoc)
78     *
79     * @see java.lang.Object#hashCode()
80     */
81    @Override
82    public int hashCode() {
83        return getButton().hashCode();
84    }
85}
Note: See TracBrowser for help on using the repository browser.