Changeset 564 for trunk/quest-core-events
- Timestamp:
- 08/17/12 09:46:55 (12 years ago)
- Location:
- trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/InteractionEventList.java
r550 r564 7 7 package de.ugoe.cs.quest.eventcore.gui; 8 8 9 import java.io.Serializable; 9 10 import java.util.ArrayList; 10 11 import java.util.Collection; … … 19 20 * @author 2011, last modified by $Author: $ 20 21 */ 21 @SuppressWarnings("serial")22 22 public class InteractionEventList extends ArrayList<Event> implements List<Event> { 23 24 /** */ 25 private static final long serialVersionUID = 1L; 23 26 24 27 /** stores the events to be handled later in the order, they should be processed */ … … 116 119 */ 117 120 private void addEventPair(KeyEventPair eventPair) { 118 super.add(eventPair. mFirst);119 120 for (KeyEventPair child : eventPair. mChildren) {121 super.add(eventPair.first); 122 123 for (KeyEventPair child : eventPair.children) { 121 124 addEventPair(child); 122 125 } 123 126 124 super.add(eventPair. mSecond);127 super.add(eventPair.second); 125 128 } 126 129 … … 128 131 * 129 132 */ 130 private static class KeyEventPair {133 private static class KeyEventPair implements Serializable { 131 134 135 /** */ 136 private static final long serialVersionUID = 1L; 137 132 138 /** the first key interaction event */ 133 private Event mFirst;139 private Event first; 134 140 135 141 /** the second key interaction event */ 136 private Event mSecond;142 private Event second; 137 143 138 144 /** the children, this event pair may have */ 139 private List<KeyEventPair> mChildren = new ArrayList<KeyEventPair>();145 private List<KeyEventPair> children = new ArrayList<KeyEventPair>(); 140 146 141 147 /** … … 148 154 "event pair"); 149 155 } 150 mFirst = first;156 this.first = first; 151 157 } 152 158 … … 166 172 167 173 if ((event.getType() instanceof KeyReleased) && 168 (((KeyInteraction) mFirst.getType()).getKey() ==174 (((KeyInteraction) first.getType()).getKey() == 169 175 ((KeyInteraction) event.getType()).getKey()) && 170 (mSecond == null))176 (second == null)) 171 177 { 172 178 // this is the release of the represented key. Store it and notify the processing. 173 mSecond = event;179 second = event; 174 180 return true; 175 181 } 176 182 else if ((event.getType() instanceof KeyPressed) && 177 (((KeyInteraction) mFirst.getType()).getKey() ==178 ((KeyInteraction) event.getType()).getKey()) &&179 (mSecond == null))183 (((KeyInteraction) first.getType()).getKey() == 184 ((KeyInteraction) event.getType()).getKey()) && 185 (second == null)) 180 186 { 181 187 // the key was pressed before it was released again. This happens, if the key 182 188 // stays pressed for a long time. Generate a key released event but do not mark 183 189 // the new event as processed 184 mSecond = new Event190 second = new Event 185 191 (new KeyReleased(((KeyInteraction) event.getType()).getKey()), 186 mFirst.getTarget());192 first.getTarget()); 187 193 188 194 return false; 189 195 } 190 else if (((KeyInteraction) mFirst.getType()).getKey().isCombinationKey() &&191 (((KeyInteraction) mFirst.getType()).getKey() !=196 else if (((KeyInteraction) first.getType()).getKey().isCombinationKey() && 197 (((KeyInteraction) first.getType()).getKey() != 192 198 ((KeyInteraction) event.getType()).getKey())) 193 199 { … … 195 201 // doesn't work, add the event as a new child pair, if it is a new key pressed 196 202 197 for (KeyEventPair child : mChildren) {203 for (KeyEventPair child : children) { 198 204 if (child.process(event)) { 199 205 return true; … … 202 208 203 209 if (event.getType() instanceof KeyPressed) { 204 mChildren.add(new KeyEventPair(event));210 children.add(new KeyEventPair(event)); 205 211 return true; 206 212 } … … 219 225 */ 220 226 private boolean isComplete() { 221 if (( mFirst != null) && (mSecond != null)) {222 for (KeyEventPair child : mChildren) {227 if ((first != null) && (second != null)) { 228 for (KeyEventPair child : children) { 223 229 if (!child.isComplete()) { 224 230 return false; -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyPressed.java
r544 r564 80 80 } 81 81 82 /* (non-Javadoc) 83 * @see java.lang.Object#hashCode() 84 */ 85 @Override 86 public int hashCode() { 87 return super.getKey().hashCode(); 88 } 89 82 90 } -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyReleased.java
r544 r564 80 80 } 81 81 82 /* (non-Javadoc) 83 * @see java.lang.Object#hashCode() 84 */ 85 @Override 86 public int hashCode() { 87 return super.getKey().hashCode(); 88 } 89 82 90 } -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/ValueSelection.java
r550 r564 94 94 } 95 95 96 /* (non-Javadoc) 97 * @see java.lang.Object#hashCode() 98 */ 99 @Override 100 public int hashCode() { 101 return selectedValue.hashCode(); 102 } 103 96 104 } -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/guimodel/AbstractDefaultGUIElement.java
r550 r564 18 18 public static final long serialVersionUID = 1L; 19 19 20 /** the parent interaction element */21 private IGUIElement parent;22 23 20 /** the information about the original type before the mapping */ 24 21 private String originalTypeInfo; 25 26 /*27 * (non-Javadoc)28 *29 * @see GUIElement#getParent()30 */31 public IGUIElement getParent() {32 return parent;33 }34 22 35 23 /* -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/guimodel/AbstractDefaultGUIElementFactory.java
r550 r564 40 40 } 41 41 else { 42 return object2 == null; 42 // object 1 is null but object 2 not --> return false 43 return false; 43 44 } 44 45 }
Note: See TracChangeset
for help on using the changeset viewer.