[927] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
| 2 | //
|
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 4 | // you may not use this file except in compliance with the License.
|
---|
| 5 | // You may obtain a copy of the License at
|
---|
| 6 | //
|
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 8 | //
|
---|
| 9 | // Unless required by applicable law or agreed to in writing, software
|
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 12 | // See the License for the specific language governing permissions and
|
---|
| 13 | // limitations under the License.
|
---|
| 14 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.eventcore.gui;
|
---|
[544] | 16 |
|
---|
[922] | 17 | import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey;
|
---|
[544] | 18 |
|
---|
| 19 | /**
|
---|
[786] | 20 | * <p>
|
---|
| 21 | * Event type for releasing a key.
|
---|
| 22 | * </p>
|
---|
[544] | 23 | *
|
---|
[786] | 24 | * @version 1.0
|
---|
| 25 | * @author Steffen Herbold
|
---|
[544] | 26 | */
|
---|
| 27 | public class KeyReleased extends KeyInteraction {
|
---|
| 28 |
|
---|
[786] | 29 | /**
|
---|
| 30 | * <p>
|
---|
| 31 | * Id for object serialization.
|
---|
| 32 | * </p>
|
---|
| 33 | */
|
---|
[544] | 34 | private static final long serialVersionUID = 1L;
|
---|
| 35 |
|
---|
| 36 | /**
|
---|
[786] | 37 | * <p>
|
---|
| 38 | * Constructor. Creates a new {@link KeyReleased} event type.
|
---|
| 39 | * </p>
|
---|
| 40 | *
|
---|
| 41 | * @see KeyInteraction#KeyInteraction(VirtualKey)
|
---|
[544] | 42 | */
|
---|
| 43 | public KeyReleased(VirtualKey key) {
|
---|
| 44 | super(key);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | /*
|
---|
| 48 | * (non-Javadoc)
|
---|
| 49 | *
|
---|
| 50 | * @see de.harms.attef.userinteraction.Interaction#getName()
|
---|
| 51 | */
|
---|
| 52 | public String getName() {
|
---|
| 53 | return "KeyReleased " + super.getKey();
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | /*
|
---|
| 57 | * (non-Javadoc)
|
---|
| 58 | *
|
---|
| 59 | * @see java.lang.Object#toString()
|
---|
| 60 | */
|
---|
| 61 | @Override
|
---|
| 62 | public String toString() {
|
---|
[1359] | 63 | return "key \u21D1 " + super.getKey();
|
---|
[544] | 64 | }
|
---|
| 65 |
|
---|
| 66 | /*
|
---|
| 67 | * (non-Javadoc)
|
---|
| 68 | *
|
---|
| 69 | * @see de.harms.attef.userinteraction.Interaction#startsLogicalSequence()
|
---|
| 70 | */
|
---|
| 71 | public boolean startsLogicalSequence() {
|
---|
| 72 | return false;
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | /*
|
---|
| 76 | * (non-Javadoc)
|
---|
| 77 | *
|
---|
| 78 | * @see de.harms.attef.userinteraction.Interaction#finishesLogicalSequence()
|
---|
| 79 | */
|
---|
| 80 | public boolean finishesLogicalSequence() {
|
---|
| 81 | // TODO handle lock keys correctly
|
---|
| 82 | return super.getKey().isCombinationKey();
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | /*
|
---|
| 86 | * (non-Javadoc)
|
---|
| 87 | *
|
---|
| 88 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
| 89 | */
|
---|
| 90 | @Override
|
---|
| 91 | public boolean equals(Object other) {
|
---|
| 92 | if (other instanceof KeyReleased) {
|
---|
| 93 | return (super.getKey() == ((KeyReleased) other).getKey());
|
---|
| 94 | }
|
---|
| 95 | else {
|
---|
| 96 | return false;
|
---|
| 97 | }
|
---|
| 98 | }
|
---|
| 99 |
|
---|
[564] | 100 | /* (non-Javadoc)
|
---|
| 101 | * @see java.lang.Object#hashCode()
|
---|
| 102 | */
|
---|
| 103 | @Override
|
---|
| 104 | public int hashCode() {
|
---|
| 105 | return super.getKey().hashCode();
|
---|
| 106 | }
|
---|
| 107 |
|
---|
[544] | 108 | }
|
---|