How do I easily show/hide views in Griffon

First: I'm shocked that I have to ask this question. Nowhere in the docs is it explained how the new "WindowManager" should be used... I've been hacking around some hours around this and I still dont have an satistactionary way of doing something as trivial as this:

def vName = 'Error'
if (!app.views[vName]) { //I just want to create it once, otherwise I'd just change it's model and want to show() it!
  buildMVCGroup(vName, vName, errorCode: 500, message: "fail detected ;-)") //ok, this indeed shows the idem (as it's an "frame(/**/show: true,/*...*/", but I dont want to create it each time
}

//    app.windowManager.show(app.views.Error) //fails, show() want's an Window, and app.views.Error is of ErrorView type
//    app.views.Error.visible = true //won't display the view
//    app.views.Error.show() // there is no such method

I'd also need an nice way to hide, something like:

//in controller
def view
def hideAction = {
  //view.hide() //fails, no such method...
}

Another way that would make me happy, is an easy way to "when user clicks OK (in the ErrorView", dispose of this MVCGroup. I have been searching and reading the examples quite some time today, yet still can't figure out how to code such easy application flow hmm...

Many thanks in advance for any idea on how to do this, cheers

5
задан skaffman 5 December 2010 в 13:16
поделиться