[948] | 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 |
|
---|
| 15 | package de.ugoe.cs.autoquest.eventcore.gui;
|
---|
| 16 |
|
---|
| 17 | /**
|
---|
| 18 | * <p>
|
---|
| 19 | * Event type for scrolling. The target of the respective event was scrolled.
|
---|
| 20 | * </p>
|
---|
| 21 | *
|
---|
| 22 | * @version 1.0
|
---|
| 23 | * @author Patrick Harms
|
---|
| 24 | */
|
---|
| 25 | public class Scroll implements IInteraction {
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * <p>
|
---|
| 29 | * Id for object serialization.
|
---|
| 30 | * </p>
|
---|
| 31 | */
|
---|
| 32 | private static final long serialVersionUID = 1L;
|
---|
| 33 |
|
---|
| 34 | /**
|
---|
| 35 | * <p>
|
---|
| 36 | * the x position to which was scrolled
|
---|
| 37 | * </p>
|
---|
| 38 | */
|
---|
| 39 | private int x;
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | * <p>
|
---|
| 43 | * the y position to which was scrolled
|
---|
| 44 | * </p>
|
---|
| 45 | */
|
---|
| 46 | private int y;
|
---|
| 47 |
|
---|
| 48 | /**
|
---|
| 49 | * <p>
|
---|
| 50 | * initializes a scrolling with the position the user scrolled to
|
---|
| 51 | * <p>
|
---|
| 52 | *
|
---|
| 53 | * @param x the position on the x axis to which the user scrolled
|
---|
| 54 | * @param y the position on the y axis to which the user scrolled
|
---|
| 55 | */
|
---|
| 56 | public Scroll(int x, int y) {
|
---|
| 57 | this.x = x;
|
---|
| 58 | this.y = y;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | /*
|
---|
| 62 | * (non-Javadoc)
|
---|
| 63 | *
|
---|
| 64 | * @see de.harms.attef.userinteraction.Interaction#getName()
|
---|
| 65 | */
|
---|
| 66 | public String getName() {
|
---|
| 67 | return "Scroll";
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | /**
|
---|
| 71 | * @return the position
|
---|
| 72 | */
|
---|
[1120] | 73 | public int getXPosition() {
|
---|
[948] | 74 | return x;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | /**
|
---|
| 78 | * @return the y position
|
---|
| 79 | */
|
---|
[1120] | 80 | public int getYPosition() {
|
---|
[948] | 81 | return y;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | * (non-Javadoc)
|
---|
| 86 | *
|
---|
| 87 | * @see java.lang.Object#toString()
|
---|
| 88 | */
|
---|
| 89 | @Override
|
---|
| 90 | public String toString() {
|
---|
| 91 | return "scroll(" + x + "," + y + ")";
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | /*
|
---|
| 95 | * (non-Javadoc)
|
---|
| 96 | *
|
---|
| 97 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
| 98 | */
|
---|
| 99 | @Override
|
---|
| 100 | public boolean equals(Object obj) {
|
---|
| 101 | if (obj instanceof Scroll) {
|
---|
| 102 | return (((Scroll) obj).x == x) && (((Scroll) obj).y == y);
|
---|
| 103 | }
|
---|
| 104 | return false;
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | /*
|
---|
| 108 | * (non-Javadoc)
|
---|
| 109 | *
|
---|
| 110 | * @see java.lang.Object#hashCode()
|
---|
| 111 | */
|
---|
| 112 | @Override
|
---|
| 113 | public int hashCode() {
|
---|
| 114 | return getClass().hashCode();
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | }
|
---|