// Copyright 2012 Georg-August-Universität Göttingen, Germany // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package de.ugoe.cs.autoquest.eventcore.guimodel; import de.ugoe.cs.autoquest.eventcore.IEventTarget; /** *

* Common interface for all GUI elements. *

* * @version 1.0 * @author Patrick Harms */ public interface IGUIElement extends IEventTarget { /** *

* Returns the specification of the GUI element. *

* * @return the specification */ public IGUIElementSpec getSpecification(); /** *

* Returns the parent of the GUI element. *

* * @return the parent */ public IGUIElement getParent(); /** *

* returns the GUI model to which this GUI element belongs *

*/ public GUIModel getGUIModel(); /** *

* returns true, if a usage of this GUI element in a trace was observed *

* * @return as described */ public boolean isUsed(); /** *

* Marks a GUI element as used. *

*/ public void markUsed(); /** *

* Defines that {@link IGUIElement} implementations have to define equals. *

* * @see Object#equals(Object) */ @Override public boolean equals(Object other); /** *

* Defines that {@link IGUIElement} implementations have to define hashCode. *

* * @see Object#hashCode() */ @Override public int hashCode(); /** *

* Updates the specification of a GUI element with another specification, e.g., to add further * known names of the GUI element. *

* * @param furtherSpec * additional specification */ public void updateSpecification(IGUIElementSpec furtherSpec); /** *

* The {@link IGUIElement} that is passed by this function is equal to the current GUI element * and will hereafter be treated as such. *

* * @param guiElement * GUI element that is equal */ public void addEqualGUIElement(IGUIElement equalElement); /** *

* Returns a measure for the distance of this {@link IGUIElement} to the provided one. Distance * means a measure for the distance in display of the rendered GUI. The returned values must be * between 0.0 and 1.0 inclusive. 0.0 means no distance, e.g., if the distance to itself shall be * returned. 1.0 means the highest distance possible. Two GUI elements that are not visible * at the same time independent of the screen resolution (e.g., because they resist in separate * views) must have a distance of at least 0.5. *

* * @param guiElement * the GUI element to measure the distance for */ public double getDistanceTo(IGUIElement otherElement); }