How to easily show / hide views in Griffon

First: I'm shocked that I have to ask this question. Nowhere in the docs does it explain how to use the new "WindowManager" ... I've been cheating around this for hours, and I still don't have a satismassive way to do 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 model and want to show() it!
  buildMVCGroup(vName, vName, errorCode: 500, message: "fail detected ;-)") //ok, this indeed shows the idem (as it an "frame(/**/show: true,/*...*/", but I dont want to create it each time
}

//    app.windowManager.show(app.views.Error) //fails, show() want 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 also need a good way to hide something like:

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

Another way that makes me happy is the easy way, “when the user clicks OK (in the“ ErrorView ”, deletes this MVCGroup. I’ve been searching and reading examples for a long time, but still can’t figure out how to encode such a simple application stream hmm ...

Thanks so much in advance for any idea on how to do this, greetings

+5
4

, :

application(/**/){
  //...
  myError = dialog(/**/){
    //thats my error window
  }
}

:

view.myError.visible = true

, , " ": -)

+1

- ...

,

application(name: 'login', ...

app.windowManager.hide(app.windowManager.findWindow('login')) app.windowManager.show(app.windowManager.findWindow('workspace'))

... , , / ...

. , , , - " , ".

+4

. setVisible, JComponents.

show()/hide() Groovy/Griffon, - J2SE, .

+2

Another option is to use CardLayout for each screen that you want to display. Then you can easily show / hide screens. This, combined with MigLayout for individual cards, works very well.

0
source

All Articles