]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix compile errors and one failed test caused by merging
authorLeif Åstrand <leif@vaadin.com>
Thu, 8 Dec 2011 15:00:10 +0000 (17:00 +0200)
committerLeif Åstrand <leif@vaadin.com>
Thu, 8 Dec 2011 15:00:10 +0000 (17:00 +0200)
src/com/vaadin/ui/Root.java
tests/server-side/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
tests/testbench/com/vaadin/tests/components/customfield/AddressFormExample.java
tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java

index 03bb1023ac6db00d7c0c9aa65730bf74b6337d91..94d29ffebd5fa5becbf3579899fa2b8c5d503072 100644 (file)
@@ -813,7 +813,7 @@ public class Root extends AbstractComponentContainer implements
     @Deprecated
     public void addComponent(Component c) {
         // Use the thread local as the instance field might not yet be inited
-        if (Application.getCurrentApplication() instanceof Application.LegacyApplication) {
+        if (isLegacyApplication()) {
             getContent().addComponent(c);
         } else {
             throw new UnsupportedOperationException(
@@ -821,6 +821,11 @@ public class Root extends AbstractComponentContainer implements
         }
     }
 
+    private boolean isLegacyApplication() {
+        return Application.getCurrentApplication() instanceof Application.LegacyApplication
+                || getApplication() instanceof Application.LegacyApplication;
+    }
+
     /**
      * <b>Removing a component from a root is generally not supported.</b> To
      * maintain backwards compatibility, removing components is still supported
@@ -836,7 +841,7 @@ public class Root extends AbstractComponentContainer implements
     @Deprecated
     public void removeComponent(Component c) {
         // Use the thread local as the instance field might not yet be inited
-        if (Application.getCurrentApplication() instanceof Application.LegacyApplication) {
+        if (isLegacyApplication()) {
             getContent().removeComponent(c);
         } else {
             throw new UnsupportedOperationException(
@@ -859,7 +864,7 @@ public class Root extends AbstractComponentContainer implements
     @Deprecated
     public void removeAllComponents() {
         // Use the thread local as the instance field might not yet be inited
-        if (Application.getCurrentApplication() instanceof Application.LegacyApplication) {
+        if (isLegacyApplication()) {
             getContent().removeAllComponents();
         } else {
             throw new UnsupportedOperationException(
index c86b6cbcaaef197e86dd178013f3b396a4a87488..5751dca794e1dfb528c3bfc97b55db3eba2c93ed 100644 (file)
@@ -11,8 +11,8 @@ import com.vaadin.tests.data.bean.Address;
 import com.vaadin.tests.data.bean.Country;\r
 import com.vaadin.tests.data.bean.Person;\r
 import com.vaadin.tests.data.bean.Sex;\r
+import com.vaadin.ui.Root;\r
 import com.vaadin.ui.TextField;\r
-import com.vaadin.ui.Window;\r
 \r
 public class DefaultConverterFactory extends TestCase {\r
 \r
@@ -27,14 +27,14 @@ public class DefaultConverterFactory extends TestCase {
     }\r
 \r
     public void testDefaultNumberConversion() {\r
-        Application app = new Application() {\r
+        Application.LegacyApplication app = new Application.LegacyApplication() {\r
 \r
             @Override\r
             public void init() {\r
             }\r
 \r
         };\r
-        app.setMainWindow(new Window());\r
+        app.setMainWindow(new Root());\r
 \r
         TextField tf = new TextField();\r
         app.getMainWindow().addComponent(tf);\r
index 5386a404b4488a3efd7bace52915778f2038c1b9..f3f31d6d5d8130014532f5ee4c694c50a5b13089 100644 (file)
@@ -23,7 +23,7 @@ public class AddressFormExample extends TestBase {
             public void buttonClick(ClickEvent event) {\r
                 field.commit();\r
                 Address address = field.getValue();\r
-                field.getWindow().showNotification(\r
+                field.getRoot().showNotification(\r
                         "Address saved: " + address.getStreetAddress() + ", "\r
                                 + address.getPostalCode() + ", "\r
                                 + address.getCity());\r
index d53a38ed4ec49ebdef9f5c20704e163d13a52712..aaaeeeb64f3ed652429e2e167ad6d61d1da16098 100644 (file)
@@ -62,7 +62,7 @@ public class BooleanFieldExample extends TestBase {
         Button submit = new Button("Submit", new ClickListener() {\r
             public void buttonClick(ClickEvent event) {\r
                 form.commit();\r
-                layout.getWindow()\r
+                layout.getRoot()\r
                         .showNotification(\r
                                 "The custom boolean field value is "\r
                                         + data.isCustom()\r