public class ItemProcessor extends java.lang.Object implements IWidgetClosedListener, java.lang.Runnable
This class is responsible for processing a Form for a specific Item. It implements the Runnable interface and should be run on a separate thread from the UI. However, it is not thread safe and all of its required information must be set before it is launched. Setting the values while the thread is running will cause it to fail. This strategy is employed to keep clients from updating the process request mid-stream, which could cause problems much worse than a thread exception in the ICE core, because the ItemProcessor is only meant to be launched once per process request. It realizes the IWidgetClosedListener interface so that it can be notified by IExtraInfoWidgets when they are closed. The ItemProcessor will attempt to push streaming input if it is available for an Item to the IStreamingTextWidget that is supplied during configuration. It will also set the label of the widget.
All of the set operations, with the exception of setPollTime() and setStreamingOutputWidget(), must be called before the processor can be launched. There is a default polling time configured in the processor (100ms) and if a streaming text widget is not set the ItemProcessor will not push the output.
Constructor and Description |
---|
ItemProcessor()
The constructor
|
Modifier and Type | Method and Description |
---|---|
void |
cancelled()
(non-Javadoc)
|
void |
closedOK()
(non-Javadoc)
|
java.lang.String |
getActionName()
This operation retrieves the name of the action that the ItemProcessor
will use to process the Item.
|
ICore |
getCore()
This operation retrieves the ICore to which the ItemProcessor directs its
requests or returns null if it was not previously set.
|
IFormWidget |
getFormWidget()
This operation retrieves the IFormWidget that is updated by the
ItemProcessor.
|
IExtraInfoWidget |
getInfoWidget()
This operation retrieves the IExtraInfoWidget that is used by the
ItemProcessor.
|
int |
getItemId()
This operation retrieves the id of the Item that the ItemProcessor will
process.
|
int |
getPollTime()
This operation retrieves the current poll time.
|
IStreamingTextWidget |
getStreamingTextWidget()
This operation retrieves the IStreamingTextWidget that is updated by the
ItemProcessor.
|
void |
run()
This operation launches the thread to process the Item.
|
void |
setActionName(java.lang.String name)
This operation sets the name of the action that should be performed when
the Item is processed.
|
void |
setCore(ICore core)
This operation sets the ICore to which the ItemProcessor directs its
requests.
|
void |
setFormWidget(IFormWidget widget)
This operation sets the IFormWidget that is updated by the ItemProcessor.
|
void |
setInfoWidget(IExtraInfoWidget widget)
This operation sets the IExtraInfoWidget that is used by the
ItemProcessor.
|
void |
setItemId(int id)
This operation sets the id of the Item that the ItemProcessor will
process.
|
void |
setPollTime(int milliseconds)
This operation sets the poll time of the ItemProcessor.
|
void |
setStreamingTextWidget(IStreamingTextWidget widget)
This operation sets the IStreamingTextWidget that is updated by the
ItemProcessor.
|
public IExtraInfoWidget getInfoWidget()
This operation retrieves the IExtraInfoWidget that is used by the ItemProcessor. If it has not been previously set, this operation returns null.
The IExtraInfoWidget
public void setInfoWidget(IExtraInfoWidget widget)
This operation sets the IExtraInfoWidget that is used by the ItemProcessor.
widget
- The IExtraInfoWidget
public void setFormWidget(IFormWidget widget)
This operation sets the IFormWidget that is updated by the ItemProcessor.
widget
- The IFormWidget
public IFormWidget getFormWidget()
This operation retrieves the IFormWidget that is updated by the ItemProcessor. If it has not been previously set, this operation returns null.
The IFormWidget
public void setStreamingTextWidget(IStreamingTextWidget widget)
This operation sets the IStreamingTextWidget that is updated by the ItemProcessor.
widget
- The IStreamingTextWidget
public IStreamingTextWidget getStreamingTextWidget()
This operation retrieves the IStreamingTextWidget that is updated by the ItemProcessor. If it has not been previously set, this operation returns null.
The IStreamingTextWidget
public void setActionName(java.lang.String name)
This operation sets the name of the action that should be performed when the Item is processed.
name
- The action name
public java.lang.String getActionName()
This operation retrieves the name of the action that the ItemProcessor will use to process the Item. If it has not been previously set, this operation returns null.
The name of the action
public void setItemId(int id)
This operation sets the id of the Item that the ItemProcessor will process.
id
- public int getItemId()
This operation retrieves the id of the Item that the ItemProcessor will process. If it has not been previously set, this operation returns -1.
The Item's id
public void setCore(ICore core)
This operation sets the ICore to which the ItemProcessor directs its requests.
core
- The ICore
public ICore getCore()
This operation retrieves the ICore to which the ItemProcessor directs its requests or returns null if it was not previously set.
The ICore
public void setPollTime(int milliseconds)
This operation sets the poll time of the ItemProcessor. It checks to make sure that the submitted poll time is positive, greater than zero and less than 30,000 milliseconds (30 seconds). If the submitted time is invalid, this operation sets it to the default polling time.
milliseconds
- The poll time in milliseconds. This value must be positive, greater than zero and less than 30,000.
public int getPollTime()
This operation retrieves the current poll time. The units of the returned value are milliseconds.
The current polling time in milliseconds.
public void run()
This operation launches the thread to process the Item.
run
in interface java.lang.Runnable
public void closedOK()
closedOK
in interface IWidgetClosedListener
IWidgetClosedListener.closedOK()
public void cancelled()
cancelled
in interface IWidgetClosedListener
IWidgetClosedListener.cancelled()