diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java | 51 | ||||
-rw-r--r-- | client/src/com/vaadin/client/metadata/Type.java | 17 |
2 files changed, 59 insertions, 9 deletions
diff --git a/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java b/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java index 7d2078061e..846bfd4671 100644 --- a/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java +++ b/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 Vaadin Ltd. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -15,13 +15,35 @@ */ package com.vaadin.client.metadata; +import java.util.ArrayList; import java.util.List; import com.google.gwt.core.shared.GWT; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.ApplicationConfiguration; import com.vaadin.client.FastStringMap; import com.vaadin.client.metadata.AsyncBundleLoader.State; +import com.vaadin.client.ui.VNotification; +import com.vaadin.shared.Position; public abstract class ConnectorBundleLoader { + + public static class CValUiInfo { + public final String widgetset; + public final String product; + public final String version; + public final String type; + + public CValUiInfo(String product, String version, String widgetset, + String type) { + this.product = product; + this.version = version; + this.widgetset = widgetset; + this.type = type; + } + } + public static final String EAGER_BUNDLE_NAME = "__eager"; public static final String DEFERRED_BUNDLE_NAME = "__deferred"; @@ -113,4 +135,27 @@ public abstract class ConnectorBundleLoader { public abstract void init(); + protected List<CValUiInfo> cvals = new ArrayList<CValUiInfo>(); + + public void cval(String typeName) { + if (!cvals.isEmpty()) { + String msg = ""; + for (CValUiInfo c : cvals) { + String ns = c.widgetset.replaceFirst("\\.[^\\.]+$", ""); + if (typeName.startsWith(ns)) { + cvals.remove(c); + msg += c.product + " " + c.version + "<br/>"; + } + } + if (!msg.isEmpty()) { + // We need a widget for using VNotification, using the + // context-menu parent. Is there an easy way? + Widget w = ApplicationConfiguration.getRunningApplications() + .get(0).getContextMenu().getParent(); + VNotification n = VNotification.createNotification(0, w); + n.setWidget(new HTML("Using Evaluation License of:<br/>" + msg)); + n.show(Position.BOTTOM_RIGHT); + } + } + } } diff --git a/client/src/com/vaadin/client/metadata/Type.java b/client/src/com/vaadin/client/metadata/Type.java index cc185dff96..15617ffe3c 100644 --- a/client/src/com/vaadin/client/metadata/Type.java +++ b/client/src/com/vaadin/client/metadata/Type.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 Vaadin Ltd. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -19,6 +19,7 @@ import java.util.Collection; import com.google.gwt.core.client.JsArrayString; import com.vaadin.client.JsArrayObject; +import com.vaadin.client.ServerConnector; import com.vaadin.client.communication.JSONSerializer; public class Type { @@ -47,7 +48,11 @@ public class Type { public Object createInstance() throws NoDataException { Invoker invoker = TypeDataStore.getConstructor(this); - return invoker.invoke(null); + Object ret = invoker.invoke(null); + if (ret instanceof ServerConnector) { + ConnectorBundleLoader.get().cval(name); + } + return ret; } public Method getMethod(String name) { @@ -57,7 +62,7 @@ public class Type { /** * @return * @throws NoDataException - * + * * @deprecated As of 7.0.1, use {@link #getPropertiesAsArray()} instead for * improved performance */ @@ -96,7 +101,7 @@ public class Type { * returned string may change without notice and should not be used for any * other purpose than identification. The signature is currently based on * the fully qualified name of the type. - * + * * @return the unique signature of this type */ public String getSignature() { |