< prev index next >

core/JemmyCore/src/org/jemmy/lookup/AbstractLookup.java

Print this page

        

*** 39,49 **** /** * Default implementation of Lookup. Regularly, it is enough just override this * implementation and allow it to handle sub-lookups creation. * @see AbstractLookup#lookup(org.jemmy.lookup.LookupCriteria) * @see AbstractLookup#lookup(java.lang.Class, org.jemmy.lookup.LookupCriteria) ! * @param <CONTROL> * @author shura */ public abstract class AbstractLookup<CONTROL> extends AbstractParent<CONTROL> implements Lookup<CONTROL> { static final String PREFIX_DELTA = "| "; --- 39,49 ---- /** * Default implementation of Lookup. Regularly, it is enough just override this * implementation and allow it to handle sub-lookups creation. * @see AbstractLookup#lookup(org.jemmy.lookup.LookupCriteria) * @see AbstractLookup#lookup(java.lang.Class, org.jemmy.lookup.LookupCriteria) ! * @param <CONTROL> todo document * @author shura */ public abstract class AbstractLookup<CONTROL> extends AbstractParent<CONTROL> implements Lookup<CONTROL> { static final String PREFIX_DELTA = "| ";
*** 69,82 **** /** * This actual lookup logic is delegated to <code>getCildren(java.lang.Object)</code> * method * @see AbstractLookup#getChildren(java.lang.Object) ! * @param env ! * @param controlClass ! * @param criteria ! * @param wrapper */ public AbstractLookup(Environment env, Class<CONTROL> controlClass, LookupCriteria<CONTROL> criteria, Wrapper wrapper) { this.env = env; found = new ArrayList<CONTROL>(); this.clss = controlClass; --- 69,82 ---- /** * This actual lookup logic is delegated to <code>getCildren(java.lang.Object)</code> * method * @see AbstractLookup#getChildren(java.lang.Object) ! * @param env todo document ! * @param controlClass todo document ! * @param criteria todo document ! * @param wrapper todo document */ public AbstractLookup(Environment env, Class<CONTROL> controlClass, LookupCriteria<CONTROL> criteria, Wrapper wrapper) { this.env = env; found = new ArrayList<CONTROL>(); this.clss = controlClass;
*** 86,113 **** Wrapper getWrapper() { return wrapper; } - /** - * - * @return - */ LookupCriteria<CONTROL> getCriteria() { return criteria; } - /** - * - * @return - */ Environment getEnvironment() { return env; } /** - * * @return The class of the sount controls. */ Class<CONTROL> getControlClass() { return clss; } --- 86,104 ----
*** 121,131 **** } /** * Waits for certain number of controls to fit criteria. * Depending on how outputs set, prints out info about the lookup. ! * @param count * @return this, after the count of found number of found controls * exceeds the required. * @see AbstractLookup#OUTPUT */ public Lookup<? extends CONTROL> wait(final int count) { --- 112,122 ---- } /** * Waits for certain number of controls to fit criteria. * Depending on how outputs set, prints out info about the lookup. ! * @param count todo document * @return this, after the count of found number of found controls * exceeds the required. * @see AbstractLookup#OUTPUT */ public Lookup<? extends CONTROL> wait(final int count) {
*** 150,170 **** /** * Gets the number of controls which fit criteria. * Depending on how outputs set, prints out info about the lookup. * @see AbstractLookup#OUTPUT ! * @return */ public int size() { getEnvironment().getOutput(OUTPUT).println("Getting number of controls of " + clss.getName() + " class fitting criteria " + criteria); refresh(); return found.size(); } - /** - * - */ void refresh() { found.clear(); List childen = getChildren(null); if (childen != null) { for (Object c : childen) { --- 141,158 ---- /** * Gets the number of controls which fit criteria. * Depending on how outputs set, prints out info about the lookup. * @see AbstractLookup#OUTPUT ! * @return todo document */ public int size() { getEnvironment().getOutput(OUTPUT).println("Getting number of controls of " + clss.getName() + " class fitting criteria " + criteria); refresh(); return found.size(); } void refresh() { found.clear(); List childen = getChildren(null); if (childen != null) { for (Object c : childen) {
*** 186,244 **** } } } } - /** - * - * @param control - * @return - */ protected boolean check(CONTROL control) { return control != null && criteria.check(control); } /** * Returns Wrap of the control with specified index ! * @param index * @return Wrap */ public Wrap<? extends CONTROL> wrap(int index) { return instantiate(get(index)); } - /** - * - * @return - */ public Wrap<? extends CONTROL> wrap() { return wrap(0); } /** ! * @{inheritDoc} */ public <INTERFACE extends ControlInterface> INTERFACE as(int index, Class<INTERFACE> interfaceClass) { return wrap(index).as(interfaceClass); } /** ! * @{inheritDoc} */ public <INTERFACE extends ControlInterface> INTERFACE as(Class<INTERFACE> interfaceClass) { return as(0, interfaceClass); } /** ! * @{inheritDoc} */ public <TYPE, INTERFACE extends TypeControlInterface<TYPE>> INTERFACE as(int index, Class<INTERFACE> interfaceClass, Class<TYPE> type) { return wrap(index).as(interfaceClass, type); } /** ! * @{inheritDoc} */ public <TYPE, INTERFACE extends TypeControlInterface<TYPE>> INTERFACE as(Class<INTERFACE> interfaceClass, Class<TYPE> type) { return as(0, interfaceClass, type); } --- 174,223 ---- } } } } protected boolean check(CONTROL control) { return control != null && criteria.check(control); } /** * Returns Wrap of the control with specified index ! * @param index todo document * @return Wrap */ public Wrap<? extends CONTROL> wrap(int index) { return instantiate(get(index)); } public Wrap<? extends CONTROL> wrap() { return wrap(0); } /** ! * {@inheritDoc} */ public <INTERFACE extends ControlInterface> INTERFACE as(int index, Class<INTERFACE> interfaceClass) { return wrap(index).as(interfaceClass); } /** ! * {@inheritDoc} */ public <INTERFACE extends ControlInterface> INTERFACE as(Class<INTERFACE> interfaceClass) { return as(0, interfaceClass); } /** ! * {@inheritDoc} */ public <TYPE, INTERFACE extends TypeControlInterface<TYPE>> INTERFACE as(int index, Class<INTERFACE> interfaceClass, Class<TYPE> type) { return wrap(index).as(interfaceClass, type); } /** ! * {@inheritDoc} */ public <TYPE, INTERFACE extends TypeControlInterface<TYPE>> INTERFACE as(Class<INTERFACE> interfaceClass, Class<TYPE> type) { return as(0, interfaceClass, type); }
*** 246,283 **** wait(index + 1); return found.get(index); } /** ! * @{inheritDoc} */ public CONTROL get() { return get(0); } - /** - * - * @return - */ List<CONTROL> getFound() { return found; } - /** - * - * @return - */ public Class<CONTROL> getType() { return getControlClass(); } /** * Override this to get subchildren of the controls in the hierarchy. * List could contain any type of objects - not just <code>CONTROL</code>. * @param subParent - one of the elements in the hierarchy reflected by this lookup. * If null passed - first level children are expected. ! * @return */ abstract List getChildren(Object subParent); private String buildClassChain(Class cls) { StringBuilder sb = new StringBuilder(cls.getName()); --- 225,254 ---- wait(index + 1); return found.get(index); } /** ! * {@inheritDoc} */ public CONTROL get() { return get(0); } List<CONTROL> getFound() { return found; } public Class<CONTROL> getType() { return getControlClass(); } /** * Override this to get subchildren of the controls in the hierarchy. * List could contain any type of objects - not just <code>CONTROL</code>. * @param subParent - one of the elements in the hierarchy reflected by this lookup. * If null passed - first level children are expected. ! * @return todo document */ abstract List getChildren(Object subParent); private String buildClassChain(Class cls) { StringBuilder sb = new StringBuilder(cls.getName());
*** 293,315 **** } /** * Wraps the control with a <code>Wrap</code> class. * @see Wrap ! * @param wrap * @return Wrap */ private Wrap<? extends CONTROL> instantiate(CONTROL control) { return wrapper.wrap(clss, control); } - /** - * - * @param out - * @param obj - * @param prefix - */ protected void dumpOne(PrintStream out, CONTROL obj, String prefix) { Map<String, Object> data = getWrapper().wrap(getControlClass(), getControlClass().cast(obj)).getPropertiesQiuet(); out.println(prefix + "+-" + buildClassChain(obj.getClass())); for (String key : data.keySet()) { out.print(prefix + PREFIX_DELTA + " " + key + "="); --- 264,280 ---- } /** * Wraps the control with a <code>Wrap</code> class. * @see Wrap ! * @param control todo document * @return Wrap */ private Wrap<? extends CONTROL> instantiate(CONTROL control) { return wrapper.wrap(clss, control); } protected void dumpOne(PrintStream out, CONTROL obj, String prefix) { Map<String, Object> data = getWrapper().wrap(getControlClass(), getControlClass().cast(obj)).getPropertiesQiuet(); out.println(prefix + "+-" + buildClassChain(obj.getClass())); for (String key : data.keySet()) { out.print(prefix + PREFIX_DELTA + " " + key + "=");
*** 319,333 **** out.println(data.get(key)); } } } - /** - * - * @param out - * @param lookup - */ protected abstract void dump(PrintStream out, Lookup<? extends CONTROL> lookup); public void dump(PrintStream out) { dump(out, this); } --- 284,293 ----
< prev index next >