Hi,
I have an interface comprising of several tabs which are individually
enabled/disabled depending on the state of the application.
Currently tab-state depends on various properties. For example...
* is there a selected entity
* is searchMode enabled
* is the selectedEntity in state 1, 2 or 3 (...assuming there is a
selectedEntity)
As you can imagine, a tab's enabled state can depend on combinations
of the above properties, and combinations can change multiple tabs -
e.g.
if (searchModeEnabled && entityState==3){
enableSearchTab();
disableDetailsTab();
}else if ...
To get everything up and running quickly I used nested conditional
statements which is just about maintainable, but now it's time to
refactor and I'm looking for the cleanest possible way to manage this.
Perhaps there is a design pattern someone can recommend which is
suited to this kind of management, else perhaps someone can offer some
general guidelines.
I have come up with a few possibilities but none that I am completely
satisfied with so I'm looking for some help.
Cheers