7.3. ServiceUI

User must also implement this interface that publish only one method (void startUI ()). This method is in charge of create the real JFrame, Frame, Applet... or whatever and invoke its show() method. As we have seen before, the ServiceUI has been created by the UIFactory and, in our example, we passed the Workspace object to this ServiceUI. Usually the ServiceUI implemetation will pass this Workspace to the real GUI implementation to allow comunication with the real endpoint.

The programer then assume this Workspace objec will be passed in the contructor an he will use it to perform communication.

Very simple ServiceUI implementation

public class DateServiceUI implements ServiceUI {

    private Workspace w;

    public DataServiceUI (Workspace w) {

        this.w = w;

    }

    public void startUI () {

        // init the real JFrame

        new DateJFrame (w).show();

}