User must implement this interface that publish only two methods. One service can have been implemented in many ways (JFrame, Frame, Applet, JPanel...) this UIFactory will store the different UITypes (String[] getUITypes ()) and instantiane one of them in the best way only know by the programer (ServiceUI createServiceUI (String type, Workspace workspace)).
These methods will be called directly by the client or by the servent, so the porgramer only needs to make a very simple UIFactory that return the valid UITypes and that initailize each one of them when the createServiceUI is called.
Very simple UIFactory implementation
public class DateUIFActory implements UIFActory {
public String [] getUITypes () {
return new String [] {”JFrame”}
}
public ServiceUI getServiceUI (String type, Workspace workspace) {
if (“JFrame”.equals(type)) {
return new DateServiceUI (workspace);
}
else {
throw new UnsoportedUIException (type + “ was not found”);
}
}