|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.livescribe.penlet.PenletPlugin
com.livescribe.penlet.AbstractPenletPlugin
public abstract class AbstractPenletPlugin
An abstract base class for penlet plugins that provides a basic implementation for the plugin state.
PluginListener| Field Summary | |
|---|---|
protected boolean |
active
The active state of this plugin. |
protected Vector |
listeners
The listener list. |
| Constructor Summary | |
|---|---|
protected |
AbstractPenletPlugin(Penlet penlet)
Creates a new plugin. |
protected |
AbstractPenletPlugin(Penlet penlet,
boolean consumeAllEvents)
Creates a new plugin and sets whether to consume all the events. |
| Method Summary | |
|---|---|
void |
activate()
Activates the plugin. |
void |
addPluginListener(PluginListener l)
Adds a plugin listener. |
void |
deactivate()
Deactivates the plugin. |
protected void |
fireActivated()
Fires the activated event to all the listeners. |
protected void |
fireDeactivated()
Fires the deactivated event to all the listeners. |
boolean |
isActive()
Returns the active state of this plugin. |
boolean |
onCoordinateEvent(CoordinateEvent ev)
Handles a coordinate event. |
boolean |
onDocumentEvent(DocumentEvent ev)
Handles a document event. |
boolean |
onMenuEvent(MenuEvent ev)
Handles a menu event. |
boolean |
onPenTipEvent(PenTipEvent ev)
Handles a pen tip event. |
boolean |
onRegionEvent(RegionEvent ev)
Handles a region event. |
boolean |
onStrokeEvent(StrokeEvent ev)
Handles a stroke event. |
void |
removePluginListener(PluginListener l)
Adds a plugin listener. |
void |
scheduleDeactivation(long delay)
A convenience method that schedules a call to deactivate()
after the specified delay. |
void |
setConsumeAllEvents(boolean flag)
Sets whether to consume all the events. |
| Methods inherited from class com.livescribe.penlet.PenletPlugin |
|---|
getDisplay, getPenlet, restoreDisplay, saveDisplay |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean active
protected Vector listeners
| Constructor Detail |
|---|
protected AbstractPenletPlugin(Penlet penlet)
penlet - the penletAbstractPenletPlugin(Penlet, boolean)
protected AbstractPenletPlugin(Penlet penlet,
boolean consumeAllEvents)
penlet - the penletconsumeAllEvents - indicates whether to consume all eventssetConsumeAllEvents(boolean)| Method Detail |
|---|
public boolean isActive()
isActive in class PenletPluginactiveprotected void fireActivated()
listenersprotected void fireDeactivated()
listenerspublic void addPluginListener(PluginListener l)
null. Note that a listener may be added more than once,
and will thus receive event notifications more than once.
addPluginListener in class PenletPluginl - the listener to addlistenerspublic void removePluginListener(PluginListener l)
null. The listener is found in the list by using its
equals implementation, which,
unless overridden, is a direct object reference compare.
removePluginListener in class PenletPluginl - the listener to addlisteners
public void activate()
throws PenletStateChangeException
Overriding methods should call this after any other setup is completed. The reason is that the listener notification happens at the end of this method.
It is often the case, however, that more major setup needs to be done
when a plugin is activated. In this case, it is probably easier to not
call this implementation (via super.activate()) and
instead just manage the active field and notify listeners
using fireActivated() yourself.
Note that this implementation does not throw a
PenletStateChangeException.
activate in class PenletPluginPenletStateChangeException - if there was a problem activating
the plugin.active,
fireActivated()public void scheduleDeactivation(long delay)
deactivate()
after the specified delay.
delay - deactivate the plugin after this delay, in millisecondspublic void deactivate()
Overriding methods should call this after any other cleanup is completed. The reason is that the listener notification happens at the end of this method.
It is often the case, however, that more major cleanup needs to be done
when a plugin is deactivated. In this case, it is probably easier to
not call this implementation (via super.deactivate()) and
instead just manage the active field and notify listeners
using fireDeactivated() yourself.
deactivate in class PenletPluginactive,
fireDeactivated()public final void setConsumeAllEvents(boolean flag)
onXXXEvent() methods.
In other words, this setting controls whether all events are consumed
by this plugin or not. PenletPlugin by default does not
consume all the events and this method provides a way to configure
that.
Note that this does not cause Event.consume() to be called. It
only indicates what should be returned from the event handling methods.
The default value of this setting is false.
flag - whether to consume all eventspublic boolean onCoordinateEvent(CoordinateEvent ev)
setConsumeAllEvents(boolean).
onCoordinateEvent in class PenletPluginev - the coordinate event
setConsumeAllEvents(boolean)public boolean onDocumentEvent(DocumentEvent ev)
setConsumeAllEvents(boolean).
onDocumentEvent in class PenletPluginev - the document event
setConsumeAllEvents(boolean)public boolean onMenuEvent(MenuEvent ev)
setConsumeAllEvents(boolean).
onMenuEvent in class PenletPluginev - the menu event
setConsumeAllEvents(boolean)public boolean onPenTipEvent(PenTipEvent ev)
setConsumeAllEvents(boolean).
onPenTipEvent in class PenletPluginev - the pen tip event
setConsumeAllEvents(boolean)public boolean onRegionEvent(RegionEvent ev)
setConsumeAllEvents(boolean).
onRegionEvent in class PenletPluginev - the region event
setConsumeAllEvents(boolean)public boolean onStrokeEvent(StrokeEvent ev)
setConsumeAllEvents(boolean).
onStrokeEvent in class PenletPluginev - the stroke event
setConsumeAllEvents(boolean)
|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||