|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.livescribe.penlet.PenletContext
public abstract class PenletContext
PenletContext exposes services to the pen application. The
context is made available as part of the penlet initialization (
Penlet.initApp()).
The context allows applications to dynamically add/remove listeners to monitor events. If the application tries to add the same listener twice (or more), the latter call will not add the listener. On the same note if the application removes a registered listener twice (or more), the latter call to remove will be simply ignored.
| Field Summary | |
|---|---|
protected int |
instanceId
|
| Constructor Summary | |
|---|---|
protected |
PenletContext(int instanceID)
Creates a new penlet context having the specified instance ID. |
| Method Summary | |
|---|---|
abstract void |
addAreaEnterExitListener(AreaEnterExitListener listener)
Deprecated. use addRegionEnterExitListener(RegionEnterExitListener) |
abstract void |
addAreaEnterExitListener(AreaEnterExitListener listener,
Region region)
Deprecated. use addRegionEnterExitListener(RegionEnterExitListener,Region) |
abstract void |
addCoordinateListener(CoordinateListener listener)
Adds a listener for coordinate events. |
void |
addMetricData(String metricName)
Add a metric with empty data. |
void |
addMetricData(String metricName,
Object data)
Add a metric with data. |
abstract void |
addMetricData(String metricName,
Object[] data)
Add metric data associated with the penlet. |
abstract void |
addPaperListener(PaperListener listener)
Adds a listener for paper events |
abstract void |
addPenTipListener(PenTipListener listener)
Adds a listener for pen tip events for all pages the penlet owns. |
abstract void |
addPenTipListener(PenTipListener listener,
Region region)
Adds a listener for pen tip events for the specific region on all pages the penlet owns. |
abstract void |
addRegionEnterExitListener(RegionEnterExitListener listener)
Adds a listener for region enter/exit events for all regions on all pages the penlet owns. |
abstract void |
addRegionEnterExitListener(RegionEnterExitListener listener,
Region region)
Adds a listener for region enter/exit events for the specified region on all pages the penlet owns. |
abstract void |
addStrokeListener(StrokeListener listener)
Adds a listener for stroke events for all pages the penlet owns. |
abstract void |
addStrokeListener(StrokeListener listener,
Region region)
Adds a listener for stroke events for the specific region on all pages the penlet owns. |
abstract Config |
getAppConfiguration()
Gets the application configuration. |
abstract RegionCollection |
getCurrentRegionCollection()
Gets the RegionCollection for the current page. |
abstract Display |
getDisplay()
Gets the display instance. |
PenHardware |
getHardware()
Get info about the pen |
ICRContext |
getICRContext(int delay,
HWRListener listener)
Creats an ICR recognition context for recognition of text for the current locale and default writing style ( WritingStyle.DEFAULT). |
abstract ICRContext |
getICRContext(int delay,
HWRListener listener,
Language language,
WritingStyle style)
Deprecated. |
abstract ICRContext |
getICRContext(int delay,
HWRListener listener,
Locale locale,
WritingStyle style)
Creates an ICR recognition context for recognition of text for a specified language and writing style. |
int |
getId()
Gets the identifier for the application. |
abstract PenletStorage |
getInternalPenletStorage()
Gets the persistant storage to be used by the application. |
abstract String |
getName()
Gets the name of the penlet. |
abstract Object |
getProperty(String prop)
Gets the value of the specified property. |
QuickLaunch |
getQuickLaunch()
Get a QuickLaunch object which allows editing of the dynamic Quick Launch menu items associated with this penlet |
RegionCollection |
getRegionCollection(PageInstance page)
Gets a region collection for the page instance passed. |
abstract ResourceBundle |
getResourceBundle()
Gets the resource bundle for the current locale. |
abstract ResourceBundle |
getResourceBundle(Locale locale)
Gets the resource bundle for a specific locale. |
abstract SystemConfig |
getSystemConfiguration()
Gets the system configuration instance. |
abstract void |
hideMuteWarning()
Hides a warning to user that volume is MUTED. |
abstract void |
installPlugin(PenletPlugin plugin)
Installs the specified plugin but does not activate it. |
abstract boolean |
isRecordingInProgress()
Indicates if the system is currently recording or not. |
abstract void |
notifyCanProcessMenuEvents(boolean process)
The application notifies the system that it can now process or not process menu events. |
abstract void |
notifyDataOnDisplay(boolean valid)
Allows the application to notify the system that display has data. |
abstract boolean |
notifyStateChange(boolean requestActive)
Allows the application to request the system that it wants to change its state. |
abstract void |
playDefaultLeftAPM(boolean enable)
The system plays a default sound when a left menu event is passed to the application. |
abstract void |
playDefaultRightAPM(boolean enable)
The system plays a default sound when a right menu event is passed to the application. |
abstract void |
removeAreaEnterExitListener(AreaEnterExitListener listener)
Deprecated. use removeRegionEnterExitListener(RegionEnterExitListener) |
abstract void |
removeCoordinateListener(CoordinateListener listener)
Removes the coordinate listener that was added earlier. |
abstract void |
removePaperListener(PaperListener listener)
Removes the paper listener that was added earlier. |
abstract void |
removePentipListener(PenTipListener listener)
Deprecated. use removePenTipListener(PenTipListener) |
abstract void |
removePenTipListener(PenTipListener listener)
Removes the pen tip listener that was added earlier. |
abstract void |
removeRegionEnterExitListener(RegionEnterExitListener listener)
Removes the region enter/exit listener that was added earlier. |
abstract void |
removeStrokeListener(StrokeListener listener)
Removes the stroke listener that was added earlier. |
abstract boolean |
requestActivation(long delay)
Requests the penlet to be activated after the specified time. |
byte[] |
sendServiceRequest(String className,
byte[] data)
This will start a penlet and pass the data array to it and return a result. |
abstract void |
setProperty(String prop,
Object value)
Sets a property specific to this instance of a penlet context. |
abstract void |
showMuteWarning()
Shows a warning to the user that the volume is MUTED. |
abstract void |
uninstallPlugin(PenletPlugin plugin)
Uninstalls the specified plugin. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int instanceId
| Constructor Detail |
|---|
protected PenletContext(int instanceID)
instanceID - the instance ID| Method Detail |
|---|
public void addMetricData(String metricName)
metricName - name of the metric that the app wants to trackaddMetricData(String, Object),
addMetricData(String, Object[])
public void addMetricData(String metricName,
Object data)
metricName - name of the metric that the app wants to trackdata - any object that contains the metric data. This cannot be
nulladdMetricData(String),
addMetricData(String, Object[])
public abstract void addMetricData(String metricName,
Object[] data)
metricName - name of the metric that the app wants to trackdata - an array of objects that contains the metric data. This
cannot be nulladdMetricData(String),
addMetricData(String, Object)public abstract boolean isRecordingInProgress()
true if the system is currently recording and
false if the system is not recording.public abstract void addAreaEnterExitListener(AreaEnterExitListener listener)
addRegionEnterExitListener(RegionEnterExitListener)
listener - add this listener
public abstract void addAreaEnterExitListener(AreaEnterExitListener listener,
Region region)
addRegionEnterExitListener(RegionEnterExitListener,Region)
listener - add this listenerregion - region for which the application wants to monitor
enter/exit events.public abstract void addRegionEnterExitListener(RegionEnterExitListener listener)
listener - add this listener
public abstract void addRegionEnterExitListener(RegionEnterExitListener listener,
Region region)
listener - add this listenerregion - region for which the application wants to monitor
enter/exit events.public abstract void addPenTipListener(PenTipListener listener)
listener - add this listener
public abstract void addPenTipListener(PenTipListener listener,
Region region)
listener - add this listenerregion - region for which the application wants to monitor pen tip
eventspublic abstract void addStrokeListener(StrokeListener listener)
listener - add this listener
public abstract void addStrokeListener(StrokeListener listener,
Region region)
listener - add this listenerregion - region for which the application wants to monitor stroke
eventspublic abstract void addPaperListener(PaperListener listener)
listener - add this listenerpublic abstract void removePaperListener(PaperListener listener)
listener - listener that should be removed. This MUST be a non-null
instancepublic abstract void removeAreaEnterExitListener(AreaEnterExitListener listener)
removeRegionEnterExitListener(RegionEnterExitListener)
listener - listener that should be removed. This MUST be a non-null
instancepublic abstract void removeRegionEnterExitListener(RegionEnterExitListener listener)
listener - listener that should be removed. This MUST be a non-null
instancepublic abstract void removePentipListener(PenTipListener listener)
removePenTipListener(PenTipListener)
listener - listener that should be removed. This MUST be a non-null
instancepublic abstract void removePenTipListener(PenTipListener listener)
listener - listener that should be removed. This MUST be a non-null
instancepublic abstract void removeStrokeListener(StrokeListener listener)
listener - listener that should be removed. This MUST be a non-null
instancepublic abstract void addCoordinateListener(CoordinateListener listener)
listener - listener that should be added. This MUST be a non-null instancepublic abstract void removeCoordinateListener(CoordinateListener listener)
listener - listener that should be removed. This MUST be a non-null
instancepublic abstract Config getAppConfiguration()
public abstract RegionCollection getCurrentRegionCollection()
RegionCollection for the current page.
public final RegionCollection getRegionCollection(PageInstance page)
page - page instance.
public abstract Display getDisplay()
public abstract ICRContext getICRContext(int delay,
HWRListener listener,
Language language,
WritingStyle style)
public abstract ICRContext getICRContext(int delay,
HWRListener listener,
Locale locale,
WritingStyle style)
activateApp.
Additionally, the best place to call the matching
dispose method is in
deactivateApp.
The delay is measured from when strokes are added to the context. The timing will actually be greater than or equal to this value because the recognition engine varies in the time it takes to recognize strokes.
NOTE: The ICRContext.dispose() method should
be called before trying to create a new ICRContext with this
method. One way to do this is to call
dispose at the start of
deactivateApp. This will guarantee
that no previous code in the method will throw an uncaught exception.
Any inadvertent uncaught exception would prevent
dispose from executing.
delay - timeout in milliseconds that should be used for
user pauseslistener - a listener that would process ICR eventslocale - the language to be used for the handwriting.style - the writing style to be used for the context.
ICRContext.dispose(),
HWRListener.hwrUserPause(long, String)
public ICRContext getICRContext(int delay,
HWRListener listener)
WritingStyle.DEFAULT).
Please see the note in the other
getICRContext
method for how to properly dispose of the returned instance.
delay - timeout in milliseconds that should be used for
user pauseslistener - a listener that would process ICR events
getICRContext(int, HWRListener, Language, WritingStyle),
ICRContext.dispose(),
HWRListener.hwrUserPause(long, String)public int getId()
public abstract PenletStorage getInternalPenletStorage()
public abstract String getName()
String of the penlet namepublic abstract SystemConfig getSystemConfiguration()
public abstract void notifyDataOnDisplay(boolean valid)
valid - true if the display has data and
false otherwise.public abstract boolean notifyStateChange(boolean requestActive)
requestActive - true indicates that the app wants to
change to an active state and false if the app wants
to change to the inactive state
true if the state change was granted and
false the state change was denied or the app was
already in the state that it wants to change to.public abstract boolean requestActivation(long delay)
delay - time after which the penlet has to be activated.
true if the request was granted and
false if the request was denied.public abstract void showMuteWarning()
public abstract void hideMuteWarning()
showMuteWarning()public abstract ResourceBundle getResourceBundle()
public abstract ResourceBundle getResourceBundle(Locale locale)
locale - get the bundle specific to this locale
null instance.public abstract void notifyCanProcessMenuEvents(boolean process)
MenuEventListener will automatically process menu
events. Only apps that needs to selectively enable or disable the app
menu will need this method. Calling this method has no effect if the
application does not implement MenuEventListener.
process - true (the default) if it can process menu
events and false if it cannot.public abstract void playDefaultRightAPM(boolean enable)
enable - true to play the default sound for right menu
event.public abstract void playDefaultLeftAPM(boolean enable)
enable - true to play the default sound for left menu
event.public abstract void installPlugin(PenletPlugin plugin)
null or is already installed then this does nothing.
Note that the plugin is not activated by installing it.
plugin - install this pluginuninstallPlugin(PenletPlugin),
PenletPlugin.activate()public abstract void uninstallPlugin(PenletPlugin plugin)
plugin - uninstall this plugininstallPlugin(PenletPlugin),
PenletPlugin.deactivate()
public abstract void setProperty(String prop,
Object value)
prop - the property to setvalue - the new property value
NullPointerException - if the property is null.getProperty(String)public abstract Object getProperty(String prop)
null if the property is not set.
prop - query this property
null if it is not set.
NullPointerException - if the property is null.setProperty(String, Object)
public byte[] sendServiceRequest(String className,
byte[] data)
className - className to send request to, this must match the penlet's manifest Penlet-Class propertydata - byte array of data to send to the penlet
public PenHardware getHardware()
public QuickLaunch getQuickLaunch()
|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||