问题
A Lotus script calls a Java agent and passes parameters to it in an In-Memory-Document. The agent performs some computations and reports its progress in a property of the shared document. A Timer on the form periodically checks the value representing the progress in the document and updates the UI accordingly.
The agent, having accomplished some progress, says:
doc.replaceItemValue("Percent", String.valueOf(percent));
doc.save(true, false);
The timer on the forms loads the document periodically and tries to read the value like this:
Set doc = db.GetDocumentByID(parDocId)
percent = doc.getItemValue("Percent")(0)
Call uidoc.FieldSetText("Percent", percent)
The problem is that the changes done by the agent are not read by the timer until the agent is completely done with the processing. So the GUI is not updated until the 100% finally appears.
I am wondering whether there is a better way to do this.
I tried to let those components communicate through environment variables, but those are restricted operations which I would prefer not to use.
来源:https://stackoverflow.com/questions/24733460/reloading-a-document-while-being-changed-by-an-agent-running-in-the-background