]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add refresh method to mini tutorial code
authorLeif Åstrand <leif@vaadin.com>
Wed, 14 May 2014 11:15:15 +0000 (14:15 +0300)
committerVaadin Code Review <review@vaadin.com>
Thu, 15 May 2014 10:24:10 +0000 (10:24 +0000)
Change-Id: I7d2e00b13d2d0b3e3b0e3c20dd431c77721e7d91

uitest/src/com/vaadin/tests/minitutorials/v7a1/CreatingPreserveState.java

index 6a246a17334f3d3b147c3c7e37095a7e4a76a000..952cf8c68124e99d8e4f456040ec20914b3d4cfc 100644 (file)
@@ -19,6 +19,7 @@ package com.vaadin.tests.minitutorials.v7a1;
 import com.vaadin.annotations.PreserveOnRefresh;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
 import com.vaadin.ui.TextField;
 import com.vaadin.ui.UI;
 
@@ -34,10 +35,20 @@ import com.vaadin.ui.UI;
 public class CreatingPreserveState extends UI {
     private static int instanceCounter = 0;
 
+    private final CssLayout content = new CssLayout();
+
     @Override
     public void init(VaadinRequest request) {
         TextField tf = new TextField("Instance #" + (++instanceCounter));
         tf.setImmediate(true);
-        setContent(new CssLayout(tf));
+
+        content.addComponent(tf);
+        setContent(content);
+    }
+
+    @Override
+    protected void refresh(VaadinRequest request) {
+        content.addComponent(new Label("UI was refreshed @"
+                + System.currentTimeMillis()));
     }
 }