Currently I'm  working on an basic application that has a 'tutorial mode'. Initially hints (bubbles with text) will be displayed above various ui elements, explaining how they work. Currently I have a main view which contains a hint object that can be updated (position, text, etc.) and I'm dispatching update events from the various views that need to display a hint. In most cases when the user click a hint, it disappears, but there are a few situations when the user must perform another action(like dragging-dropping an element, clicking another,etc.) to progress.Phew, that's the background in a nutshell. My main question is: Should there be dispatching events from various views and handle the hints centrally or should hints only be handled locally within each view ?What's the recommended approach ?
How to deal with hints/tutorial mode?
object oriented;gui
I'd suggest having hints dealt with in their own class, including body of the hint (so you can change it). To call it, just add one line of code, like: if ( hintsOn ) { HintHandeler.display ( ); }The less the call to the hints needs to know, the better. Try to have whatever must be dealt with to be dealt with in the Hints classTo find out where the HintHandeler call came from, make use of: Thread.currentThread().getStackTrace(), and lex it as needed to find out where you came from. Ideally, store that in a variable, then have a massive switch{} statement, if possible (for speed), go down the list of places a call might be made from, and call additional code as necessary.