tags:

views:

33

answers:

1

Here's my problem. I have a somewhat complex domain object, which, depending on its state, responds to certain actions. I think the state pattern is pretty much the solution for that. However, I need to display which actions are possible at any moment in the UI.

Ex: The domain object is an audio player. Some songs can't be skipped (like ads), so I need to disable the "next" and "previous" buttons in the GUI so the user have some kind of feedback of which action he can execute.

I've looked at Swing's Action class (note: this is not a Java project), but I think I would need to keep every Actions in my domain object class (audio player), so it can enable or disable them depending on its own state (thus, affecting the UI).

Is it the way to do it?

A: 

The way I would do this in C#-winforms is by binding the Enabled property of the control to some property in the business object. Control.DataBinding.Add("Enabled", , "property of BO")

P.K