diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-08-26 14:53:46 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-08-30 13:04:57 +0300 |
commit | d40910015746be496ba1ded4c12a019d801adb5e (patch) | |
tree | 608d951758d25098cb6d6e9e5f71f197e9bd5f77 /client-compiler/src | |
parent | 51b27217e21e99b059c178afb497ffd7a52e91af (diff) | |
download | vaadin-framework-d40910015746be496ba1ded4c12a019d801adb5e.tar.gz vaadin-framework-d40910015746be496ba1ded4c12a019d801adb5e.zip |
Duplicate client-side of the Vaadin 7 Grid
Change-Id: I069df183806937c2d97eb3e9c8a073ef53ab5c24
Diffstat (limited to 'client-compiler/src')
2 files changed, 37 insertions, 10 deletions
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java index cbc15b3792..f26aa14ead 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java @@ -57,6 +57,8 @@ import elemental.json.JsonValue; public class ConnectorBundle { private static final String FAIL_IF_NOT_SERIALIZABLE = "vFailIfNotSerializable"; + static final String OLD_RENDERER_CONNECTOR_NAME = "com.vaadin.v7.client.connectors.AbstractRendererConnector"; + public static final Comparator<JClassType> jClassComparator = new Comparator<JClassType>() { @Override public int compare(JClassType o1, JClassType o2) { @@ -475,8 +477,7 @@ public class ConnectorBundle { } public static boolean isConnectedRendererConnector(JClassType type) { - return isConnected(type) - && isType(type, AbstractRendererConnector.class); + return isConnected(type) && isRendererType(type); } private static boolean isInterfaceType(JClassType type, Class<?> class1) { @@ -492,6 +493,22 @@ public class ConnectorBundle { } } + private static boolean isRendererType(JClassType type) { + TypeOracle oracle = type.getOracle(); + boolean isNew = false, isOld = false; + try { + isNew = oracle.getType(AbstractRendererConnector.class.getName()) + .isAssignableFrom(type); + } catch (NotFoundException e) { + } + try { + isOld = oracle.getType(OLD_RENDERER_CONNECTOR_NAME) + .isAssignableFrom(type); + } catch (NotFoundException e) { + } + return isNew || isOld; + } + public void setNeedsInvoker(JClassType type, JMethod method) { if (!isNeedsInvoker(type, method)) { addMapping(needsInvoker, type, method); diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java index 9305758b02..68993324c4 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java @@ -61,13 +61,15 @@ public class RendererVisitor extends TypeVisitor { .findInheritedMethod(type, "createRenderer").getEnclosingType(); // Needs GWT constructor if createRenderer is not overridden - if (createRendererClass.getQualifiedSourceName() - .equals(AbstractRendererConnector.class.getCanonicalName())) { + String connectorSrcName = createRendererClass.getQualifiedSourceName(); + + if (isAbstractRendererConnector(connectorSrcName)) { // createRenderer not overridden JMethod getRenderer = ConnectorBundle.findInheritedMethod(type, "getRenderer"); - if (getRenderer.getEnclosingType().getQualifiedSourceName().equals( - AbstractRendererConnector.class.getCanonicalName())) { + String rendererSrcName = getRenderer.getEnclosingType() + .getQualifiedSourceName(); + if (isAbstractRendererConnector(rendererSrcName)) { // getRenderer not overridden logger.log(Type.ERROR, type.getQualifiedSourceName() + " must override either createRenderer or getRenderer"); @@ -108,8 +110,9 @@ public class RendererVisitor extends TypeVisitor { throw new NotFoundException(); } - return !decodeMethod.getEnclosingType().getQualifiedSourceName() - .equals(AbstractRendererConnector.class.getName()); + String decodeSrcName = decodeMethod.getEnclosingType() + .getQualifiedSourceName(); + return !isAbstractRendererConnector(decodeSrcName); } catch (NotFoundException e) { logger.log(Type.ERROR, "Can't find decode method for renderer " + type, e); @@ -121,8 +124,8 @@ public class RendererVisitor extends TypeVisitor { throws UnableToCompleteException { JClassType originalType = type; while (type != null) { - if (type.getQualifiedBinaryName() - .equals(AbstractRendererConnector.class.getName())) { + String typeBinName = type.getQualifiedBinaryName(); + if (isAbstractRendererConnector(typeBinName)) { JParameterizedType parameterized = type.isParameterized(); if (parameterized == null) { logger.log(Type.ERROR, type.getQualifiedSourceName() @@ -138,4 +141,11 @@ public class RendererVisitor extends TypeVisitor { + originalType.getQualifiedSourceName() + " does not extend " + AbstractRendererConnector.class.getName()); } + + private static boolean isAbstractRendererConnector(String connectorSrcName) { + return connectorSrcName + .equals(AbstractRendererConnector.class.getName()) + || connectorSrcName + .equals(ConnectorBundle.OLD_RENDERER_CONNECTOR_NAME); + } } |