@Target(value=FIELD) @Retention(value=RUNTIME) public @interface Locator
The annotation is designed to assign window locators to the fields. When the containing class is initialized these fields are initialized automatically with the locator specified by the annotation.
Example:
public class Test1LevelWindow extends MainWindow { @Locator(winClass="Edit",caption="Sample text",index=0) public Edit edtText; @Locator(winClass="Button",caption="Test Button",index=2) public Button btnTestButton; public Test1LevelWindow(Win32Client client) { super(client, new Win32Locator("Test",0)); } }After that we may initialize just main window object like:
Win32Client client = new Win32Client(); Test1LevelWindow win = new Test1LevelWindow(client);and then the edtText and btnTestButton fields will be initialized.
NOTE: the initialization is limited to object instances creation and locator value assignments. So, these objects wouldn't contain any HWND information. It's done this way because actual window objects may be unavailable at the time of the initialization. So, these elements would be filled with actual HWNDs as soon as we start using them first.
Copyright © 2013. All rights reserved.