--- /dev/null 2017-12-05 08:23:57.000000000 -0800 +++ new/core/JemmyCore/doc/Jemmy3Lookup.html 2017-12-05 08:23:56.000000000 -0800 @@ -0,0 +1,153 @@ + + + +
+ +The document describes principles of Jemmy lookup API. Such
+principles are the same for any extension built on JemmyCore
+for any particular component library. The idea here is to provide
+searching capabilities so that
+
Any possible criteria could be + used +
+Any number or criteria could be + used consequently +
+Access both to control instance + and a wrapper instance is provided +
+No costing needed +
+Search criteria specified by implementing LookupCriteria
+interface. There are several implementations of the criteria in
+JemmyCore
which are abstract.
+
Example: +
+public class ByTextSearch<T extends JTextComponent> implements LookupCriteria<T> { + String text; + public ByTextSearch(String text) { + this.text = text; + } + public boolean check(T control) { + return control.getText().equals(text); + } + } +
+Naturally, any kind of custom search criteria could be specified my +creating an implementation if the interface. +
+Parent
interface represents the start point for a component
+lookup. Parent could be a
root of control hierarchy (Stage
or Scene
in JavaFX)
A container in the middle (such as Frame
in AWT)
from the lookup perspective, parent only is able to get an access
+to a Lookup
imstance.
The search capabilities are presented by Lookup
+interface. Most importantly the interface defines methods to narrow
+the search with another search criteria and optionally control type,
+which (the methods) return an instance on the same interface. That
+allows to implement any number of search criteria.
+
Example: +
+button = ... .wrap(0); + frame.lookup(CoordinateLookup.leftOf(button)). + lookup(JTextField.class, new Any<JTextField>()). + ...; +
+Besides that, the interface defines methods to get the control, to +wrap it, to get the number of controls found, etc. . +
+This is an internal yet very important class. It implements +creating the sub-lookups. This particular implementation does it in a +way that the actual component hierarchy is not requested up until the +moment it has to be. It's only when there is a question on the actual +control list is asked, the hierarchy is explored. +
+Example. This does not query the AWT hierarchy: +
+import org.jemmy.awt.FrameOperator; + ... + FrameOperator frame = ... + Lookup<JTextField> lookup = frame.lookup(JTextField.class, new TrueLookup<JTextField>()); +
+These do: +
+lookup.get(0); + lookup.wrap(0); + lookup.size(); + lookup.wait(2); +
+AbstractLookup
does not implement the functionality of
+getting the control list, which is implemented by next two classes:
+
As it is clear from the names, these classes provide logic to deal
+with hierarchical control structure and plain control list,
+correspondentelly. Doing so, the implementation rely on two other
+interfaces which specific to the component library: ControlHierarchy
+and ControlLookup
.
+
Two methods get(int)
and wrap(int)
return
+the control itself and the wrapper of it. The type of the returned
+control is the CONTROL
type parameter of Lookup<CONTROL>
+interface. Wrap type is Wrap<CONTROL>
, hence
+there is no need to cast the results to get the control itself. There
+is no need to cast the wrapper either, but this is described in a
+separate document: Jemmy control interfaces
+