[1040] | 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.
|
---|
[1030] | 14 |
|
---|
| 15 | package de.ugoe.cs.autoquest.usability.testutil;
|
---|
| 16 |
|
---|
| 17 | import java.util.logging.Level;
|
---|
| 18 |
|
---|
| 19 | import de.ugoe.cs.autoquest.commands.sequences.CMDcondenseGuiModel;
|
---|
| 20 | import de.ugoe.cs.autoquest.commands.sequences.CMDcondenseMouseClicks;
|
---|
| 21 | import de.ugoe.cs.autoquest.commands.sequences.CMDcorrectKeyInteractionTargets;
|
---|
| 22 | import de.ugoe.cs.autoquest.commands.sequences.CMDdetectTextInputEvents;
|
---|
| 23 | import de.ugoe.cs.autoquest.commands.sequences.CMDsortKeyInteractions;
|
---|
| 24 | import de.ugoe.cs.autoquest.commands.usability.CMDgenerateTaskTree;
|
---|
| 25 | import de.ugoe.cs.autoquest.plugin.jfc.commands.CMDparseJFC;
|
---|
| 26 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
|
---|
| 27 | import de.ugoe.cs.autoquest.test.CommandRunner;
|
---|
| 28 | import de.ugoe.cs.util.console.Console;
|
---|
| 29 | import de.ugoe.cs.util.console.GlobalDataContainer;
|
---|
| 30 | import de.ugoe.cs.util.console.TextConsole;
|
---|
| 31 |
|
---|
[1040] | 32 | /**
|
---|
| 33 | * <p>
|
---|
| 34 | * TODO comment
|
---|
| 35 | * </p>
|
---|
| 36 | *
|
---|
| 37 | * @author Alexander Deicke
|
---|
| 38 | */
|
---|
[1030] | 39 | public class GenerateTaskTreeUtil {
|
---|
[1040] | 40 |
|
---|
[1030] | 41 | private static final String seqName = "sequences";
|
---|
| 42 |
|
---|
| 43 | private static final String taskTreeName = "taskTree";
|
---|
| 44 |
|
---|
| 45 | public static ITaskTree getTaskTreeFromFile(String filename) {
|
---|
| 46 | new TextConsole(Level.FINEST);
|
---|
| 47 | parseTraceFile(filename);
|
---|
| 48 | condenseGuiModel();
|
---|
| 49 | sortKeyInteractions();
|
---|
| 50 | correctKeyInteractionTargets();
|
---|
| 51 | detectTextInputEvents();
|
---|
| 52 | condenseMouseClicks();
|
---|
| 53 | return generateTaskTree();
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | static private void parseTraceFile(String filetoparse) {
|
---|
| 57 | Console.println("parsing trace file");
|
---|
| 58 | CommandRunner.runCommand(CMDparseJFC.class, ClassLoader.getSystemResource(filetoparse)
|
---|
| 59 | .getFile(), seqName);
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | private static void condenseGuiModel() {
|
---|
| 63 | Console.println("condensing GUI model");
|
---|
| 64 | CommandRunner.runCommand(CMDcondenseGuiModel.class, seqName);
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | private static void sortKeyInteractions() {
|
---|
| 68 | Console.println("sorting key interactions");
|
---|
| 69 | CommandRunner.runCommand(CMDsortKeyInteractions.class, seqName);
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | private static void correctKeyInteractionTargets() {
|
---|
| 73 | Console.println("correcting key interaction targets");
|
---|
| 74 | CommandRunner.runCommand(CMDcorrectKeyInteractionTargets.class, seqName);
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | private static void detectTextInputEvents() {
|
---|
| 78 | Console.println("detecting text input events");
|
---|
| 79 | CommandRunner.runCommand(CMDdetectTextInputEvents.class, seqName);
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | private static void condenseMouseClicks() {
|
---|
| 83 | Console.println("condensing mouse click events");
|
---|
| 84 | CommandRunner.runCommand(CMDcondenseMouseClicks.class, seqName);
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | private static ITaskTree generateTaskTree() {
|
---|
| 88 | CommandRunner.runCommand(CMDgenerateTaskTree.class, seqName, taskTreeName);
|
---|
| 89 | GlobalDataContainer dataContainer = GlobalDataContainer.getInstance();
|
---|
| 90 | return (ITaskTree) dataContainer.getData(taskTreeName);
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | }
|
---|