Changeset 1069 for trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/eventcore/HTMLEventTypeFactory.java
- Timestamp:
- 02/14/13 15:20:07 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/eventcore/HTMLEventTypeFactory.java
r1059 r1069 23 23 import de.ugoe.cs.autoquest.eventcore.gui.MouseButtonInteraction; 24 24 import de.ugoe.cs.autoquest.eventcore.gui.MouseClick; 25 import de.ugoe.cs.autoquest.eventcore.gui.MouseDoubleClick; 25 26 import de.ugoe.cs.autoquest.eventcore.gui.Scroll; 26 27 import de.ugoe.cs.autoquest.eventcore.gui.TextInput; … … 76 77 77 78 if ("onscroll".equals(eventName)) { 78 int[] coordinates = getCoordinateParameter(eventName, eventParameters); 79 int[] coordinates = 80 getCoordinateParameter("scrollX", "scrollY", eventName, eventParameters); 81 79 82 result = new Scroll(coordinates[0], coordinates[1]); 80 83 } 81 84 else if ("onclick".equals(eventName)) { 82 int[] coordinates = getCoordinateParameter( eventName, eventParameters);85 int[] coordinates = getCoordinateParameter("X", "Y", eventName, eventParameters); 83 86 result = 84 87 new MouseClick(MouseButtonInteraction.Button.LEFT, coordinates[0], coordinates[1]); 88 } 89 else if ("ondblclick".equals(eventName)) { 90 int[] coordinates = getCoordinateParameter("X", "Y", eventName, eventParameters); 91 result = new MouseDoubleClick 92 (MouseButtonInteraction.Button.LEFT, coordinates[0], coordinates[1]); 85 93 } 86 94 else if ("onchange".equals(eventName)) { … … 118 126 * @return 119 127 */ 120 private int[] getCoordinateParameter(String eventName, Map<String, String> eventParameters) { 121 String xCoord = eventParameters.get("X"); 128 private int[] getCoordinateParameter(String xParamName, 129 String yParamName, 130 String eventName, 131 Map<String, String> eventParameters) 132 { 133 String xCoord = eventParameters.get(xParamName); 122 134 if (xCoord == null) { 123 throw new IllegalArgumentException("eventParameters do not contain X coordinate."); 135 throw new IllegalArgumentException 136 ("eventParameters do not contain " + xParamName + " coordinate."); 124 137 } 125 138 126 String yCoord = eventParameters.get( "Y");139 String yCoord = eventParameters.get(yParamName); 127 140 if (yCoord == null) { 128 throw new IllegalArgumentException("eventParameters do not contain Y coordinate."); 141 throw new IllegalArgumentException 142 ("eventParameters do not contain " + yParamName + " coordinate."); 129 143 } 130 144 … … 134 148 } 135 149 catch (NumberFormatException e) { 136 throw new IllegalArgumentException("the coordinates provided " + " ofan " + eventName +150 throw new IllegalArgumentException("the coordinates provided by an " + eventName + 137 151 " event are no numbers"); 138 152 }
Note: See TracChangeset
for help on using the changeset viewer.