Team members report to the arbitrator, the arbitrator issued instructions to the crew. No longer ask each other and each other instructions between team members.
Examples
A GUI application that shows a login dialog, after which the user enter the correct user name and password to log in.
You can choose as a tourist visit (Guest) or as user login (Login)
As users log in, you need to enter the correct user name (Username) and password (Password)
Click the OK button to log in, click on the Cancel button to cancel Login
Class Diagram
Timing diagram
Mediator Interface
1 2 3 4
public interface { public abstract void createColleagues () ; public abstract void colleagueChanged () ; }
@Override publicvoidcreateColleagues(){ CheckboxGroup g = new CheckboxGroup(); checkGuest = new ColleagueCheckbox("Guest", g, true); checkLogin = new ColleagueCheckbox("Login", g, false); textUser = new ColleagueTextField("", 10); textPass = new ColleagueTextField("", 10); textPass.setEchoChar('*'); buttonOk = new ColleagueButton("OK"); buttonCancel = new ColleagueButton("Cancel");
Colleague and Mediator role responsible for defining the role of interface (API) for communication. In the sample program, the Colleague interfaces play this role.
ConcreteColleague (specific colleagues)
ConcreteColleague role is responsible for implementing Colleague roles Interface (API). In the sample program, the ColleagueButton class, ColleagueTextField ColleagueCheckbox class and class play this role.