summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2015-01-09 19:43:08 +0200
committerLeif Åstrand <leif@vaadin.com>2015-01-09 19:43:08 +0200
commit93c56ee184f6ca3af06607e55166a75ab6719504 (patch)
tree489af345615a87640f0e3d26d430d9e5afef0f19
parentbf8836bb561e834b8a58bc5075b2d1732217a5d6 (diff)
downloadvaadin-framework-93c56ee184f6ca3af06607e55166a75ab6719504.tar.gz
vaadin-framework-93c56ee184f6ca3af06607e55166a75ab6719504.zip
Get rid of WidgetUtil.getSimpleName (#15544)
Change-Id: I345938e5e2196bbc8438b3401879507994b3b050
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java10
-rw-r--r--client/src/com/vaadin/client/LayoutManager.java14
-rw-r--r--client/src/com/vaadin/client/SuperDevMode.java2
-rw-r--r--client/src/com/vaadin/client/Util.java7
-rw-r--r--client/src/com/vaadin/client/WidgetUtil.java9
-rw-r--r--client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java12
-rw-r--r--client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java3
-rw-r--r--client/src/com/vaadin/client/connectors/AbstractRendererConnector.java5
-rw-r--r--client/src/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java15
-rw-r--r--client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java8
-rw-r--r--client/src/com/vaadin/client/ui/AbstractComponentConnector.java7
-rw-r--r--client/src/com/vaadin/client/ui/AbstractConnector.java13
-rw-r--r--client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java3
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java5
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java3
15 files changed, 53 insertions, 63 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index cf47b7d3a6..82723a0551 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -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");
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java
index 4a2b34a539..893a57298f 100644
--- a/client/src/com/vaadin/client/LayoutManager.java
+++ b/client/src/com/vaadin/client/LayoutManager.java
@@ -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);
}
diff --git a/client/src/com/vaadin/client/SuperDevMode.java b/client/src/com/vaadin/client/SuperDevMode.java
index e1ffbbe94d..821af6075a 100644
--- a/client/src/com/vaadin/client/SuperDevMode.java
+++ b/client/src/com/vaadin/client/SuperDevMode.java
@@ -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();
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java
index 7885be5d68..ee3e8a5781 100644
--- a/client/src/com/vaadin/client/Util.java
+++ b/client/src/com/vaadin/client/Util.java
@@ -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
diff --git a/client/src/com/vaadin/client/WidgetUtil.java b/client/src/com/vaadin/client/WidgetUtil.java
index 2562f8f5ba..e05155d440 100644
--- a/client/src/com/vaadin/client/WidgetUtil.java
+++ b/client/src/com/vaadin/client/WidgetUtil.java
@@ -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);
diff --git a/client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java b/client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
index 2d374d3ee7..16f21d5d66 100644
--- a/client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
+++ b/client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
@@ -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)) {
diff --git a/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java b/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
index 1cc12a0ce2..ea0fd2042e 100644
--- a/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
+++ b/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
@@ -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");
diff --git a/client/src/com/vaadin/client/connectors/AbstractRendererConnector.java b/client/src/com/vaadin/client/connectors/AbstractRendererConnector.java
index 6f717d41ef..f7e3c15ac8 100644
--- a/client/src/com/vaadin/client/connectors/AbstractRendererConnector.java
+++ b/client/src/com/vaadin/client/connectors/AbstractRendererConnector.java
@@ -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);
diff --git a/client/src/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java b/client/src/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java
index 56bff25f6b..fc9f3856b5 100644
--- a/client/src/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java
+++ b/client/src/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java
@@ -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) {
diff --git a/client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java b/client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
index 45cfe24c0d..0856bb3575 100644
--- a/client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
+++ b/client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
@@ -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: "
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index 17be098a58..4ac8ee11a8 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -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;
diff --git a/client/src/com/vaadin/client/ui/AbstractConnector.java b/client/src/com/vaadin/client/ui/AbstractConnector.java
index a3038058ed..a20c3463c2 100644
--- a/client/src/com/vaadin/client/ui/AbstractConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractConnector.java
@@ -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);
}
diff --git a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
index a8b6b9b0ce..da3aed4bbc 100644
--- a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
+++ b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
@@ -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() + ")";
}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java
index 18852f51c7..86c918536f 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java
@@ -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);
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java
index a6d9291873..7a93f5e360 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java
@@ -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);
}
});