[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 | * (non-Javadoc)
|
---|
| 72 | *
|
---|
| 73 | * @see de.ugoe.cs.tasktree.userinteraction.Interaction#startsLogicalSequence()
|
---|
| 74 | */
|
---|
| 75 | @Override
|
---|
| 76 | public boolean startsLogicalSequence() {
|
---|
| 77 | return false;
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | /*
|
---|
| 81 | * (non-Javadoc)
|
---|
| 82 | *
|
---|
| 83 | * @see de.ugoe.cs.tasktree.userinteraction.Interaction#finishesLogicalSequence()
|
---|
| 84 | */
|
---|
| 85 | @Override
|
---|
| 86 | public boolean finishesLogicalSequence() {
|
---|
| 87 | return false;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | /**
|
---|
| 91 | * @return the position
|
---|
| 92 | */
|
---|
[1120] | 93 | public int getXPosition() {
|
---|
[948] | 94 | return x;
|
---|
| 95 | }
|
---|
| 96 |
|
---|
| 97 | /**
|
---|
| 98 | * @return the y position
|
---|
| 99 | */
|
---|
[1120] | 100 | public int getYPosition() {
|
---|
[948] | 101 | return y;
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | /*
|
---|
| 105 | * (non-Javadoc)
|
---|
| 106 | *
|
---|
| 107 | * @see java.lang.Object#toString()
|
---|
| 108 | */
|
---|
| 109 | @Override
|
---|
| 110 | public String toString() {
|
---|
| 111 | return "scroll(" + x + "," + y + ")";
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | /*
|
---|
| 115 | * (non-Javadoc)
|
---|
| 116 | *
|
---|
| 117 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
| 118 | */
|
---|
| 119 | @Override
|
---|
| 120 | public boolean equals(Object obj) {
|
---|
| 121 | if (obj instanceof Scroll) {
|
---|
| 122 | return (((Scroll) obj).x == x) && (((Scroll) obj).y == y);
|
---|
| 123 | }
|
---|
| 124 | return false;
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | /*
|
---|
| 128 | * (non-Javadoc)
|
---|
| 129 | *
|
---|
| 130 | * @see java.lang.Object#hashCode()
|
---|
| 131 | */
|
---|
| 132 | @Override
|
---|
| 133 | public int hashCode() {
|
---|
| 134 | return getClass().hashCode();
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | }
|
---|