]> source.dussan.org Git - vaadin-framework.git/commitdiff
Get rid of WidgetUtil.getSimpleName (#15544)
authorLeif Åstrand <leif@vaadin.com>
Fri, 9 Jan 2015 17:43:08 +0000 (19:43 +0200)
committerLeif Åstrand <leif@vaadin.com>
Fri, 9 Jan 2015 17:43:08 +0000 (19:43 +0200)
Change-Id: I345938e5e2196bbc8438b3401879507994b3b050

15 files changed:
client/src/com/vaadin/client/ApplicationConnection.java
client/src/com/vaadin/client/LayoutManager.java
client/src/com/vaadin/client/SuperDevMode.java
client/src/com/vaadin/client/Util.java
client/src/com/vaadin/client/WidgetUtil.java
client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
client/src/com/vaadin/client/connectors/AbstractRendererConnector.java
client/src/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java
client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
client/src/com/vaadin/client/ui/AbstractComponentConnector.java
client/src/com/vaadin/client/ui/AbstractConnector.java
client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java
uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java

index cf47b7d3a6a8a2d2da5047dd10d98ad73b17d391..82723a0551464e6fd0f49b4f653d7a7d40e0cdfa 100644 (file)
@@ -1866,7 +1866,7 @@ public class ApplicationConnection implements HasHandlers {
                 } catch (NoDataException e) {
                     throw new RuntimeException(
                             "Missing data needed to invoke @DelegateToWidget for "
-                                    + WidgetUtil.getSimpleName(component), e);
+                                    + component.getClass().getSimpleName(), e);
                 }
             }
 
@@ -2047,8 +2047,8 @@ public class ApplicationConnection implements HasHandlers {
                             String key = null;
                             if (Profiler.isEnabled()) {
                                 key = "updateFromUIDL for "
-                                        + WidgetUtil
-                                                .getSimpleName(legacyConnector);
+                                        + legacyConnector.getClass()
+                                                .getSimpleName();
                                 Profiler.enter(key);
                             }
 
@@ -2148,7 +2148,7 @@ public class ApplicationConnection implements HasHandlers {
                             Profiler.enter("updateConnectorState inner loop");
                             if (Profiler.isEnabled()) {
                                 Profiler.enter("Decode connector state "
-                                        + WidgetUtil.getSimpleName(connector));
+                                        + connector.getClass().getSimpleName());
                             }
 
                             JavaScriptObject jso = states
@@ -2185,7 +2185,7 @@ public class ApplicationConnection implements HasHandlers {
 
                             if (Profiler.isEnabled()) {
                                 Profiler.leave("Decode connector state "
-                                        + WidgetUtil.getSimpleName(connector));
+                                        + connector.getClass().getSimpleName());
                             }
 
                             Profiler.enter("updateConnectorState create event");
index 4a2b34a53958f5753dcce36be07db33759996e1f..893a57298fd27809e387a87b63f665da458458e5 100644 (file)
@@ -346,8 +346,8 @@ public class LayoutManager {
                                 if (Profiler.isEnabled()) {
                                     Profiler.enter("ElementResizeListener.onElementResize construct profiler key");
                                     key = "ElementResizeListener.onElementResize for "
-                                            + WidgetUtil
-                                                    .getSimpleName(listener);
+                                            + listener.getClass()
+                                                    .getSimpleName();
                                     Profiler.leave("ElementResizeListener.onElementResize construct profiler key");
                                     Profiler.enter(key);
                                 }
@@ -390,7 +390,7 @@ public class LayoutManager {
                             String key = null;
                             if (Profiler.isEnabled()) {
                                 key = "layoutHorizontally() for "
-                                        + WidgetUtil.getSimpleName(cl);
+                                        + cl.getClass().getSimpleName();
                                 Profiler.enter(key);
                             }
 
@@ -413,7 +413,7 @@ public class LayoutManager {
                             String key = null;
                             if (Profiler.isEnabled()) {
                                 key = "layout() for "
-                                        + WidgetUtil.getSimpleName(rr);
+                                        + rr.getClass().getSimpleName();
                                 Profiler.enter(key);
                             }
 
@@ -446,7 +446,7 @@ public class LayoutManager {
                             String key = null;
                             if (Profiler.isEnabled()) {
                                 key = "layoutVertically() for "
-                                        + WidgetUtil.getSimpleName(cl);
+                                        + cl.getClass().getSimpleName();
                                 Profiler.enter(key);
                             }
 
@@ -469,7 +469,7 @@ public class LayoutManager {
                             String key = null;
                             if (Profiler.isEnabled()) {
                                 key = "layout() for "
-                                        + WidgetUtil.getSimpleName(rr);
+                                        + rr.getClass().getSimpleName();
                                 Profiler.enter(key);
                             }
 
@@ -548,7 +548,7 @@ public class LayoutManager {
                 String key = null;
                 if (Profiler.isEnabled()) {
                     key = "layout PostLayoutListener for "
-                            + WidgetUtil.getSimpleName(connector);
+                            + connector.getClass().getSimpleName();
                     Profiler.enter(key);
                 }
 
index e1ffbbe94d5d213205c674a7c899e3234311171d..821af6075a65886b096217e3bc443aae6f0ab4ec 100644 (file)
@@ -89,7 +89,7 @@ public class SuperDevMode {
                         VConsole.error("JSONP compile call failed");
                         // Don't log exception as they are shown as
                         // notifications
-                        VConsole.error(WidgetUtil.getSimpleName(caught) + ": "
+                        VConsole.error(caught.getClass().getSimpleName() + ": "
                                 + caught.getMessage());
                         failed();
 
index 7885be5d68ed31bda6cfac5b4b7706de19f8a625..ee3e8a5781df8fa5c041ae2b839c6420f838dc92 100644 (file)
@@ -236,7 +236,12 @@ public class Util {
 
     @Deprecated
     public static String getSimpleName(Object widget) {
-        return WidgetUtil.getSimpleName(widget);
+        if (widget == null) {
+            return "(null)";
+        }
+
+        String name = widget.getClass().getName();
+        return name.substring(name.lastIndexOf('.') + 1);
     }
 
     @Deprecated
index 2562f8f5ba8f00b61f78bee433067e2c837ec4b1..e05155d4402b4a5c42682954cc521b590a56bdb7 100644 (file)
@@ -384,15 +384,6 @@ public class WidgetUtil {
 
     }
 
-    public static String getSimpleName(Object widget) {
-        if (widget == null) {
-            return "(null)";
-        }
-
-        String name = widget.getClass().getName();
-        return name.substring(name.lastIndexOf('.') + 1);
-    }
-
     public static void setFloat(Element element, String value) {
         if (BrowserInfo.get().isIE()) {
             element.getStyle().setProperty("styleFloat", value);
index 2d374d3ee7039cd30f2c7b68d667f6d8c17d7efc..16f21d5d664f9a7a2c8a679eea8ec74d09b01fce 100644 (file)
@@ -455,7 +455,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
         if (basePath == null) {
             return null;
         }
-        String simpleName = WidgetUtil.getSimpleName(w);
+        String simpleName = w.getClass().getSimpleName();
 
         /*
          * Check if the parent implements Iterable. At least VPopupView does not
@@ -475,7 +475,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
                 return basePath + PARENTCHILD_SEPARATOR + simpleName + "["
                         + pos + "]";
             }
-            String simpleName2 = WidgetUtil.getSimpleName(child);
+            String simpleName2 = child.getClass().getSimpleName();
             if (simpleName.equals(simpleName2)) {
                 pos++;
             }
@@ -606,8 +606,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
                     // the same type before it
                     int nextIndex = 0;
                     for (Widget child : layout) {
-                        boolean matchingType = nextWidgetClassName
-                                .equals(WidgetUtil.getSimpleName(child));
+                        boolean matchingType = nextWidgetClassName.equals(child
+                                .getClass().getSimpleName());
                         if (matchingType && widgetPosition == 0) {
                             // This is the n:th child that we looked for
                             break;
@@ -661,7 +661,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
                 while (iterator.hasNext()) {
 
                     Widget child = iterator.next();
-                    String simpleName2 = WidgetUtil.getSimpleName(child);
+                    String simpleName2 = child.getClass().getSimpleName();
 
                     if (!widgetClassName.equals(simpleName2)
                             && child instanceof Slot) {
@@ -671,7 +671,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
                          * directly checking the stuff inside the slot
                          */
                         child = ((Slot) child).getWidget();
-                        simpleName2 = WidgetUtil.getSimpleName(child);
+                        simpleName2 = child.getClass().getSimpleName();
                     }
 
                     if (widgetClassName.equals(simpleName2)) {
index 1cc12a0ce2651330c4f7cea9f964bf37581e4428..ea0fd2042eb005a0551f22739cf83b4c91a3ff97 100644 (file)
@@ -29,7 +29,6 @@ import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.HasComponentsConnector;
 import com.vaadin.client.Util;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.metadata.Property;
 import com.vaadin.client.metadata.TypeDataStore;
 import com.vaadin.client.ui.AbstractConnector;
@@ -645,7 +644,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
 
         // If the server-side class name didn't match, fall back to testing for
         // the explicit widget name
-        String widget = WidgetUtil.getSimpleName(connector.getWidget());
+        String widget = connector.getWidget().getClass().getSimpleName();
         return widgetName.equals(widget)
                 || widgetName.equals(widget + ".class");
 
index 6f717d41ef3a8ef6a0be9fa5395b16c7e0c7d05f..f7e3c15ac8bae9b7c3afe180d8b5b470cced0db0 100644 (file)
@@ -16,7 +16,6 @@
 package com.vaadin.client.connectors;
 
 import com.vaadin.client.ServerConnector;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.communication.JsonDecoder;
 import com.vaadin.client.extensions.AbstractExtensionConnector;
 import com.vaadin.client.metadata.NoDataException;
@@ -57,7 +56,7 @@ public abstract class AbstractRendererConnector<T> extends
         if (presentationType == null) {
             throw new IllegalStateException(
                     "No presentation type found for "
-                            + WidgetUtil.getSimpleName(this)
+                            + getClass().getSimpleName()
                             + ". This may be caused by some unspecified problem in widgetset compilation.");
         }
     }
@@ -110,7 +109,7 @@ public abstract class AbstractRendererConnector<T> extends
         } catch (NoDataException e) {
             throw new IllegalStateException(
                     "Default implementation of createRenderer() does not work for "
-                            + WidgetUtil.getSimpleName(this)
+                            + getClass().getSimpleName()
                             + ". This might be caused by explicitely using "
                             + "super.createRenderer() or some unspecified "
                             + "problem with the widgetset compilation.", e);
index 56bff25f6b7fcd8af1a2ee6937d83c5ffaff5ddd..fc9f3856b566c2f205c047887a86e99ed3bde2d6 100644 (file)
@@ -40,7 +40,6 @@ import com.vaadin.client.ComputedStyle;
 import com.vaadin.client.ConnectorMap;
 import com.vaadin.client.ServerConnector;
 import com.vaadin.client.SimpleTree;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.ValueMap;
 
 /**
@@ -112,10 +111,12 @@ public class AnalyzeLayoutsPanel extends FlowPanel {
             final ServerConnector parent = connector.getParent();
             final String parentId = parent.getConnectorId();
 
-            final Label errorDetails = new Label(
-                    WidgetUtil.getSimpleName(connector) + "["
-                            + connector.getConnectorId() + "]" + " inside "
-                            + WidgetUtil.getSimpleName(parent));
+            final Label errorDetails = new Label(connector.getClass()
+                    .getSimpleName()
+                    + "["
+                    + connector.getConnectorId()
+                    + "]"
+                    + " inside " + parent.getClass().getSimpleName());
 
             if (parent instanceof ComponentConnector) {
                 final ComponentConnector parentConnector = (ComponentConnector) parent;
@@ -172,8 +173,8 @@ public class AnalyzeLayoutsPanel extends FlowPanel {
 
         Highlight.show(connector);
 
-        final SimpleTree errorNode = new SimpleTree(
-                WidgetUtil.getSimpleName(connector) + " id: " + pid);
+        final SimpleTree errorNode = new SimpleTree(connector.getClass()
+                .getSimpleName() + " id: " + pid);
         errorNode.addDomHandler(new MouseOverHandler() {
             @Override
             public void onMouseOver(MouseOverEvent event) {
index 45cfe24c0d026899afb29d582723ecf9135f0dba..0856bb3575175cb608dd9b799bb89bd9d8a0f800 100644 (file)
@@ -24,8 +24,8 @@ import com.google.gwt.user.client.ui.HTML;
 import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.JsArrayObject;
 import com.vaadin.client.ServerConnector;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.VConsole;
+import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.metadata.NoDataException;
 import com.vaadin.client.metadata.Property;
 import com.vaadin.client.ui.AbstractConnector;
@@ -51,7 +51,7 @@ public class ConnectorInfoPanel extends FlowPanel {
         ignoreProperties.add("id");
 
         String html = getRowHTML("Id", connector.getConnectorId());
-        html += getRowHTML("Connector", WidgetUtil.getSimpleName(connector));
+        html += getRowHTML("Connector", connector.getClass().getSimpleName());
 
         if (connector instanceof ComponentConnector) {
             ComponentConnector component = (ComponentConnector) connector;
@@ -61,8 +61,8 @@ public class ConnectorInfoPanel extends FlowPanel {
 
             AbstractComponentState componentState = component.getState();
 
-            html += getRowHTML("Widget",
-                    WidgetUtil.getSimpleName(component.getWidget()));
+            html += getRowHTML("Widget", component.getWidget().getClass()
+                    .getSimpleName());
             html += getRowHTML("Caption", componentState.caption);
             html += getRowHTML("Description", componentState.description);
             html += getRowHTML("Width", componentState.width + " (actual: "
index 17be098a5810588d1000b6da9a3f3acb24833c1a..4ac8ee11a859f744367309e00bfb314fd6f246f0 100644 (file)
@@ -32,7 +32,6 @@ import com.vaadin.client.TooltipInfo;
 import com.vaadin.client.UIDL;
 import com.vaadin.client.Util;
 import com.vaadin.client.VConsole;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.metadata.NoDataException;
 import com.vaadin.client.metadata.Type;
@@ -90,7 +89,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
         } catch (NoDataException e) {
             throw new IllegalStateException(
                     "Default implementation of createWidget() does not work for "
-                            + WidgetUtil.getSimpleName(this)
+                            + getClass().getSimpleName()
                             + ". This might be caused by explicitely using "
                             + "super.createWidget() or some unspecified "
                             + "problem with the widgetset compilation.", e);
@@ -107,10 +106,10 @@ public abstract class AbstractComponentConnector extends AbstractConnector
     public Widget getWidget() {
         if (widget == null) {
             Profiler.enter("AbstractComponentConnector.createWidget for "
-                    + WidgetUtil.getSimpleName(this));
+                    + getClass().getSimpleName());
             widget = createWidget();
             Profiler.leave("AbstractComponentConnector.createWidget for "
-                    + WidgetUtil.getSimpleName(this));
+                    + getClass().getSimpleName());
         }
 
         return widget;
index a3038058ed0e444e920543ea0619997479845bc9..a20c3463c2aa95adb0689382b3d254e8859d1594 100644 (file)
@@ -34,7 +34,6 @@ import com.vaadin.client.Profiler;
 import com.vaadin.client.ServerConnector;
 import com.vaadin.client.Util;
 import com.vaadin.client.VConsole;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler;
@@ -122,12 +121,12 @@ public abstract class AbstractConnector implements ServerConnector,
         addStateChangeHandler(this);
         if (Profiler.isEnabled()) {
             Profiler.enter("AbstractConnector.init "
-                    + WidgetUtil.getSimpleName(this));
+                    + getClass().getSimpleName());
         }
         init();
         if (Profiler.isEnabled()) {
             Profiler.leave("AbstractConnector.init "
-                    + WidgetUtil.getSimpleName(this));
+                    + getClass().getSimpleName());
         }
         Profiler.leave("AbstractConnector.doInit");
     }
@@ -217,8 +216,8 @@ public abstract class AbstractConnector implements ServerConnector,
     public void fireEvent(GwtEvent<?> event) {
         String profilerKey = null;
         if (Profiler.isEnabled()) {
-            profilerKey = "Fire " + WidgetUtil.getSimpleName(event) + " for "
-                    + WidgetUtil.getSimpleName(this);
+            profilerKey = "Fire " + event.getClass().getSimpleName() + " for "
+                    + getClass().getSimpleName();
             Profiler.enter(profilerKey);
         }
         if (handlerManager != null) {
@@ -380,7 +379,7 @@ public abstract class AbstractConnector implements ServerConnector,
         } catch (NoDataException e) {
             throw new IllegalStateException(
                     "There is no information about the state for "
-                            + WidgetUtil.getSimpleName(this)
+                            + getClass().getSimpleName()
                             + ". Did you remember to compile the right widgetset?",
                     e);
         }
@@ -394,7 +393,7 @@ public abstract class AbstractConnector implements ServerConnector,
         } catch (NoDataException e) {
             throw new IllegalStateException(
                     "There is no information about the state for "
-                            + WidgetUtil.getSimpleName(connector)
+                            + connector.getClass().getSimpleName()
                             + ". Did you remember to compile the right widgetset?",
                     e);
         }
index a8b6b9b0ce3e59e62c218af83c1843dd950fd3bb..da3aed4bbcb829f60b400b976eb848782a81677c 100644 (file)
@@ -30,7 +30,6 @@ import com.vaadin.client.Profiler;
 import com.vaadin.client.ServerConnector;
 import com.vaadin.client.Util;
 import com.vaadin.client.VConsole;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.ui.ManagedLayout;
 import com.vaadin.shared.AbstractComponentState;
 
@@ -587,7 +586,7 @@ public class LayoutDependencyTree {
     }
 
     private static String getCompactConnectorString(ServerConnector connector) {
-        return WidgetUtil.getSimpleName(connector) + " ("
+        return connector.getClass().getSimpleName() + " ("
                 + connector.getConnectorId() + ")";
     }
 
index 18852f51c7f810b2d6c0a32fbec9632be1e5e093..86c918536f4e7ca3ac14f14672c22374743dcd68 100644 (file)
@@ -19,7 +19,6 @@ package com.vaadin.tests.widgetset.client;
 import com.google.gwt.dom.client.DivElement;
 import com.google.gwt.dom.client.Document;
 import com.vaadin.client.ServerConnector;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.extensions.AbstractExtensionConnector;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.tests.extensions.BasicExtension;
@@ -35,8 +34,8 @@ public class BasicExtensionTestConnector extends AbstractExtensionConnector {
     }
 
     private void appendMessage(String action) {
-        String message = WidgetUtil.getSimpleName(this) + action
-                + WidgetUtil.getSimpleName(target);
+        String message = getClass().getSimpleName() + action
+                + target.getClass().getSimpleName();
 
         DivElement element = Document.get().createDivElement();
         element.setInnerText(message);
index a6d929187339326c9cbf84c6ae96faf78f21d8a8..7a93f5e36090b068b958172099284bb68155d633 100644 (file)
@@ -18,7 +18,6 @@ package com.vaadin.tests.widgetset.client;
 
 import com.google.gwt.dom.client.Document;
 import com.google.gwt.dom.client.SpanElement;
-import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.ui.ui.UIConnector;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.ui.UI;
@@ -33,7 +32,7 @@ public class CustomUIConnector extends UIConnector {
             public void test() {
                 SpanElement span = Document.get().createSpanElement();
                 span.setInnerText("This is the "
-                        + WidgetUtil.getSimpleName(CustomUIConnector.this));
+                        + CustomUIConnector.this.getClass().getSimpleName());
                 Document.get().getBody().insertFirst(span);
             }
         });