Package org.sikuli.script
Class ObserverCallBack
- java.lang.Object
-
- org.sikuli.script.ObserverCallBack
-
- All Implemented Interfaces:
java.util.EventListener
public class ObserverCallBack extends java.lang.Object implements java.util.EventListener
Use this class to implement callbacks for
the Region observers onAppear, onVanish and onChange.
by overriding the respective methodsappeared(ObserveEvent)
,vanished(ObserveEvent)
,changed(ObserveEvent)
see:Region.onAppear(Object, Object)
,Region.onVanish(Object, Object)
,Region.onChange(Object)
}
and the handling of FindFailed and ImageMissing by overridingfindfailed(ObserveEvent)
ormissing(ObserveEvent)
see:Element.setFindFailedHandler(Object)
,Element.setImageMissingHandler(Object)
// example (called when image appears): aRegion.onAppear(anImageOrPattern, new ObserverCallBack() { appeared(ObserveEvent e) { // do something } } );
seeObserveEvent
about the features available in the callback function
-
-
Constructor Summary
Constructors Constructor Description ObserverCallBack()
setup a callback to be used on the Java API levelObserverCallBack(java.lang.Object callback, ObserveEvent.Type obsType)
INTERNAL: callbacks from Jython or JRuby
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appeared(ObserveEvent event)
to be overwritten to handle appear eventsvoid
changed(ObserveEvent event)
to be overwritten to handle changed eventsvoid
findfailed(ObserveEvent event)
to be overwritten to handle FindFailed eventsObserveEvent.Type
getType()
INTERNAL USEvoid
happened(ObserveEvent event)
to be overwritten to handle generic eventsvoid
missing(ObserveEvent event)
to be overwritten to handle image missing eventsvoid
setType(ObserveEvent.Type givenType)
INTERNAL USEvoid
vanished(ObserveEvent event)
to be overwritten to handle vanish events
-
-
-
Constructor Detail
-
ObserverCallBack
public ObserverCallBack()
setup a callback to be used on the Java API level// example (called when image appears): aRegion.onAppear(anImageOrPattern, new ObserverCallBack() { appeared(ObserveEvent e) { // do something } } );
-
ObserverCallBack
public ObserverCallBack(java.lang.Object callback, ObserveEvent.Type obsType)
INTERNAL: callbacks from Jython or JRuby- Parameters:
callback
- funtion to callobsType
- observer type
-
-
Method Detail
-
setType
public void setType(ObserveEvent.Type givenType)
INTERNAL USE- Parameters:
givenType
- observer type
-
getType
public ObserveEvent.Type getType()
INTERNAL USE- Returns:
- observer type
-
appeared
public void appeared(ObserveEvent event)
to be overwritten to handle appear events- Parameters:
event
- that happened
-
vanished
public void vanished(ObserveEvent event)
to be overwritten to handle vanish events- Parameters:
event
- that happened
-
changed
public void changed(ObserveEvent event)
to be overwritten to handle changed events- Parameters:
event
- that happened
-
findfailed
public void findfailed(ObserveEvent event)
to be overwritten to handle FindFailed events- Parameters:
event
- that happened
-
missing
public void missing(ObserveEvent event)
to be overwritten to handle image missing events- Parameters:
event
- that happened
-
happened
public void happened(ObserveEvent event)
to be overwritten to handle generic events- Parameters:
event
- that happened
-
-