Home for HMNL Enterprise Computing

Interacting with the UI

Ian Tree  10 May 2006 17:19:24

Interacting with the UI


There is a handy little trick that you you can use if you want to run a Foreground Java agent to do some processing and you have to interact with the user and you don't want to have to engineer a Swing UI just to support this agent. Just follow the steps below.

1. Create a profile form with all of the fields that are needed by the Java Agent. (both input & output).

2. In the profile document have ok & cancel buttons that set a field to "ok" or "cancel" and saves & closes the profile

3. Instead of calling your agent from an action somewhere in your application generate a calling sequence that

    3.1 Does an @Command([EditProfile].... on your profile document
    3.2 If the profile field is not set to "cancel" - runs your Java agent
    3.3 If the profile field is not set to "cancel" - does another @Command([EditProfile].... to display your results

Your Java agent now has a very simple UI construct in that it reads it's input data from the profile document and writes it's output back to the same profile document - job done.

Comments