From 532aad459e007727434f0873c0f2fc0331332567 Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Wed, 3 Jul 2013 19:00:40 +0400 Subject: [PATCH] Legacy portage --- WebContent/WEB-INF/web.xml | 2 +- pom.xml | 170 ++++++++++++++++++ .../vaadin/applet/AbstractVaadinApplet.java | 9 +- src/org/vaadin/applet/AppletIntegration.java | 46 ++--- .../applet/AppletintegrationWidgetset.gwt.xml | 8 +- .../client/ui/AppletIntegrationConnector.java | 26 +++ .../applet/client/ui/VAppletIntegration.java | 28 +-- ...on.java => AppletIntegrationSampleUI.java} | 16 +- 8 files changed, 233 insertions(+), 72 deletions(-) create mode 100644 pom.xml create mode 100644 src/org/vaadin/applet/client/ui/AppletIntegrationConnector.java rename src/org/vaadin/applet/sample/{AppletIntegrationSampleApplication.java => AppletIntegrationSampleUI.java} (69%) diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 08e8a99..976e7f9 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -15,7 +15,7 @@ Vaadin application class to start application - org.vaadin.applet.sample.AppletIntegrationSampleApplication + org.vaadin.applet.sample.AppletIntegrationSampleUI diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7761954 --- /dev/null +++ b/pom.xml @@ -0,0 +1,170 @@ + + + 4.0.0 + com.haulmont.thirdparty + appletintegration + jar + 1.2.9 + Vaadin AppletIntegration Addon + + + UTF-8 + 7.1.0 + ${vaadin.version} + 1.7 + + + + vaadin-addons + http://maven.vaadin.com/vaadin-addons + + + vaadin-snapshots + http://oss.sonatype.org/content/repositories/vaadin-snapshots/ + + false + + + true + + + + + + vaadin-snapshots + http://oss.sonatype.org/content/repositories/vaadin-snapshots/ + + false + + + true + + + + + + com.vaadin + vaadin-server + ${vaadin.version} + + + com.vaadin + vaadin-client-compiled + ${vaadin.version} + + + com.vaadin + vaadin-client + ${vaadin.version} + provided + + + com.vaadin + vaadin-themes + ${vaadin.version} + + + javax.servlet + servlet-api + 2.4 + provided + + + + + src + + + src + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${jdkVersion} + ${jdkVersion} + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + WebContent/META-INF/MANIFEST.MF + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + verify + + jar-no-fork + + + + + + maven-clean-plugin + 2.4.1 + + + + ${basedir}/WebContent/VAADIN/widgetsets + + + + + + com.vaadin + vaadin-maven-plugin + ${vaadin.plugin.version} + + -Xmx512M -Xss1024k + ${basedir}/WebContent/VAADIN/widgetsets + + ${basedir}/WebContent/VAADIN/widgetsets + + true + false + true + + true + http://localhost:8080/ + + + + + + + resources + update-widgetset + compile + + + + + + org.mortbay.jetty + maven-jetty-plugin + + ${basedir}/WebContent + + + ${basedir}/WebContent + + + + + + + diff --git a/src/org/vaadin/applet/AbstractVaadinApplet.java b/src/org/vaadin/applet/AbstractVaadinApplet.java index 70b2fec..9e18b22 100644 --- a/src/org/vaadin/applet/AbstractVaadinApplet.java +++ b/src/org/vaadin/applet/AbstractVaadinApplet.java @@ -5,8 +5,6 @@ import java.lang.reflect.Method; import java.util.Locale; -import com.vaadin.terminal.StreamVariable; - /** * This class can be used as base to implement Java Applets that integrate to * Vaadin application. @@ -78,7 +76,7 @@ private void setAction(String submitAction) { * Submit actionUrl can be used to post multipart data * back to the Vaadin server-side application. * - * Note: This is not by the AppletIntegration automatically. It must be subclassed and a variable named "actionUrl" must be added to paintContent pointing to the {@link StreamVariable}. + * Note: This is not by the AppletIntegration automatically. It must be subclassed and a variable named "actionUrl" must be added to paintContent pointing to the {@link com.vaadin.server.StreamVariable}. * * @return */ @@ -89,7 +87,7 @@ protected String getActionUrl() { /** * Set the id of the applet in DOM. * - * @param paintableId + * @param appletId */ private void setAppletId(String appletId) { this.appletId = appletId; @@ -128,7 +126,7 @@ protected String getPaintableId() { /** * Set the application session cookie. Called from init. * - * @param appUrl + * @param appSessionCookie */ private void setApplicationSessionCookie(String appSessionCookie) { sessionCookie = appSessionCookie; @@ -488,7 +486,6 @@ public boolean isDebug() { * second thread (with applet's permission) to execute the command. * * @param command - * @param params */ public void execute(String command) { execute(command, null); diff --git a/src/org/vaadin/applet/AppletIntegration.java b/src/org/vaadin/applet/AppletIntegration.java index 9b26fdd..8a58190 100644 --- a/src/org/vaadin/applet/AppletIntegration.java +++ b/src/org/vaadin/applet/AppletIntegration.java @@ -1,25 +1,21 @@ package org.vaadin.applet; +import com.vaadin.server.PaintException; +import com.vaadin.server.PaintTarget; +import com.vaadin.server.VaadinSession; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.LegacyComponent; +import org.vaadin.applet.client.ui.VAppletIntegration; + import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.vaadin.applet.client.ui.VAppletIntegration; - -import com.vaadin.Application; -import com.vaadin.service.ApplicationContext; -import com.vaadin.terminal.PaintException; -import com.vaadin.terminal.PaintTarget; -import com.vaadin.terminal.gwt.server.PortletApplicationContext; -import com.vaadin.terminal.gwt.server.WebApplicationContext; -import com.vaadin.ui.AbstractComponent; - /** * Server side component for the VAppletIntegration widget. */ -@com.vaadin.ui.ClientWidget(org.vaadin.applet.client.ui.VAppletIntegration.class) -public class AppletIntegration extends AbstractComponent { +public class AppletIntegration extends AbstractComponent implements LegacyComponent { private static final long serialVersionUID = 6061722679712017720L; @@ -34,7 +30,6 @@ public class AppletIntegration extends AbstractComponent { @Override public void paintContent(PaintTarget target) throws PaintException { - super.paintContent(target); // Applet class if (appletClass == null) { @@ -94,16 +89,7 @@ public void paintContent(PaintTarget target) throws PaintException { * @return */ protected String getHttpSessionId() { - Application app = getApplication(); - if (app != null) { - ApplicationContext ctx = app.getContext(); - if (ctx instanceof WebApplicationContext) { - return ((WebApplicationContext)ctx).getHttpSession().getId(); - } else if (ctx instanceof PortletApplicationContext) { - return ((PortletApplicationContext)ctx).getHttpSession().getId(); - } - } - return ""; + return VaadinSession.getCurrent().getSession().getId(); } /** @@ -146,8 +132,6 @@ protected void setAppletClass(String appletClass) { * * This method is protected so that overriding classes can publish it if * needed. - * - * @param appletClass */ protected String getAppletClass() { return appletClass; @@ -159,7 +143,7 @@ protected String getAppletClass() { * This method is protected so that overriding classes can publish it if * needed. * - * @param appletClass + * @param appletArchives */ protected void setAppletArchives(List appletArchives) { this.appletArchives = appletArchives; @@ -170,8 +154,6 @@ protected void setAppletArchives(List appletArchives) { * * This method is protected so that overriding classes can publish it if * needed. - * - * @param appletClass */ protected List getAppletArchives() { return appletArchives; @@ -213,8 +195,6 @@ protected void setAppletParams(String paramName, String paramValue) { * * This method is protected so that overriding classes can publish it if * needed. - * - * @param appletClass */ protected Map getAppletParams() { return Collections.unmodifiableMap(appletParams); @@ -270,4 +250,8 @@ public String getName() { return name; } -} + @Override + public void changeVariables(Object o, Map stringObjectMap) { + + } +} \ No newline at end of file diff --git a/src/org/vaadin/applet/AppletintegrationWidgetset.gwt.xml b/src/org/vaadin/applet/AppletintegrationWidgetset.gwt.xml index 12b5fe3..1608519 100644 --- a/src/org/vaadin/applet/AppletintegrationWidgetset.gwt.xml +++ b/src/org/vaadin/applet/AppletintegrationWidgetset.gwt.xml @@ -1,7 +1,8 @@ - + - + - - + \ No newline at end of file diff --git a/src/org/vaadin/applet/client/ui/AppletIntegrationConnector.java b/src/org/vaadin/applet/client/ui/AppletIntegrationConnector.java new file mode 100644 index 0000000..af7879c --- /dev/null +++ b/src/org/vaadin/applet/client/ui/AppletIntegrationConnector.java @@ -0,0 +1,26 @@ +package org.vaadin.applet.client.ui; + +import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.Paintable; +import com.vaadin.client.UIDL; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.ui.Connect; +import org.vaadin.applet.AppletIntegration; + +/** + * @author artamonov + * @version $Id$ + */ +@Connect(AppletIntegration.class) +public class AppletIntegrationConnector extends AbstractComponentConnector implements Paintable { + + @Override + public VAppletIntegration getWidget() { + return (VAppletIntegration) super.getWidget(); + } + + @Override + public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { + getWidget().updateFromUIDL(uidl, client); + } +} \ No newline at end of file diff --git a/src/org/vaadin/applet/client/ui/VAppletIntegration.java b/src/org/vaadin/applet/client/ui/VAppletIntegration.java index 2e1ed2a..519989c 100644 --- a/src/org/vaadin/applet/client/ui/VAppletIntegration.java +++ b/src/org/vaadin/applet/client/ui/VAppletIntegration.java @@ -1,20 +1,11 @@ package org.vaadin.applet.client.ui; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Cookies; import com.google.gwt.user.client.ui.HTML; -import com.vaadin.terminal.gwt.client.ApplicationConfiguration; -import com.vaadin.terminal.gwt.client.ApplicationConnection; -import com.vaadin.terminal.gwt.client.Paintable; -import com.vaadin.terminal.gwt.client.UIDL; -import com.vaadin.terminal.gwt.client.VConsole; -import com.vaadin.terminal.gwt.client.ValueMap; +import com.vaadin.client.*; + +import java.util.*; /** * Client side applet integration widget which communicates with the server. @@ -207,16 +198,16 @@ private native static void exportClientUpdateVariable( ApplicationConnection client) /*-{ var c = client; $wnd.vaadin.appletUpdateBooleanVariable = function(pid, variableName, newValue, immediate) { - c.@com.vaadin.terminal.gwt.client.ApplicationConnection::updateVariable(Ljava/lang/String;Ljava/lang/String;ZZ)(pid, variableName, newValue, immediate); + c.@com.vaadin.client.ApplicationConnection::updateVariable(Ljava/lang/String;Ljava/lang/String;ZZ)(pid, variableName, newValue, immediate); }; $wnd.vaadin.appletUpdateIntVariable = function(pid, variableName, newValue, immediate) { - c.@com.vaadin.terminal.gwt.client.ApplicationConnection::updateVariable(Ljava/lang/String;Ljava/lang/String;IZ)(pid, variableName, newValue, immediate); + c.@com.vaadin.client.ApplicationConnection::updateVariable(Ljava/lang/String;Ljava/lang/String;IZ)(pid, variableName, newValue, immediate); }; $wnd.vaadin.appletUpdateDoubleVariable = function(pid, variableName, newValue, immediate) { - c.@com.vaadin.terminal.gwt.client.ApplicationConnection::updateVariable(Ljava/lang/String;Ljava/lang/String;DZ)(pid, variableName, newValue, immediate); + c.@com.vaadin.client.ApplicationConnection::updateVariable(Ljava/lang/String;Ljava/lang/String;DZ)(pid, variableName, newValue, immediate); }; $wnd.vaadin.appletUpdateStringVariable = function(pid, variableName, newValue, immediate) { - c.@com.vaadin.terminal.gwt.client.ApplicationConnection::updateVariable(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)(pid, variableName, newValue, immediate); + c.@com.vaadin.client.ApplicationConnection::updateVariable(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)(pid, variableName, newValue, immediate); }; }-*/; @@ -420,12 +411,11 @@ private Map getDefaultIntegrationParameters() { ApplicationConfiguration.isDebugMode() ? "true" : "false"); res.put(PARAM_APP_URL, GWT.getHostPageBaseURL()); - String prefix = client.getAppUri(); + String prefix = client.getConfiguration().getServiceUrl(); if (prefix == null) { prefix = ""; } res.put(PARAM_ACTION_URL, GWT.getHostPageBaseURL() + action.substring(prefix.length())); return res; } - -} +} \ No newline at end of file diff --git a/src/org/vaadin/applet/sample/AppletIntegrationSampleApplication.java b/src/org/vaadin/applet/sample/AppletIntegrationSampleUI.java similarity index 69% rename from src/org/vaadin/applet/sample/AppletIntegrationSampleApplication.java rename to src/org/vaadin/applet/sample/AppletIntegrationSampleUI.java index bbcf45c..6eeba05 100644 --- a/src/org/vaadin/applet/sample/AppletIntegrationSampleApplication.java +++ b/src/org/vaadin/applet/sample/AppletIntegrationSampleUI.java @@ -2,21 +2,16 @@ import java.util.Arrays; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.UI; import org.vaadin.applet.AppletIntegration; -import com.vaadin.Application; -import com.vaadin.ui.Window; - -public class AppletIntegrationSampleApplication extends Application { +public class AppletIntegrationSampleUI extends UI { private static final long serialVersionUID = 8738850341513839745L; @Override - public void init() { - - Window mainWindow = new Window("Applettest Application"); - setMainWindow(mainWindow); - + protected void init(VaadinRequest request) { AppletIntegration applet = new AppletIntegration() { private static final long serialVersionUID = 1L; @@ -32,7 +27,6 @@ public void attach() { } }; - mainWindow.addComponent(applet); + setContent(applet); } - } \ No newline at end of file