What design template to use (I need something like a mediator template)?

I have a GUI application with a lot of controls. Most of them have events, and each of them is logically connected with them. For example, I have 5 comboBoxes. If I select something in cb1 and cb3 , they cb2 should change the list of available values. If I select something in cb2 and ch4 , they are cb5should upload a list of their available values. All the articles I found on the Internet say that I should use the pick template in this case. But in all these articles, the pick is something like a divine class that knows everything about all the controls and decides what needs to be done in the event of an event. If I have 5-6 controllers - everything is in order. But what if I have something like 20 or 40 controls? I assume that the mediator class will become a monster in this case. It will be difficult to do something with it (change or add new functions).

Are there any other patterns or good examples of pathern plectrum that can help solve this situation?

PS: Sorry, if there are already existing questions on this topic - there are so many questions with the same name that it is not so easy to find something that I really need from all of these topics.

+5
source share
5 answers

The intermediary is indeed the right choice here, however there is an alternative option for using the OBSERVER template, which allows you to save the logic separately. (cb2 observes cb1 and reacts accordingly, cb3-> cb2, etc.).

With the OBSERVER template, you will only need to bind two controls at a time, it looks like a chain.

+2
source

, ( JComponent JPanel). (- > ). , , .

+1

- Wiki

wikipedia, .

, . , ... , , Mediator

0

, , .

0

gof book :

"...

Facade (185) Mediator , , . ; Facade , . , , , .

, Observer (293).... ".

, .

, , , , .

0

All Articles