



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: PROG LANG TECH & PDGMS; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




1
editing, and theit is copied into the text field fornames in the left-hand list box,When you select one of the
(^) Copy
(^) button is
enabled.
3
When you click on
(^) Copy,
Clear right hand list box, and the that text is added to the
(^) button is enabled.
If you click on the
(^) Clear
buttons are again disabled.deselected and the twocleared, the list box isbox and the text field are button, the right hand list
pretty complex.the visual controls areThe interactions between
relationship diagram.quite a tangledmore others, leading toto know about two orEach visual object needs
5
informed of this event.event, and the Mediator decides which other classes should beEach Colleague informs the Mediator when it has received a user
classes are added.of the other classes changes or if other interface controlthus the only one that would need to be changed if one
7
its constructor.then pass the instance of the Mediator to each class in
13
register methods for each of the controls.
15
is the initialization of all the controls to the desired state.One further operation that is best delegated to the Mediator
the program evolves, we simply create anknown, default state, and since these states may change asWhen we launch the program, each control must be in a
(^) init
(^) method in
the Mediator, which sets them all to the desired state.
public void init() {Clear button and we simply call that method.In this case, that state is the same as is achieved by the
Clear();
}
17
changing the Mediator.You can change the behavior of the program by simply
part of the program.Colleagues to a system without having to change any otherThe Mediator approach makes it possible to add new
in the rest of a user interface.needing to know too much about the objects and methodsThe Mediator solves the problem of each Command object
the responsibilities you have given the Mediator.
interactions any other way.this code is far easier than managing the complex objectOn the other hand, most Mediators are quite simple and writing