]> source.dussan.org Git - vaadin-framework.git/commitdiff
Rename setCurrentXyz() to setCurrent() (#9029)
authorLeif Åstrand <leif@vaadin.com>
Mon, 25 Jun 2012 13:07:03 +0000 (16:07 +0300)
committerLeif Åstrand <leif@vaadin.com>
Mon, 25 Jun 2012 13:07:03 +0000 (16:07 +0300)
21 files changed:
src/com/vaadin/Application.java
src/com/vaadin/data/util/converter/ConverterUtil.java
src/com/vaadin/terminal/CombinedRequest.java
src/com/vaadin/terminal/Page.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
src/com/vaadin/terminal/gwt/server/WrappedHttpServletRequest.java
src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java
src/com/vaadin/ui/Component.java
src/com/vaadin/ui/Root.java
tests/server-side/com/vaadin/tests/data/converter/ConverterFactory.java
tests/server-side/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
tests/server-side/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
tests/server-side/com/vaadin/tests/server/component/label/LabelConverters.java
tests/testbench/com/vaadin/tests/TestForWindowOpen.java
tests/testbench/com/vaadin/tests/TestForWindowing.java
tests/testbench/com/vaadin/tests/application/ThreadLocalInstances.java
tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java
tests/testbench/com/vaadin/tests/minitutorials/v7a1/FindCurrentRootAndApplication.java

index 3da314a11ebe7182a2aa9de4fd7d767cfcfe864e..84a8df50535ca0a0e30715ff1f5a7ccfde6742f1 100644 (file)
@@ -2119,11 +2119,11 @@ public class Application implements Terminal.ErrorListener, Serializable {
      * @return the current application instance if available, otherwise
      *         <code>null</code>
      * 
-     * @see #setCurrentApplication(Application)
+     * @see #setCurrent(Application)
      * 
      * @since 7.0
      */
-    public static Application getCurrentApplication() {
+    public static Application getCurrent() {
         return currentApplication.get();
     }
 
@@ -2139,12 +2139,12 @@ public class Application implements Terminal.ErrorListener, Serializable {
      * 
      * @param application
      * 
-     * @see #getCurrentApplication()
+     * @see #getCurrent()
      * @see ThreadLocal
      * 
      * @since 7.0
      */
-    public static void setCurrentApplication(Application application) {
+    public static void setCurrent(Application application) {
         currentApplication.set(application);
     }
 
@@ -2188,7 +2188,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
      */
     public Root getRootForRequest(WrappedRequest request)
             throws RootRequiresMoreInformationException {
-        Root root = Root.getCurrentRoot();
+        Root root = Root.getCurrent();
         if (root != null) {
             return root;
         }
@@ -2240,7 +2240,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
             }
 
             // Set thread local here so it is available in init
-            Root.setCurrentRoot(root);
+            Root.setCurrent(root);
 
             if (!initedRoots.contains(rootId)) {
                 boolean initRequiresBrowserDetails = isRootPreserved()
index 206295b293abf62ccbc54c786cf84da4cd8e0c1f..7011496ed7301d8055d6fccee258c3d0330dfa2a 100644 (file)
@@ -14,7 +14,7 @@ public class ConverterUtil implements Serializable {
      * Finds a converter that can convert from the given presentation type to
      * the given model type and back. Uses the given application to find a
      * {@link ConverterFactory} or, if application is null, uses the
-     * {@link Application#getCurrentApplication()}.
+     * {@link Application#getCurrent()}.
      * 
      * @param <PRESENTATIONTYPE>
      *            The presentation type
@@ -35,7 +35,7 @@ public class ConverterUtil implements Serializable {
             Class<MODELTYPE> modelType, Application application) {
         Converter<PRESENTATIONTYPE, MODELTYPE> converter = null;
         if (application == null) {
-            application = Application.getCurrentApplication();
+            application = Application.getCurrent();
         }
 
         if (application != null) {
index ccef6d89633853473693d5b0ff85c39196ab753d..abf5e0412a735f76d2d96d60574db1d32bf2e692 100644 (file)
@@ -129,7 +129,7 @@ public class CombinedRequest implements WrappedRequest {
 
             public WebBrowser getWebBrowser() {
                 WebApplicationContext context = (WebApplicationContext) Application
-                        .getCurrentApplication().getContext();
+                        .getCurrent().getContext();
                 return context.getBrowser();
             }
         };
index 8506e17898edf3aadf9ef7fb533c845e65fc1a82..e6d06a837a0d48a4185e6ac157b552ce0110abbd 100644 (file)
@@ -615,7 +615,7 @@ public class Page implements Serializable {
     }
 
     public static Page getCurrent() {
-        Root currentRoot = Root.getCurrentRoot();
+        Root currentRoot = Root.getCurrent();
         if (currentRoot == null) {
             return null;
         }
index b7be6fd394d62e293288f39f4dd0095139b078c3..c2f887674aade310528aa191f8f24ddd90443bba 100644 (file)
@@ -540,7 +540,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
                 if (application == null) {
                     return;
                 }
-                Application.setCurrentApplication(application);
+                Application.setCurrent(application);
 
                 /*
                  * Get or create an application context and an application
@@ -689,8 +689,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
                         }
                     } finally {
-                        Root.setCurrentRoot(null);
-                        Application.setCurrentApplication(null);
+                        Root.setCurrent(null);
+                        Application.setCurrent(null);
 
                         PortletSession session = request
                                 .getPortletSession(false);
index 0e548f61c80127d215be2b236d654c1f1b26414a..9750c0611b19fea23bc8224f24bf8656778c07a4 100644 (file)
@@ -385,7 +385,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
             if (application == null) {
                 return;
             }
-            Application.setCurrentApplication(application);
+            Application.setCurrent(application);
 
             /*
              * Get or create a WebApplicationContext and an ApplicationManager
@@ -477,8 +477,8 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
                                 .onRequestEnd(request, response);
                     }
                 } finally {
-                    Root.setCurrentRoot(null);
-                    Application.setCurrentApplication(null);
+                    Root.setCurrent(null);
+                    Application.setCurrent(null);
 
                     HttpSession session = request.getSession(false);
                     if (session != null) {
index 1ea713b4f6a04b32df3951f461e0a2fb728aa268..e37dfc59af52696b61335b5508ea146a7d5762d3 100644 (file)
@@ -2194,7 +2194,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
 
         // if we do not yet have a currentRoot, it should be initialized
         // shortly, and we should send the initial UIDL
-        boolean sendUIDL = Root.getCurrentRoot() == null;
+        boolean sendUIDL = Root.getCurrent() == null;
 
         try {
             CombinedRequest combinedRequest = new CombinedRequest(request);
index ae1fadd91b9c5f99478acbcce80a9d92dbf92f93..69f033c8cd14d28dc948600e894425dfa3bb59df 100644 (file)
@@ -83,7 +83,7 @@ public abstract class BootstrapHandler implements RequestHandler {
 
         public Root getRoot() {
             if (!rootFetched) {
-                root = Root.getCurrentRoot();
+                root = Root.getCurrent();
                 rootFetched = true;
             }
             return root;
index b6f1a192cba25e3bfad29f6a89945e14b638c534..0774a79990b6b100f7ec1466148efc4c4837c2f7 100644 (file)
@@ -82,7 +82,7 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper
 
             public WebBrowser getWebBrowser() {
                 WebApplicationContext context = (WebApplicationContext) Application
-                        .getCurrentApplication().getContext();
+                        .getCurrent().getContext();
                 return context.getBrowser();
             }
         };
index 3838695aa33cd69f91c5ae0be99a97adf5f5a27a..85d8d5c69c7276504e3d61588866f42e74487652 100644 (file)
@@ -130,7 +130,7 @@ public class WrappedPortletRequest implements WrappedRequest {
 
             public WebBrowser getWebBrowser() {
                 PortletApplicationContext2 context = (PortletApplicationContext2) Application
-                        .getCurrentApplication().getContext();
+                        .getCurrent().getContext();
                 return context.getBrowser();
             }
         };
index 2394d0f307a650c5428935a9edae3aa9fb67a7a3..81e0319880a5ef5f8e1ab87bad82b17df496ebfd 100644 (file)
@@ -520,7 +520,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable {
      * <p>
      * Getting a null value is often a problem in constructors of regular
      * components and in the initializers of custom composite components. A
-     * standard workaround is to use {@link Application#getCurrentApplication()}
+     * standard workaround is to use {@link Application#getCurrent()}
      * to retrieve the application instance that the current request relates to.
      * Another way is to move the problematic initialization to
      * {@link #attach()}, as described in the documentation of the method.
index 37cd646d82dc057e6f0aca215d869a7495e5f805..7ae687be7986f70bd872c5a49c11e45be04cca5f 100644 (file)
@@ -923,10 +923,10 @@ public abstract class Root extends AbstractComponentContainer implements
      * @param root
      *            the root to register as the current root
      * 
-     * @see #getCurrentRoot()
+     * @see #getCurrent()
      * @see ThreadLocal
      */
-    public static void setCurrentRoot(Root root) {
+    public static void setCurrent(Root root) {
         currentRoot.set(root);
     }
 
@@ -938,9 +938,9 @@ public abstract class Root extends AbstractComponentContainer implements
      * @return the current root instance if available, otherwise
      *         <code>null</code>
      * 
-     * @see #setCurrentRoot(Root)
+     * @see #setCurrent(Root)
      */
-    public static Root getCurrentRoot() {
+    public static Root getCurrent() {
         return currentRoot.get();
     }
 
index b97f987ae370034382506b581e723f35e92b4c91..4bd9cf0cf771775f9ee8d82670449e03b67be741 100644 (file)
@@ -49,7 +49,7 @@ public class ConverterFactory extends TestCase {
     }
 
     public void testApplicationConverterFactoryInBackgroundThread() {
-        Application.setCurrentApplication(null);
+        Application.setCurrent(null);
         final Application appWithCustomIntegerConverter = new Application();
         appWithCustomIntegerConverter
                 .setConverterFactory(new ConverterFactory42());
@@ -70,7 +70,7 @@ public class ConverterFactory extends TestCase {
         final Application appWithCustomIntegerConverter = new Application();
         appWithCustomIntegerConverter
                 .setConverterFactory(new ConverterFactory42());
-        Application.setCurrentApplication(appWithCustomIntegerConverter);
+        Application.setCurrent(appWithCustomIntegerConverter);
 
         TextField tf = new TextField("", "123");
         tf.setConverter(Integer.class);
@@ -83,7 +83,7 @@ public class ConverterFactory extends TestCase {
         final Application fieldAppWithCustomIntegerConverter = new Application();
         fieldAppWithCustomIntegerConverter
                 .setConverterFactory(new ConverterFactory42());
-        Application.setCurrentApplication(new Application());
+        Application.setCurrent(new Application());
 
         TextField tf = new TextField("", "123") {
             @Override
index 7305e022ee52366b1f20560890b94eede154f114..446228583ac699af0d07919652fb6f7b94e7ea48 100644 (file)
@@ -175,7 +175,7 @@ public class AbstractFieldValueConversions extends TestCase {
 
     public void testNumberDoubleConverterChange() {
         final Application a = new Application();
-        Application.setCurrentApplication(a);
+        Application.setCurrent(a);
         TextField tf = new TextField() {
             @Override
             public Application getApplication() {
index e39b5d6629575f65942823562fc04ed5dc18d238..25430fc9a50f7b93df0e47340438fd9be0c7dc58 100644 (file)
@@ -27,7 +27,7 @@ public class DefaultConverterFactory extends TestCase {
 
     public void testDefaultNumberConversion() {
         Application app = new Application();
-        Application.setCurrentApplication(app);
+        Application.setCurrent(app);
         TextField tf = new TextField();
         tf.setLocale(new Locale("en", "US"));
         tf.setPropertyDataSource(new MethodProperty<Integer>(paulaBean,
index e79bd8474125102855c1b30e94cd5b6c88b000dc..5ba15cac6c45a05e99c7a106baf708620dfd12bb 100644 (file)
@@ -25,7 +25,7 @@ public class LabelConverters extends TestCase {
     }
 
     public void testIntegerDataSource() {
-        Application.setCurrentApplication(new Application());
+        Application.setCurrent(new Application());
         Label l = new Label("Foo");
         Property ds = new MethodProperty<Integer>(Person.createTestPerson1(),
                 "age");
index 76154f24196ea0eb7ee757585b8335995c77bf85..75395f0d5c7f55e300ab2220d05262bc702fcb9a 100644 (file)
@@ -24,7 +24,7 @@ public class TestForWindowOpen extends CustomComponent {
                     public void buttonClick(ClickEvent event) {
                         final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
-                        Root.getCurrentRoot().getPage().open(r);
+                        Root.getCurrent().getPage().open(r);
 
                     }
 
@@ -36,7 +36,7 @@ public class TestForWindowOpen extends CustomComponent {
                     public void buttonClick(ClickEvent event) {
                         final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
-                        Root.getCurrentRoot().getPage().open(r, "mytarget");
+                        Root.getCurrent().getPage().open(r, "mytarget");
 
                     }
 
@@ -48,7 +48,7 @@ public class TestForWindowOpen extends CustomComponent {
                     public void buttonClick(ClickEvent event) {
                         final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
-                        Root.getCurrentRoot().getPage().open(r, "secondtarget");
+                        Root.getCurrent().getPage().open(r, "secondtarget");
 
                     }
 
index f97ea33d613c3035a697db04da19b89c67f91216..b9e14608f57fba6e5e816594a200ff8ed4be0f42 100644 (file)
@@ -85,7 +85,7 @@ public class TestForWindowing extends CustomComponent {
 
                         w.addComponent(s);
 
-                        Root.getCurrentRoot().addWindow(w);
+                        Root.getCurrent().addWindow(w);
 
                     }
 
index 68a0bb380598db0d1cde742356e7bc6e6de71092..fd65adf209ddccb3075eb953f0776f9a2365ee89 100644 (file)
@@ -16,8 +16,8 @@ import com.vaadin.ui.Root;
 
 public class ThreadLocalInstances extends AbstractTestApplication {
     private static final Application staticInitApplication = Application
-            .getCurrentApplication();
-    private static final Root staticInitRoot = Root.getCurrentRoot();
+            .getCurrent();
+    private static final Root staticInitRoot = Root.getCurrent();
 
     private final Root mainWindow = new Root() {
         boolean paintReported = false;
@@ -92,8 +92,8 @@ public class ThreadLocalInstances extends AbstractTestApplication {
     }
 
     private void reportCurrentStatus(String phase) {
-        reportStatus(phase, Application.getCurrentApplication(),
-                Root.getCurrentRoot());
+        reportStatus(phase, Application.getCurrent(),
+                Root.getCurrent());
     }
 
     private void reportStatus(String phase, Application application, Root root) {
index 72cbcd386eab6fe4e9d56c15549c9fea2d18e863..875d2b1df821e11897e2cc621fe011faea55b35e 100644 (file)
@@ -57,7 +57,7 @@ public abstract class AbstractTestRoot extends Root {
     protected abstract Integer getTicketNumber();
 
     protected WebBrowser getBrowser() {
-        ApplicationContext context = Application.getCurrentApplication()
+        ApplicationContext context = Application.getCurrent()
                 .getContext();
         if (context instanceof AbstractWebApplicationContext) {
             AbstractWebApplicationContext webContext = (AbstractWebApplicationContext) context;
index c6e609c5ee60391ffc6737b04343883fe0b5e85a..b237666caa1e259e0bb11e949bcb7c738ecdb544 100644 (file)
@@ -29,10 +29,10 @@ public class FindCurrentRootAndApplication extends Root {
         helloButton.addListener(new ClickListener() {
             public void buttonClick(ClickEvent event) {
                 String msg = "Running in ";
-                msg += Application.getCurrentApplication().isProductionMode() ? "production"
+                msg += Application.getCurrent().isProductionMode() ? "production"
                         : "debug";
                 msg += " mode in a Root with the caption "
-                        + Root.getCurrentRoot().getCaption();
+                        + Root.getCurrent().getCaption();
 
                 Notification.show(msg);
             }