Skip to content
This repository has been archived by the owner on May 31, 2018. It is now read-only.

Commit

Permalink
Fix size setting for applet widget
Browse files Browse the repository at this point in the history
  • Loading branch information
jreznot committed Jul 15, 2013
1 parent 532aad4 commit a586533
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
Binary file removed WebContent/WEB-INF/lib/vaadin-6.5.4.jar
Binary file not shown.
Binary file removed WebContent/WEB-INF/lib/vaadin-6.6.4.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.haulmont.thirdparty</groupId>
<artifactId>appletintegration</artifactId>
<packaging>jar</packaging>
<version>1.2.9</version>
<version>1.2.10</version>
<name>Vaadin AppletIntegration Addon</name>

<properties>
Expand Down Expand Up @@ -47,11 +47,13 @@
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
Expand All @@ -63,6 +65,7 @@
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down Expand Up @@ -156,6 +159,7 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<configuration>
<webAppSourceDirectory>${basedir}/WebContent</webAppSourceDirectory>
<webAppConfig>
Expand Down
27 changes: 26 additions & 1 deletion src/org/vaadin/applet/client/ui/AppletIntegrationConnector.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,51 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/

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.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.shared.ui.Connect;
import org.vaadin.applet.AppletIntegration;

import java.util.logging.Logger;

/**
* @author artamonov
* @version $Id$
*/
@Connect(AppletIntegration.class)
public class AppletIntegrationConnector extends AbstractComponentConnector implements Paintable {

protected Logger log = Logger.getLogger("AppletIntegrationConnector");

@Override
public VAppletIntegration getWidget() {
return (VAppletIntegration) super.getWidget();
}

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
log.info("Set applet parameters");

getWidget().updateFromUIDL(uidl, client);
}

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
log.info("Applet state changed");

super.onStateChanged(stateChangeEvent);

if (stateChangeEvent.hasPropertyChanged("width"))
getWidget().setWidth(getState().width);

if (stateChangeEvent.hasPropertyChanged("height"))
getWidget().setHeight(getState().height);
}
}
14 changes: 1 addition & 13 deletions src/org/vaadin/applet/client/ui/VAppletIntegration.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public VAppletIntegration() {
/**
* Called whenever an update is received from the server
*/
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
// This call should be made first.
// It handles sizes, captions, tooltips, etc. automatically.
Expand Down Expand Up @@ -144,19 +145,6 @@ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
codebase = uidl.getStringAttribute(ATTR_APPLET_CODEBASE);
}

// Width and height if provided
if (uidl.hasAttribute("width")) {
setWidth(uidl.getStringAttribute("width"));
} else {
setWidth("0");
}

if (uidl.hasAttribute("height")) {
setHeight(uidl.getStringAttribute("height"));
} else {
setHeight("0");
}

if (uidl.hasVariable(ATTR_APPLET_ACTION)) {
action = client.translateVaadinUri(uidl.getStringVariable(ATTR_APPLET_ACTION));
} else {
Expand Down

0 comments on commit a586533

Please sign in to comment.