ondrej-kvasnovsky/grails-vaadin-plugin — pull request #46 by stephangrundner (2014-12-13 12:28:05+00:00)
Title: Fixed twice registered UIProvider

## Example
* Disable mapping in VaadinConfig.groovy

// mapping = [
// "/*": "app.MyUI"
// ]

* Create the following three Groovy classes

### DemoUI.groovy
@VaadinUI(path = "/demo")
class DemoUI extends UI {

@Override
protected void init(VaadinRequest vaadinRequest) { }
}

### DemoView.groovy
@VaadinView(path = "demo", ui = DemoUI)
class DemoView extends CustomComponent implements View {

@Override
void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {
def layout = new VerticalLayout()
layout.setMargin(true)
layout.setSpacing(true)
layout.addComponent(new Label(value: "View Nr. 1", styleName: "h1"))
layout.addComponent(new Button("Go forward", new Button.ClickListener() {
@Override
void buttonClick(Button.ClickEvent clickEvent) {
Views.enter(Demo2View)
}
}))
compositionRoot = layout
Page.current.setTitle("Demo View Nr. 1")
}
}

### Demo2View.groovy
@VaadinView(path = "demo2", ui = DemoUI)
class Demo2View extends CustomComponent implements View {

@Override
void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {
def layout = new VerticalLayout()
layout.setMargin(true)
layout.setSpacing(true)
layout.addComponent(new Label(value: "View Nr. 2", styleName: "h1"))
def paramField = new TextField("Some parameter")
layout.addComponent(paramField)
layout.addComponent(new Button("Go back", new Button.ClickListener() {
@Override
void buttonClick(Button.ClickEvent clickEvent) {
Views.enter(DemoView, [someparam: paramField.value])
}
}))
compositionRoot = layout
Page.current.setTitle("Demo View Nr. 2")
}
}