|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public ServiceModel
The livetext (formally known as semantic tag) service API. The implementation class of this API provides the livetext parsing services so that tags on a page can be recognized and processed according to the tagservice.entries.cfg configuration file. An instance of this API implementation class should be created after a page is fully loaded. Once the instance is created, the init method should be called so that the tags will be parsed. Each tag processor will be invoked to process the tags in order of the tags defined in the tagservices.entries.cfg file. There should be no more than 1 instance of this class on each page. The implementation of this API should subscribe to one of the following two event topics.
"/com/ibm/mashups/livetext/livetextchanged" "/com/ibm/mashups/livetext/livetextcontentchanged" Once an event is published to that topic, the implementation of this API should start using the given DOM node and processing all the decendant DOM nodes of that given node. That given node itself will not be processed. Event livetextchanged will cause the passed node and all its children to be parsed. Event livetextcontentchanged will cause only the passed node children to be parsed. If a component wishes for a piece of markup fragment being processed, that component should publish an event to that topic, that event should also come with the DOM node which holds that piece of the markup fragment, callback functions and a flag to indicate how to proceed when an exception is thrown. The DOM node, flag and the callback functions are referred to event data below. The event data must be an array of objects in the following format. [domNode, continueAfterException, preProcessCallbackFunc, postProcessCallbackFunc] The first object in the event data array is the root node of the HTML markup fragment. If that object is not a valid DOM node, then no action will be taken. The second object in the array is a flag to indicate if the parsing should continue when an exception is caught. The third and the last object in the array are two callback functions. The preProcessCallbackFunc will be invoked before the parsing process starts, the postProcessCallbackFunc will be invoked after the parsing process finished. If none callback function is provided by the array, then no function will be invoked. The default value for continueAfterException flag is false. If the node needs to be processed and the both pre and post process callback exist, then the call should look like this.null
Field Summary | |
---|---|
String |
SERVICE_NAME
The service name to be used to fetch the service from the ServiceManager |
Method Summary | |
---|---|
void |
init(Object initArgs)
Initiate the tag service. |
void |
onTagChanged(DOMNode domNode,
boolean continueAfterException,
com.ibm.mashups.livetext.CallbackModel.preProcessCallbackFunc preProcessCallbackFunc,
com.ibm.mashups.livetext.CallbackModel.postProcessCallbackFunc postProcessCallbackFunc)
Tag changed event handler. |
void |
onUnchangeTag(DOMNode node,
Boolean continueAfterException,
unknown preUnProcessCallback,
unknown postUnProcessCallback,
unknown unchangeCompleteCallback)
The event handler when a tag and/or its content should be removed. |
void |
onTagContentChanged(DOMNode domNode,
boolean continueAfterException,
com.ibm.mashups.livetext.CallbackModel.preProcessCallbackFunc preProcessCallbackFunc,
com.ibm.mashups.livetext.CallbackModel.postProcessCallbackFunc postProcessCallbackFunc)
Tag content changed event handler. |
void |
onAddConfigEntry(ConfigEntry entry,
boolean bFront)
The method allows component dynamically add a new configuration entry so that the service can start process the tags presented by the entry. |
void |
onRemoveConfigEntry(ConfigEntry entry)
This method allows components dynamically remove a configuration entry so that the service will not process that type of tags which are presented by the configuration entry. |
Field Detail |
---|
String SERVICE_NAME
Method Detail |
---|
void init(Object initArgs)
initArgs
-
Optional JSON object that defines initialization properties for the live text service. May be null
. Currently supports these properties on the JSON object:
{
node
: The DOM node whose decendent nodes will be parsed and processed. Applies only to the initial parse. May be null
.continueAfterException
: The flag to indicate if the service should continue the parsing and processing after an exception is caught. Applies only to the initial parse. May be null
.preProcessCallbackFunc
: The callback function being called before nodes are processed for a particular tag. Applies only to the initial parse. May be null
.postProcessCallbackFunc
: The callback function being called after nodes are processed for a particular tag. Applies only to the initial parse. May be null
.void onTagChanged(DOMNode domNode, boolean continueAfterException, com.ibm.mashups.livetext.CallbackModel.preProcessCallbackFunc preProcessCallbackFunc, com.ibm.mashups.livetext.CallbackModel.postProcessCallbackFunc postProcessCallbackFunc)
domNode
-
The DOM node whose decendent nodes to be parsed and processed. May be null
.continueAfterException
-
The flag to indicate if the service should continue the parsing and processing after an exception is caught. If this parameter is missing, the default is false. May be null
.preProcessCallbackFunc
-
The callback function being called before a node being processed. May be null
.postProcessCallbackFunc
-
The callback function being called after the a node being processed. May be null
.void onUnchangeTag(DOMNode node, Boolean continueAfterException, unknown preUnProcessCallback, unknown postUnProcessCallback, unknown unchangeCompleteCallback)
node
-
the root node which will be parsed.continueAfterException
-
a flag indicate if the process should continue when error occurrs.preProcessCallback
-
the callback function which will be called before nodes being processed.postProcessCallback
-
the callback function which will be called after nodes being processed.postUnProcessCallbcak
-
the callback function which will be called after the content is unchanged.void onTagContentChanged(DOMNode domNode, boolean continueAfterException, com.ibm.mashups.livetext.CallbackModel.preProcessCallbackFunc preProcessCallbackFunc, com.ibm.mashups.livetext.CallbackModel.postProcessCallbackFunc postProcessCallbackFunc)
domNode
-
The DOM node whose decendent nodes to be parsed and processed. May be null
.continueAfterException
-
The flag to indicate if the service should continue the parsing and processing after an exception is caught. If this parameter is missing, the default is false. May be null
.preProcessCallbackFunc
-
The callback function being called before a node being processed. May be null
.postProcessCallbackFunc
-
The callback function being called after the a node being processed. May be null
.void onAddConfigEntry(ConfigEntry entry, boolean bFront)
entry
-
The entry that should be added to the configuration. Must not be null
.bFront
-
The flag to indicate if the entry should be added to the front of the configuration array or not. true for front, false for end. Default is false for end.void onRemoveConfigEntry(ConfigEntry entry)
entry
-
The entry that should be removed from the configuration. Must not be null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |