[927] | 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.
|
---|
[831] | 14 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.eventcore.guimodel;
|
---|
[545] | 16 |
|
---|
[922] | 17 | import de.ugoe.cs.autoquest.eventcore.IEventTarget;
|
---|
[545] | 18 |
|
---|
| 19 | /**
|
---|
[595] | 20 | * <p>
|
---|
[831] | 21 | * Common interface for all GUI elements.
|
---|
[595] | 22 | * </p>
|
---|
[545] | 23 | *
|
---|
[831] | 24 | * @version 1.0
|
---|
| 25 | * @author Patrick Harms
|
---|
[545] | 26 | */
|
---|
| 27 | public interface IGUIElement extends IEventTarget {
|
---|
[1051] | 28 |
|
---|
[545] | 29 | /**
|
---|
[595] | 30 | * <p>
|
---|
[831] | 31 | * Returns the specification of the GUI element.
|
---|
[595] | 32 | * </p>
|
---|
[831] | 33 | *
|
---|
| 34 | * @return the specification
|
---|
[545] | 35 | */
|
---|
[576] | 36 | public IGUIElementSpec getSpecification();
|
---|
[545] | 37 |
|
---|
| 38 | /**
|
---|
[595] | 39 | * <p>
|
---|
[831] | 40 | * Returns the parent of the GUI element.
|
---|
[595] | 41 | * </p>
|
---|
[831] | 42 | *
|
---|
| 43 | * @return the parent
|
---|
[603] | 44 | */
|
---|
| 45 | public IGUIElement getParent();
|
---|
| 46 |
|
---|
| 47 | /**
|
---|
| 48 | * <p>
|
---|
[1876] | 49 | * Returns the view of the GUI to which this GUI element belongs.
|
---|
| 50 | * </p>
|
---|
| 51 | *
|
---|
| 52 | * @return the parent
|
---|
| 53 | */
|
---|
| 54 | public IGUIView getView();
|
---|
| 55 |
|
---|
| 56 | /**
|
---|
| 57 | * <p>
|
---|
[1433] | 58 | * returns the GUI model to which this GUI element belongs
|
---|
| 59 | * </p>
|
---|
| 60 | */
|
---|
| 61 | public GUIModel getGUIModel();
|
---|
| 62 |
|
---|
| 63 | /**
|
---|
| 64 | * <p>
|
---|
[1051] | 65 | * returns true, if a usage of this GUI element in a trace was observed
|
---|
| 66 | * </p>
|
---|
| 67 | *
|
---|
| 68 | * @return as described
|
---|
| 69 | */
|
---|
| 70 | public boolean isUsed();
|
---|
| 71 |
|
---|
| 72 | /**
|
---|
| 73 | * <p>
|
---|
| 74 | * Marks a GUI element as used.
|
---|
| 75 | * </p>
|
---|
| 76 | */
|
---|
| 77 | public void markUsed();
|
---|
| 78 |
|
---|
| 79 | /**
|
---|
| 80 | * <p>
|
---|
[831] | 81 | * Defines that {@link IGUIElement} implementations have to define equals.
|
---|
[603] | 82 | * </p>
|
---|
[831] | 83 | *
|
---|
| 84 | * @see Object#equals(Object)
|
---|
[545] | 85 | */
|
---|
[831] | 86 | @Override
|
---|
[603] | 87 | public boolean equals(Object other);
|
---|
[545] | 88 |
|
---|
[576] | 89 | /**
|
---|
[595] | 90 | * <p>
|
---|
[831] | 91 | * Defines that {@link IGUIElement} implementations have to define hashCode.
|
---|
[595] | 92 | * </p>
|
---|
[831] | 93 | *
|
---|
| 94 | * @see Object#hashCode()
|
---|
[576] | 95 | */
|
---|
[831] | 96 | @Override
|
---|
[576] | 97 | public int hashCode();
|
---|
[589] | 98 |
|
---|
[595] | 99 | /**
|
---|
| 100 | * <p>
|
---|
[831] | 101 | * Updates the specification of a GUI element with another specification, e.g., to add further
|
---|
| 102 | * known names of the GUI element.
|
---|
[595] | 103 | * </p>
|
---|
[831] | 104 | *
|
---|
| 105 | * @param furtherSpec
|
---|
| 106 | * additional specification
|
---|
[595] | 107 | */
|
---|
| 108 | public void updateSpecification(IGUIElementSpec furtherSpec);
|
---|
[613] | 109 |
|
---|
| 110 | /**
|
---|
| 111 | * <p>
|
---|
[831] | 112 | * The {@link IGUIElement} that is passed by this function is equal to the current GUI element
|
---|
| 113 | * and will hereafter be treated as such.
|
---|
[613] | 114 | * </p>
|
---|
[831] | 115 | *
|
---|
[613] | 116 | * @param guiElement
|
---|
[831] | 117 | * GUI element that is equal
|
---|
[613] | 118 | */
|
---|
| 119 | public void addEqualGUIElement(IGUIElement equalElement);
|
---|
[1490] | 120 |
|
---|
| 121 | /**
|
---|
| 122 | * <p>
|
---|
| 123 | * Returns a measure for the distance of this {@link IGUIElement} to the provided one. Distance
|
---|
| 124 | * means a measure for the distance in display of the rendered GUI. The returned values must be
|
---|
| 125 | * between 0.0 and 1.0 inclusive. 0.0 means no distance, e.g., if the distance to itself shall be
|
---|
| 126 | * returned. 1.0 means the highest distance possible. Two GUI elements that are not visible
|
---|
| 127 | * at the same time independent of the screen resolution (e.g., because they resist in separate
|
---|
| 128 | * views) must have a distance of at least 0.5.
|
---|
| 129 | * </p>
|
---|
| 130 | *
|
---|
| 131 | * @param guiElement
|
---|
| 132 | * the GUI element to measure the distance for
|
---|
| 133 | */
|
---|
| 134 | public double getDistanceTo(IGUIElement otherElement);
|
---|
[545] | 135 | }
|
---|