/* 
@VaadinApache2LicenseForJavaFiles@
 */

package com.vaadin.tests.minitutorials.v7a1;

import com.vaadin.Application;
import com.vaadin.terminal.WrappedRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Root;

/**
 * Mini tutorial code for
 * https://vaadin.com/wiki/-/wiki/Main/Finding%20the%20current
 * %20Root%20and%20Application
 * 
 * @author Vaadin Ltd
 * @version @VERSION@
 * @since 7.0.0
 */
public class FindCurrentRootAndApplication extends Root {

    @Override
    protected void init(WrappedRequest request) {
        Button helloButton = new Button("Say Hello");
        helloButton.addListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                String msg = "Running in ";
                msg += Application.getCurrent().isProductionMode() ? "production"
                        : "debug";
                msg += " mode in a Root with the caption "
                        + Root.getCurrent().getCaption();

                Notification.show(msg);
            }
        });

        addComponent(helloButton);
    }

}

@@ -992,51 +992,34 @@
     
-msg += %22 mode in a Root with the 
+Notifi
 ca
-p
 tion
- %22%0A
+.show(msg);%0A  
     
@@ -1020,32 +1020,34 @@
             
+%7D%0A
         
       + Root
@@ -1038,86 +1038,243 @@
     
-      + Root.getCurrent().getCaption();%0A%0A                Notification.show(msg
+%7D);%0A%0A        helloButton.addListener(new ClickListener() %7B%0A            public void buttonClick(ClickEvent event) %7B%0A                Notification.show(%22This Root is %22%0A                        + Root.getCurrent().getClass().getSimpleName()
 );%0A 

Update mini tutorial to actually use Root.getCurrent()