GWT-2.7.0 + Diagnostic output

master
mandlm 2015-12-29 15:45:59 +01:00
parent 3ef1435e12
commit b3dbcc2588
5 changed files with 29 additions and 2 deletions

View File

@ -2,7 +2,7 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="test-classes" path="test"/> <classpathentry kind="src" output="test-classes" path="test"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER/GWT 2.7.0"/>
<classpathentry kind="output" path="war/WEB-INF/classes"/> <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,3 +1,4 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
entryPointModules=
filesCopiedToWebInfLib=gwt-servlet.jar filesCopiedToWebInfLib=gwt-servlet.jar
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPm5ldC5tb2xlei5tYW5kbG0uZm90b3N0cmVhbS5Gb3RvU3RyZWFtPC9lbnRyeS1wb2ludC1tb2R1bGU+PC9nd3QtY29tcGlsZS1zZXR0aW5ncz4\= gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPm5ldC5tb2xlei5tYW5kbG0uZm90b3N0cmVhbS5Gb3RvU3RyZWFtPC9lbnRyeS1wb2ludC1tb2R1bGU+PC9nd3QtY29tcGlsZS1zZXR0aW5ncz4\=

View File

@ -5,9 +5,11 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.LoadEvent; import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler; import com.google.gwt.event.dom.client.LoadHandler;
import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
public class FotoStream implements EntryPoint public class FotoStream implements EntryPoint
@ -16,6 +18,10 @@ public class FotoStream implements EntryPoint
public void onModuleLoad() public void onModuleLoad()
{ {
final Label label = new Label();
RootPanel.get("textContainer").add(label);
final Image image = new Image(); final Image image = new Image();
image.setVisible(false); image.setVisible(false);
image.addLoadHandler(new LoadHandler() image.addLoadHandler(new LoadHandler()
@ -23,8 +29,27 @@ public class FotoStream implements EntryPoint
@Override @Override
public void onLoad(LoadEvent event) public void onLoad(LoadEvent event)
{ {
int clientHeight = Window.getClientHeight();
int clientWidth = Window.getClientWidth();
int imageHeight = image.getHeight();
int imageWidth = image.getWidth();
double heightScale = (double)clientHeight / (double)imageHeight;
double widthScale = (double)clientWidth / (double)imageWidth;
double scale = Math.min(heightScale, widthScale);
int targetWidth = (int) (scale * (double)imageWidth);
int targetHeight = (int) (scale * (double)imageHeight);
label.setText(
"Client: " + clientWidth + "x" + clientHeight + " " +
"Image: " + imageWidth + "x" + imageHeight + " " +
"Target: " + targetWidth + "x" + targetHeight);
image.setVisible(true); image.setVisible(true);
image.setWidth("100%"); image.setWidth("50%");
} }
}); });

View File

@ -41,5 +41,6 @@
</noscript> </noscript>
<div id="imageContainer"></div> <div id="imageContainer"></div>
<div id="textContainer"></div>
</body> </body>
</html> </html>

Binary file not shown.