views:

70

answers:

1

Hi there,

I code Java/Swing based UI. My dialogs are quite complex and there are many rules for screen dynamics: when to enable/disable buttons, when to allow to edit some fields, etc. In general there are widgets and there are some rules to set them in some state. I am wondering if there are any nice patterns, ideas how to resolve such problems in any standardized way.

Now I still use some flags to determine widget state etc. But with complex dialogs this approach become complicated. there is also a problem with maintenance of such code later. I am waiting for your advices.

Regards, Marcin

+3  A: 

There is a specific pattern fot this kind of problem, "Mediator". Is One of famous GoF design pattern

Daniele Teti
I've been using mediator back when I didn't even know it was called Mediator. It's one of those patterns that comes naturally. +1
fingerprint211b
Thanks for this hint. I am going to focus on that pattern and try use it. I will let you know.
sznury