|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectSpeechEvent
GrammarEvent
public class GrammarEvent
Event issued to GrammarListener
s
when events associated with Grammar
s occur.
GrammarListener
s attached to a Grammar
receive only GrammarEvent
s associated with that Grammar
.
GrammarListener
s attached to a GrammarManager
receive associated GrammarEvent
s for all managed Grammar
s.
The source for a GrammarEvent
is always a Grammar
object.
Grammar
,
GrammarListener
,
addGrammarListener
,
addGrammarListener
Field Summary | |
---|---|
static int |
DEFAULT_MASK
The default mask for events in this class. |
static int |
GRAMMAR_ACTIVATED
Event issued when a Grammar changes
state from deactivated to activated. |
static int |
GRAMMAR_CHANGES_COMMITTED
Event issued when a Recognizer
commits changes to a Grammar . |
static int |
GRAMMAR_CHANGES_REJECTED
Event issued when a Recognizer
rejects changes to a Grammar . |
static int |
GRAMMAR_DEACTIVATED
Event issued when a Grammar changes
state from activated to deactivated. |
Fields inherited from class SpeechEvent |
---|
DISABLE_ALL, ENABLE_ALL |
Constructor Summary | |
---|---|
GrammarEvent(Grammar source,
int id)
Constructs a GRAMMAR_ACTIVATED or GRAMMAR_DEACTIVATED
GrammarEvent . |
|
GrammarEvent(Grammar source,
int id,
boolean activatableChanged,
boolean definitionChanged,
GrammarException grammarException)
Constructs a GRAMMAR_CHANGES_COMMITTED
or GRAMMAR_CHANGES_REJECTED GrammarEvent . |
Method Summary | |
---|---|
GrammarException |
getGrammarException()
Returns a GrammarException
if an error is found in the source Grammar . |
boolean |
isActivatableChanged()
Returns true for a GRAMMAR_CHANGES_COMMITTED event
if the activatable property of the source Grammar changed. |
boolean |
isDefinitionChanged()
Returns true for a GRAMMAR_CHANGES_COMMITTED event
if the definition of the source Grammar changed. |
String |
paramString()
Returns a parameter String that contains
the event identifier in text form. |
String |
toString()
Returns a printable String . |
Methods inherited from class SpeechEvent |
---|
getId, getSource |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int GRAMMAR_CHANGES_COMMITTED
Recognizer
commits changes to a Grammar
.
This event is issued immediately following the CHANGES_COMMITTED
RecognizerEvent
issued to RecognizerListener
s.
That event indicates that changes have been applied from
all Grammar
s of a GrammarManager
.
This event is specific to each individual Grammar
.
It is issued when the definition of the Grammar
is changed, when its activatable
property is changed, or both.
The isDefinitionChanged
and isActivatableChanged
methods
indicate these conditions.
If any syntactic or logical errors are detected for a Grammar
during the commit, a GRAMMAR_CHANGES_REJECTED
event is generated
rather than this event.
GRAMMAR_CHANGES_REJECTED
,
CHANGES_COMMITTED
,
isDefinitionChanged
,
isActivatableChanged
,
resume
,
GrammarEvent(Grammar, int, boolean, boolean, GrammarException)
,
Constant Field Valuespublic static final int GRAMMAR_CHANGES_REJECTED
Recognizer
rejects changes to a Grammar
.
This event is issued immediately following the CHANGES_REJECTED
RecognizerEvent
that is issued to RecognizerListener
s.
That event indicates that changes have been rejected for
all changed Grammar
s of a GrammarManager
.
This event is specific to each individual changed Grammar
.
The getGrammarException
method returns a non-null
GrammarException
if the Grammar
contains any syntactic or logical errors.
GRAMMAR_CHANGES_COMMITTED
,
CHANGES_REJECTED
,
getGrammarException
,
GrammarException
,
GrammarEvent(Grammar, int, boolean, boolean, GrammarException)
,
Constant Field Valuespublic static final int GRAMMAR_ACTIVATED
Grammar
changes
state from deactivated to activated.
The isActive
method of the Grammar
will now return true
.
Grammar
activation changes follow
one of two RecognizerEvent
s:
CHANGES_COMMITTED
event -
in this case a GRAMMAR_CHANGES_COMMITTED
event
where isActivatableChanged
returns true
also precedes this event
ENGINE_FOCUSED
event.
See
Grammar Activation
for details about Grammar
activation and deactivation.
GRAMMAR_ACTIVATED
,
GRAMMAR_CHANGES_COMMITTED
,
isActivatableChanged
,
Grammar
,
isActive
,
CHANGES_COMMITTED
,
ENGINE_FOCUSED
,
GrammarEvent(Grammar, int)
,
Constant Field Valuespublic static final int GRAMMAR_DEACTIVATED
Grammar
changes
state from activated to deactivated.
The isActive
method of the Grammar
will now return false
.
Grammar
deactivation changes follow
one of two RecognizerEvent
s:
CHANGES_COMMITTED
event -
in this case a GRAMMAR_CHANGES_COMMITTED
event
where isActivatableChanged
returns true
also precedes this event
ENGINE_DEFOCUSED
event.
See
Grammar Activation
for details about Grammar
activation and deactivation.
GRAMMAR_DEACTIVATED
,
GRAMMAR_CHANGES_COMMITTED
,
isActivatableChanged
,
Grammar
,
isActive
,
CHANGES_COMMITTED
,
ENGINE_DEFOCUSED
,
GrammarEvent(Grammar, int)
,
Constant Field Valuespublic static final int DEFAULT_MASK
The following events are delivered by default:
GRAMMAR_CHANGES_COMMITTED
, GRAMMAR_CHANGES_REJECTED
,
GRAMMAR_ACTIVATED
, GRAMMAR_DEACTIVATED
.
Use setGrammarMask
to change the GrammarEvent
mask
if desired.
GRAMMAR_CHANGES_COMMITTED
,
GRAMMAR_CHANGES_REJECTED
,
GRAMMAR_ACTIVATED
,
GRAMMAR_DEACTIVATED
,
setGrammarMask
,
Constant Field ValuesConstructor Detail |
---|
public GrammarEvent(Grammar source, int id) throws IllegalArgumentException
GRAMMAR_ACTIVATED
or GRAMMAR_DEACTIVATED
GrammarEvent
.
source
- the Grammar
object that issued the eventid
- the event identifier
IllegalArgumentException
- if called with an inappropriate event IDGRAMMAR_ACTIVATED
,
GRAMMAR_DEACTIVATED
public GrammarEvent(Grammar source, int id, boolean activatableChanged, boolean definitionChanged, GrammarException grammarException) throws IllegalArgumentException
GRAMMAR_CHANGES_COMMITTED
or GRAMMAR_CHANGES_REJECTED
GrammarEvent
.
For a GRAMMAR_CHANGES_COMMITTED
event,
the activatableChanged
and definitionChanged
parameters
indicate what properties of the Grammar
have changed.
Otherwise, these parameters are false
.
For a GRAMMAR_CHANGES_REJECTED
event,
if the Grammar
contains an error, then
the grammarException
parameter specifies the error encountered.
Otherwise, the grammarException
is null
.
source
- the Grammar
object that issued the eventid
- the event identifieractivatableChanged
- true
if the Grammar
's
activatable
property changeddefinitionChanged
- true
if the Grammar
's
definition changedgrammarException
- non-null
description if error
encountered, otherwise null
IllegalArgumentException
- if called with an inappropriate event IDGRAMMAR_CHANGES_COMMITTED
,
GRAMMAR_CHANGES_REJECTED
,
isActivatableChanged
,
isDefinitionChanged
,
getGrammarException
,
RecognizerEvent.CHANGES_COMMITTED
,
RecognizerEvent.CHANGES_REJECTED
Method Detail |
---|
public boolean isDefinitionChanged()
true
for a GRAMMAR_CHANGES_COMMITTED
event
if the definition of the source Grammar
changed.
Returns false
in all other cases.
Grammar
definition has changed.GRAMMAR_CHANGES_COMMITTED
,
getSource
public boolean isActivatableChanged()
true
for a GRAMMAR_CHANGES_COMMITTED
event
if the activatable
property of the source Grammar
changed.
Returns false
in all other cases.
Grammar
s
activatable
property changed.GRAMMAR_CHANGES_COMMITTED
,
getSource
public GrammarException getGrammarException()
GrammarException
if an error is found in the source Grammar
.
This applies to a GRAMMAR_CHANGES_REJECTED
event.
Returns null
in all other cases.
GrammarException
with information about
the source Grammar
errorGRAMMAR_CHANGES_REJECTED
,
getSource
public String paramString()
String
that contains
the event identifier in text form.
The method toString
may provide more detail.
This method is useful for event-logging and for debugging.
paramString
in class SpeechEvent
String
that contains the event identifier in text form.toString
public String toString()
String
.
Useful for event-logging and debugging.
The method paramString
also provides printable information.
toString
in class SpeechEvent
paramString
|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API 2.0,
Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.