Browse Source

Merge commit '6922bc5b49c5551b289a5025ccd5901e2ac3aafc'

Change-Id: Id118fd9bae1fdf7e7ce2efd660ade5ba7bbc5109
tags/7.1.0.beta1
Artur Signell 11 years ago
parent
commit
0f3ac51ed4
30 changed files with 633 additions and 86 deletions
  1. 1
    1
      client/src/com/vaadin/client/ApplicationConfiguration.java
  2. 28
    2
      client/src/com/vaadin/client/ApplicationConnection.java
  3. 220
    40
      client/src/com/vaadin/client/Profiler.java
  4. 14
    2
      client/src/com/vaadin/client/ui/VScrollTable.java
  5. 4
    3
      client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java
  6. 3
    3
      pom-template.xml
  7. 1
    3
      scripts/merge-check.sh
  8. 3
    3
      server/src/com/vaadin/data/Property.java
  9. 1
    1
      server/src/com/vaadin/data/fieldgroup/BeanFieldGroup.java
  10. 1
    2
      server/src/com/vaadin/data/util/BeanContainer.java
  11. 1
    2
      server/src/com/vaadin/data/util/BeanItemContainer.java
  12. 12
    0
      server/src/com/vaadin/server/BootstrapHandler.java
  13. 1
    5
      server/src/com/vaadin/server/StreamResource.java
  14. 71
    0
      server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java
  15. 3
    2
      server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
  16. 52
    0
      uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html
  17. 55
    0
      uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java
  18. 27
    0
      uitest/src/com/vaadin/tests/components/ui/CustomUITest.html
  19. 43
    0
      uitest/src/com/vaadin/tests/components/ui/CustomUITest.java
  20. 2
    2
      uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html
  21. 2
    2
      uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html
  22. 2
    2
      uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html
  23. 2
    2
      uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html
  24. 2
    2
      uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html
  25. 2
    2
      uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.html
  26. 4
    1
      uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java
  27. 7
    4
      uitest/src/com/vaadin/tests/util/TestUtils.java
  28. 5
    0
      uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
  29. 41
    0
      uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java
  30. 23
    0
      uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnectorRpc.java

+ 1
- 1
client/src/com/vaadin/client/ApplicationConfiguration.java View File

@@ -535,7 +535,7 @@ public class ApplicationConfiguration implements EntryPoint {

@Override
public void onModuleLoad() {
Profiler.reset();
Profiler.initialize();
Profiler.enter("ApplicationConfiguration.onModuleLoad");

BrowserInfo browserInfo = BrowserInfo.get();

+ 28
- 2
client/src/com/vaadin/client/ApplicationConnection.java View File

@@ -16,7 +16,7 @@

package com.vaadin.client;

import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -500,6 +500,7 @@ public class ApplicationConnection {
ap.@com.vaadin.client.ApplicationConnection::totalProcessingTime
];
pd = pd.concat(ap.@com.vaadin.client.ApplicationConnection::serverTimingInfo);
pd[pd.length] = ap.@com.vaadin.client.ApplicationConnection::bootstrapTime;
return pd;
});

@@ -513,6 +514,16 @@ public class ApplicationConnection {
$wnd.vaadin.clients[TTAppId] = client;
}-*/;

private static native final int calculateBootstrapTime()
/*-{
if ($wnd.performance && $wnd.performance.timing) {
return (new Date).getTime() - $wnd.performance.timing.responseStart;
} else {
// performance.timing not supported
return -1;
}
}-*/;

/**
* Helper for tt initialization
*/
@@ -947,6 +958,15 @@ public class ApplicationConnection {
*/
protected int totalProcessingTime;

/**
* Holds the time it took to load the page and render the first view. 0
* means that this value has not yet been calculated because the first view
* has not yet been rendered (or that your browser is very fast). -1 means
* that the browser does not support the performance.timing feature used to
* get this measurement.
*/
private int bootstrapTime;

/**
* Holds the timing information from the server-side. How much time was
* spent servicing the last request and how much time has been spent
@@ -1512,6 +1532,12 @@ public class ApplicationConnection {
lastProcessingTime = (int) ((new Date().getTime()) - start
.getTime());
totalProcessingTime += lastProcessingTime;
if (bootstrapTime == 0) {
bootstrapTime = calculateBootstrapTime();
if (Profiler.isEnabled() && bootstrapTime != -1) {
Profiler.logBootstrapTimings();
}
}

VConsole.log(" Processing time was "
+ String.valueOf(lastProcessingTime) + "ms for "
@@ -1775,7 +1801,7 @@ public class ApplicationConnection {
.getConnectorClassByEncodedTag(connectorType);

// Connector does not exist so we must create it
if (connectorClass != UIConnector.class) {
if (connectorClass != uIConnector.getClass()) {
// create, initialize and register the paintable
Profiler.enter("ApplicationConnection.getConnector");
connector = getConnector(connectorId, connectorType);

+ 220
- 40
client/src/com/vaadin/client/Profiler.java View File

@@ -54,25 +54,45 @@ public class Profiler {
}
}

private static JsArray<ProfilerEvent> events;
private static final String evtGroup = "VaadinProfiler";

private static final class ProfilerEvent extends JavaScriptObject {
protected ProfilerEvent() {
private static final class GwtStatsEvent extends JavaScriptObject {
protected GwtStatsEvent() {
// JSO constructor
}

public native String getName()
private native String getEvtGroup()
/*-{
return this.name;
return this.evtGroup;
}-*/;

private native double getRawTime()
private native double getMillis()
/*-{
return this.time;
return this.millis;
}-*/;

private boolean isStart() {
return getRawTime() <= 0;
private native String getSubSystem()
/*-{
return this.subSystem;
}-*/;

private native String getType()
/*-{
return this.type;
}-*/;

private native String getModuleName()
/*-{
return this.moduleName;
}-*/;

public final String getEventName() {
String group = getEvtGroup();
if (evtGroup.equals(group)) {
return getSubSystem();
} else {
return group + "." + getSubSystem();
}
}
}

@@ -91,21 +111,17 @@ public class Profiler {
return name;
}

public Node addEvent(ProfilerEvent event) {
Node child = children.get(event.getName());
private Node accessChild(String name, double time) {
Node child = children.get(name);
if (child == null) {
child = new Node(event.getName());
children.put(event.getName(), child);
child = new Node(name);
children.put(name, child);
}
child.time += event.getRawTime();
child.time -= time;
child.count++;
return child;
}

public void registerEnd(ProfilerEvent event) {
time += event.getRawTime();
}

public double getTimeSpent() {
return time;
}
@@ -148,6 +164,11 @@ public class Profiler {
}
}

@Override
public String toString() {
return getStringRepresentation("");
}

private String getStringRepresentation(String prefix) {
if (getName() == null) {
return "";
@@ -229,7 +250,7 @@ public class Profiler {
*/
public static void enter(String name) {
if (isEnabled()) {
pushEvent(events, name, -Duration.currentTimeMillis());
logGwtEvent(name, "begin");
}
}

@@ -243,14 +264,20 @@ public class Profiler {
*/
public static void leave(String name) {
if (isEnabled()) {
pushEvent(events, name, Duration.currentTimeMillis());
logGwtEvent(name, "end");
}
}

private static native final void pushEvent(JsArray<ProfilerEvent> target,
String name, double time)
private static native final void logGwtEvent(String name, String type)
/*-{
target[target.length] = {name: name, time: time};
$wnd.__gwtStatsEvent({
evtGroup: @com.vaadin.client.Profiler::evtGroup,
moduleName: @com.google.gwt.core.client.GWT::getModuleName()(),
millis: (new Date).getTime(),
sessionId: undefined,
subSystem: name,
type: type
});
}-*/;

/**
@@ -259,7 +286,35 @@ public class Profiler {
*/
public static void reset() {
if (isEnabled()) {
events = JavaScriptObject.createArray().cast();
/*
* Old implementations might call reset for initialization, so
* ensure it is initialized here as well. Initialization has no side
* effects if already done.
*/
initialize();

clearEventsList();
}
}

/**
* Initializes the profiler. This should be done before calling any other
* function in this class. Failing to do so might cause undesired behavior.
* This method has no side effects if the initialization has already been
* done.
* <p>
* Please note that this method should be called even if the profiler is not
* enabled because it will then remove a logger function that might have
* been included in the HTML page and that would leak memory unless removed.
* </p>
*
* @since 7.0.2
*/
public static void initialize() {
if (isEnabled()) {
ensureLogger();
} else {
ensureNoLogger();
}
}

@@ -275,25 +330,52 @@ public class Profiler {
LinkedList<Node> stack = new LinkedList<Node>();
Node rootNode = new Node(null);
stack.add(rootNode);
for (int i = 0; i < events.length(); i++) {
ProfilerEvent event = events.get(i);
if (event.isStart()) {
Node stackTop = stack.getLast().addEvent(event);
stack.add(stackTop);
} else {
Node stackTop = stack.removeLast();
if (stackTop == null) {
VConsole.error("Leaving " + event.getName()
+ " that was never entered.");
JsArray<GwtStatsEvent> gwtStatsEvents = getGwtStatsEvents();
if (gwtStatsEvents.length() == 0) {
VConsole.log("No profiling events recorded, this might happen if another __gwtStatsEvent handler is installed.");
return;
}

for (int i = 0; i < gwtStatsEvents.length(); i++) {
GwtStatsEvent gwtStatsEvent = gwtStatsEvents.get(i);
String eventName = gwtStatsEvent.getEventName();
String type = gwtStatsEvent.getType();
boolean isBeginEvent = "begin".equals(type);

Node stackTop = stack.getLast();
boolean inEvent = eventName.equals(stackTop.getName())
&& !isBeginEvent;

if (!inEvent && stack.size() >= 2
&& eventName.equals(stack.get(stack.size() - 2).name)
&& !isBeginEvent) {
// back out of sub event
stackTop.time += gwtStatsEvent.getMillis();
stack.removeLast();
stackTop = stack.getLast();

inEvent = true;
}

if (type.equals("end")) {
if (!inEvent) {
VConsole.error("Got end event for " + eventName
+ " but is currently in " + stackTop.getName());
return;
}
if (!stackTop.getName().equals(event.getName())) {
VConsole.error("Invalid profiling event order, leaving "
+ event.getName() + " but " + stackTop.getName()
+ " was expected");
return;
Node previousStackTop = stack.removeLast();
previousStackTop.time += gwtStatsEvent.getMillis();
} else {
if (!inEvent) {
stackTop = stackTop.accessChild(eventName,
gwtStatsEvent.getMillis());
stack.add(stackTop);
}
if (!isBeginEvent) {
// Create sub event
stack.add(stackTop.accessChild(eventName + "." + type,
gwtStatsEvent.getMillis()));
}
stackTop.registerEnd(event);
}
}

@@ -362,4 +444,102 @@ public class Profiler {
return false;
}

/**
* Outputs the time passed since various events recored in
* performance.timing if supported by the browser.
*/
public static void logBootstrapTimings() {
if (isEnabled()) {
double now = Duration.currentTimeMillis();

StringBuilder stringBuilder = new StringBuilder(
"Time since window.performance.timing events");
SimpleTree tree = new SimpleTree(stringBuilder.toString());

String[] keys = new String[] { "navigationStart",
"unloadEventStart", "unloadEventEnd", "redirectStart",
"redirectEnd", "fetchStart", "domainLookupStart",
"domainLookupEnd", "connectStart", "connectEnd",
"requestStart", "responseStart", "responseEnd",
"domLoading", "domInteractive",
"domContentLoadedEventStart", "domContentLoadedEventEnd",
"domComplete", "loadEventStart", "loadEventEnd" };

for (String key : keys) {
double value = getPerformanceTiming(key);
if (value == 0) {
// Ignore missing value
continue;
}
String text = key + ": " + (now - value);
tree.add(new Label(text));
stringBuilder.append("\n * ");
stringBuilder.append(text);
}

if (tree.getWidgetCount() == 0) {
VConsole.log("Bootstrap timings not supported, please ensure your browser supports performance.timing");
return;
}

Console implementation = VConsole.getImplementation();
if (implementation instanceof VDebugConsole) {
VDebugConsole console = (VDebugConsole) implementation;
console.showTree(tree, stringBuilder.toString());
} else {
VConsole.log(stringBuilder.toString());
}
}
}

private static final native double getPerformanceTiming(String name)
/*-{
if ($wnd.performance && $wnd.performance.timing && $wnd.performance.timing[name]) {
return $wnd.performance.timing[name];
} else {
return 0;
}
}-*/;

private static native JsArray<GwtStatsEvent> getGwtStatsEvents()
/*-{
return $wnd.vaadin.gwtStatsEvents || [];
}-*/;

/**
* Add logger if it's not already there, also initializing the event array
* if needed.
*/
private static native void ensureLogger()
/*-{
if (typeof $wnd.__gwtStatsEvent != 'function') {
if (typeof $wnd.vaadin.gwtStatsEvents != 'object') {
$wnd.vaadin.gwtStatsEvents = [];
}
$wnd.__gwtStatsEvent = function(event) {
$wnd.vaadin.gwtStatsEvents.push(event);
return true;
}
}
}-*/;

/**
* Remove logger function and event array if it seems like the function has
* been added by us.
*/
private static native void ensureNoLogger()
/*-{
if (typeof $wnd.vaadin.gwtStatsEvents == 'object') {
delete $wnd.vaadin.gwtStatsEvents;
if (typeof $wnd.__gwtStatsEvent == 'function') {
$wnd.__gwtStatsEvent = function(){};
}
}
}-*/;

private static native JsArray<GwtStatsEvent> clearEventsList()
/*-{
$wnd.vaadin.gwtStatsEvents = [];
}-*/;

}

+ 14
- 2
client/src/com/vaadin/client/ui/VScrollTable.java View File

@@ -1098,6 +1098,14 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
}

private ScheduledCommand lazyScroller = new ScheduledCommand() {
@Override
public void execute() {
int offsetTop = measureRowHeightOffset(firstvisible);
scrollBodyPanel.setScrollPosition(offsetTop);
}
};

/** For internal use only. May be removed or replaced in the future. */
public void updateFirstVisibleAndScrollIfNeeded(UIDL uidl) {
firstvisible = uidl.hasVariable("firstvisible") ? uidl
@@ -1105,8 +1113,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (firstvisible != lastRequestedFirstvisible && scrollBody != null) {
// received 'surprising' firstvisible from server: scroll there
firstRowInViewPort = firstvisible;
scrollBodyPanel
.setScrollPosition(measureRowHeightOffset(firstvisible));
/*
* Schedule the scrolling to be executed last so no updates to the rows
* affect scrolling measurements.
*/
Scheduler.get().scheduleFinally(lazyScroller);
}
}


+ 4
- 3
client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java View File

@@ -137,7 +137,8 @@ public class EmbeddedConnector extends AbstractComponentConnector implements
getWidget().getSrc(uidl, client));
clearBrowserElement = false;
} else {
VConsole.log("Unknown Embedded type '" + getWidget().type + "'");
VConsole.error("Unknown Embedded type '" + getWidget().type
+ "'");
}
} else if (uidl.hasAttribute("mimetype")) {
// remove old style name related to type
@@ -203,10 +204,10 @@ public class EmbeddedConnector extends AbstractComponentConnector implements
.getStringAttribute(EmbeddedConstants.ALTERNATE_TEXT));
}
} else {
VConsole.log("Unknown Embedded mimetype '" + mime + "'");
VConsole.error("Unknown Embedded mimetype '" + mime + "'");
}
} else {
VConsole.log("Unknown Embedded; no type or mimetype attribute");
VConsole.error("Unknown Embedded; no type or mimetype attribute");
}

if (clearBrowserElement) {

+ 3
- 3
pom-template.xml View File

@@ -30,9 +30,9 @@
</license>
</licenses>
<scm>
<connection>scm:http:http://dev.vaadin.com/git/vaadin.git</connection>
<developerConnection>scm:ssh:git@dev.vaadin.com/vaadin</developerConnection>
<url>http://dev.vaadin.com/git/?p=vaadin.git</url>
<connection>scm:https:https://github.com/vaadin/vaadin.git</connection>
<developerConnection>scm:https:https://github.com/vaadin/vaadin.git</developerConnection>
<url>https://github.com/vaadin/vaadin</url>
</scm>
<developers>
<developer>

+ 1
- 3
scripts/merge-check.sh View File

@@ -24,9 +24,7 @@ else
echo $message
echo ""
$command
# Escape []|' and newline with | to make teamcity happy
details=`$command|sed "s/[]['\|]/|&/g"|perl -p -e 's/\n/|n/'`
echo "##teamcity[testFailed name='$testname' message='$message' details='|n$details']"
echo "##teamcity[testFailed name='$testname' message='$message']"
fi

echo "##teamcity[testFinished name='$testname']"

+ 3
- 3
server/src/com/vaadin/data/Property.java View File

@@ -116,9 +116,9 @@ public interface Property<T> extends Serializable {
* or rollback.
*
* Note that this does not refer to e.g. database transactions but rather
* two-phase commit that allows resetting old field values on a form etc. if
* the commit of one of the properties fails after others have already been
* committed. If
* two-phase commit that allows resetting old field values (in e.g. a
* FieldGroup) if the commit of one of the properties fails after other
* properties have already been committed.
*
* @param <T>
* The type of the property

+ 1
- 1
server/src/com/vaadin/data/fieldgroup/BeanFieldGroup.java View File

@@ -89,7 +89,7 @@ public class BeanFieldGroup<T> extends FieldGroup {
java.lang.reflect.Field field1 = cls
.getDeclaredField(propertyId);
return field1;
} catch (NoSuchFieldError e) {
} catch (NoSuchFieldException e) {
// Try super classes until we reach Object
Class<?> superClass = cls.getSuperclass();
if (superClass != null && superClass != Object.class) {

+ 1
- 2
server/src/com/vaadin/data/util/BeanContainer.java View File

@@ -55,8 +55,7 @@ import java.util.Collection;
* </p>
*
* <p>
* It is not possible to add additional properties to the container and nested
* bean properties are not supported.
* It is not possible to add additional properties to the container.
* </p>
*
* @param <IDTYPE>

+ 1
- 2
server/src/com/vaadin/data/util/BeanItemContainer.java View File

@@ -43,8 +43,7 @@ import java.util.Collection;
* </p>
*
* <p>
* It is not possible to add additional properties to the container and nested
* bean properties are not supported.
* It is not possible to add additional properties to the container.
* </p>
*
* @param <BEANTYPE>

+ 12
- 0
server/src/com/vaadin/server/BootstrapHandler.java View File

@@ -372,6 +372,18 @@ public abstract class BootstrapHandler implements RequestHandler {
boolean isDebug = !context.getSession().getConfiguration()
.isProductionMode();

if (isDebug) {
/*
* Add tracking needed for getting bootstrap metrics to the client
* side Profiler if another implementation hasn't already been
* added.
*/
builder.append("if (typeof window.__gwtStatsEvent != 'function') {\n");
builder.append("vaadin.gwtStatsEvents = [];\n");
builder.append("window.__gwtStatsEvent = function(event) {vaadin.gwtStatsEvents.push(event); return true;};\n");
builder.append("}\n");
}

builder.append("vaadin.initApplication(\"");
builder.append(context.getAppId());
builder.append("\",");

+ 1
- 5
server/src/com/vaadin/server/StreamResource.java View File

@@ -23,9 +23,7 @@ import com.vaadin.util.FileTypeResolver;

/**
* <code>StreamResource</code> is a resource provided to the client directly by
* the application. The strean resource is fetched from URI that is most often
* in the context of the application or window. The resource is automatically
* registered to window in creation.
* the application.
*
* @author Vaadin Ltd.
* @since 3.0
@@ -65,8 +63,6 @@ public class StreamResource implements ConnectorResource {
* the source Stream.
* @param filename
* the name of the file.
* @param application
* the Application object.
*/
public StreamResource(StreamSource streamSource, String filename) {
setFilename(filename);

+ 71
- 0
server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java View File

@@ -0,0 +1,71 @@
/*
* Copyright 2012 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
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.data.fieldgroup;

import junit.framework.Assert;

import org.junit.Test;

public class BeanFieldGroupTest {

class Main {
private String mainField;

public String getMainField() {
return mainField;
}

public void setMainField(String mainField) {
this.mainField = mainField;
}

}

class Sub1 extends Main {
private Integer sub1Field;

public Integer getSub1Field() {
return sub1Field;
}

public void setSub1Field(Integer sub1Field) {
this.sub1Field = sub1Field;
}

}

class Sub2 extends Sub1 {
private boolean sub2field;

public boolean isSub2field() {
return sub2field;
}

public void setSub2field(boolean sub2field) {
this.sub2field = sub2field;
}

}

@Test
public void propertyTypeWithoutItem() {
BeanFieldGroup<Sub2> s = new BeanFieldGroup<BeanFieldGroupTest.Sub2>(
Sub2.class);
Assert.assertEquals(boolean.class, s.getPropertyType("sub2field"));
Assert.assertEquals(Integer.class, s.getPropertyType("sub1Field"));
Assert.assertEquals(String.class, s.getPropertyType("mainField"));
}
}

+ 3
- 2
server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java View File

@@ -52,13 +52,14 @@ public class CustomUIClassLoader extends TestCase {
* @throws Exception
* if thrown
*/
public void testWithNullClassLoader() throws Exception {
public void testWithDefaultClassLoader() throws Exception {
VaadinSession application = createStubApplication();
application.setConfiguration(createConfigurationMock());

DefaultUIProvider uiProvider = new DefaultUIProvider();
Class<? extends UI> uiClass = uiProvider
.getUIClass(new UIClassSelectionEvent(createRequestMock(null)));
.getUIClass(new UIClassSelectionEvent(
createRequestMock(getClass().getClassLoader())));

assertEquals(MyUI.class, uiClass);
}

+ 52
- 0
uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost:8888/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/run/com.vaadin.tests.components.table.TableRowScrolledBottom?restartApplication</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>500</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td>
<td>This is a test item with long text so that there is something to see Nr. 100. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE</td>
</tr>
<tr>
<td>click</td>
<td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>500</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td>
<td>This is a test item with long text so that there is something to see Nr. 200. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE</td>
</tr>

</tbody></table>
</body>
</html>

+ 55
- 0
uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java View File

@@ -0,0 +1,55 @@
package com.vaadin.tests.components.table;

import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;

public class TableRowScrolledBottom extends TestBase {

@Override
protected void setup() {

final Table table = new Table();
table.setSizeFull();
table.addContainerProperty("Test", Label.class, null);
table.setHeight("100%");

Button button = new Button("Add 100 items");
button.addClickListener(new Button.ClickListener() {
int i = 0;

@Override
public void buttonClick(Button.ClickEvent event) {
for (int j = 0; j < 100; j++) {
++i;
table.addItem(
new Object[] { new Label(
"This is a test item with long text so that there is something to see Nr. <b>"
+ i
+ "</b>. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE",
ContentMode.HTML) }, i);
table.setCurrentPageFirstItemIndex(table
.getContainerDataSource().size() - 1);
}
}
});

addComponent(table);
addComponent(button);
getLayout().setExpandRatio(table, 1f);
}

@Override
protected String getDescription() {
return "Table should be scrolled to bottom when adding rows and updating currentPageFirstItemIndex to last item";
}

@Override
protected Integer getTicketNumber() {
return 10970;
}

}

+ 27
- 0
uitest/src/com/vaadin/tests/components/ui/CustomUITest.html View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/run/com.vaadin.tests.components.ui.CustomUITest?restartApplication&amp;debug=</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//span</td>
<td>This is the CustomUIConnector</td>
</tr>

</tbody></table>
</body>
</html>

+ 43
- 0
uitest/src/com/vaadin/tests/components/ui/CustomUITest.java View File

@@ -0,0 +1,43 @@
/*
* Copyright 2000-2013 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
* License for the specific language governing permissions and limitations under
* the License.
*/

package com.vaadin.tests.components.ui;

import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.widgetset.TestingWidgetSet;
import com.vaadin.tests.widgetset.client.CustomUIConnectorRpc;

@Widgetset(TestingWidgetSet.NAME)
public class CustomUITest extends AbstractTestUI {

@Override
protected void setup(VaadinRequest request) {
getRpcProxy(CustomUIConnectorRpc.class).test();
}

@Override
protected String getTestDescription() {
return "It should be possible to change the implementation of the UIConnector class";
}

@Override
protected Integer getTicketNumber() {
return Integer.valueOf(10867);
}

}

+ 2
- 2
uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html View File

@@ -202,9 +202,9 @@
<td>tables</td>
</tr>
<tr>
<td>contextmenu</td>
<td>contextMenuAt</td>
<td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td>
<td></td>
<td>0,0</td>
</tr>
<tr>
<td>screenCapture</td>

+ 2
- 2
uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html View File

@@ -202,9 +202,9 @@
<td>tables</td>
</tr>
<tr>
<td>contextmenu</td>
<td>contextMenuAt</td>
<td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td>
<td></td>
<td>0,0</td>
</tr>
<tr>
<td>screenCapture</td>

+ 2
- 2
uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html View File

@@ -202,9 +202,9 @@
<td>tables</td>
</tr>
<tr>
<td>contextmenu</td>
<td>contextMenuAt</td>
<td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td>
<td></td>
<td>0,0</td>
</tr>
<tr>
<td>screenCapture</td>

+ 2
- 2
uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html View File

@@ -202,9 +202,9 @@
<td>tables</td>
</tr>
<tr>
<td>contextmenu</td>
<td>contextMenuAt</td>
<td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td>
<td></td>
<td>0,0</td>
</tr>
<tr>
<td>screenCapture</td>

+ 2
- 2
uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html View File

@@ -202,9 +202,9 @@
<td>tables</td>
</tr>
<tr>
<td>contextmenu</td>
<td>contextMenuAt</td>
<td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td>
<td></td>
<td>0,0</td>
</tr>
<tr>
<td>screenCapture</td>

+ 2
- 2
uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.html View File

@@ -24,7 +24,7 @@
<tr>
<td>assertText</td>
<td>//div[2]</td>
<td>BasicExtensionTestConnector extending UIConnector</td>
<td>BasicExtensionTestConnector extending CustomUIConnector</td>
</tr>
<tr>
<td>click</td>
@@ -34,7 +34,7 @@
<tr>
<td>assertText</td>
<td>//div[1]</td>
<td>BasicExtensionTestConnector removed for UIConnector</td>
<td>BasicExtensionTestConnector removed for CustomUIConnector</td>
</tr>
</tbody></table>
</body>

+ 4
- 1
uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java View File

@@ -22,13 +22,14 @@ public class BasicPerformanceTest extends UI {

private int clientLimit;
private int serverLimit;
private boolean reportBootstap = true;
private String performanceTopic;
private final Button reportPerformanceButton = new Button(
"Report some performance", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
TestUtils.reportPerformance(performanceTopic, serverLimit,
clientLimit);
clientLimit, reportBootstap);
event.getButton().setEnabled(false);
}
});
@@ -37,6 +38,7 @@ public class BasicPerformanceTest extends UI {
public void init(VaadinRequest request) {
setContent(buildMainLayout());
updatePerformanceReporting("first load", 100, 100);
reportBootstap = true;
}

private void updatePerformanceReporting(String performanceTopic,
@@ -47,6 +49,7 @@ public class BasicPerformanceTest extends UI {
reportPerformanceButton.setCaption("Report performance for "
+ performanceTopic);
reportPerformanceButton.setEnabled(true);
reportBootstap = false;
}

private ComponentContainer buildMainLayout() {

+ 7
- 4
uitest/src/com/vaadin/tests/util/TestUtils.java View File

@@ -120,20 +120,23 @@ public class TestUtils {
public static void installPerformanceReporting(TextArea targetTextArea) {
targetTextArea.setId("performanceTestTarget");
JavaScript
.eval("window.reportVaadinPerformance = function(topic, serverLimit, clientLimit) {"
.eval("window.reportVaadinPerformance = function(topic, serverLimit, clientLimit, bootstrapTime) {"
+ "var element = document.getElementById('performanceTestTarget');"
+ "var text = topic + ': \\n';"
+ "for(var k in window.vaadin.clients) {"
+ "var p = window.vaadin.clients[k].getProfilingData();"
+ "text += ' Server time: ' + (p[3] > serverLimit?'FAIL':'OK') + ' (' + p[3] +')\\n';"
+ "text += ' Client time: ' + (p[0] > clientLimit?'FAIL':'OK') + ' (' + p[0] +')\\n';"
+ "if (bootstrapTime) text += ' Bootstrap time: ' + (p[4] > clientLimit?'FAIL':'OK') + ' (' + p[4] +')\\n';"
+ "}" + "element.value = text;" + "}");
}

public static void reportPerformance(String topic, int serverLimit,
int totalLimit) {
JavaScript.eval("window.reportVaadinPerformance(\"" + topic + "\", "
+ serverLimit + ", " + totalLimit + ");");
int clientLimit, boolean bootstrapTime) {
JavaScript
.eval("window.reportVaadinPerformance(\"" + topic + "\", "
+ serverLimit + ", " + clientLimit + ","
+ bootstrapTime + ");");
}

public static IndexedContainer getISO3166Container() {

+ 5
- 0
uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml View File

@@ -3,4 +3,9 @@

<!-- Inherit the DefaultWidgetSet -->
<inherits name="com.vaadin.DefaultWidgetSet" />
<replace-with class="com.vaadin.tests.widgetset.client.CustomUIConnector">
<when-type-is class="com.vaadin.client.ui.ui.UIConnector" />
</replace-with>
</module>

+ 41
- 0
uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java View File

@@ -0,0 +1,41 @@
/*
* Copyright 2000-2013 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
* License for the specific language governing permissions and limitations under
* the License.
*/

package com.vaadin.tests.widgetset.client;

import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.SpanElement;
import com.vaadin.client.Util;
import com.vaadin.client.ui.ui.UIConnector;
import com.vaadin.shared.ui.Connect;
import com.vaadin.ui.UI;

@Connect(UI.class)
public class CustomUIConnector extends UIConnector {
@Override
protected void init() {
super.init();
registerRpc(CustomUIConnectorRpc.class, new CustomUIConnectorRpc() {
@Override
public void test() {
SpanElement span = Document.get().createSpanElement();
span.setInnerText("This is the "
+ Util.getSimpleName(CustomUIConnector.this));
Document.get().getBody().insertFirst(span);
}
});
}
}

+ 23
- 0
uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnectorRpc.java View File

@@ -0,0 +1,23 @@
/*
* Copyright 2000-2013 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
* License for the specific language governing permissions and limitations under
* the License.
*/

package com.vaadin.tests.widgetset.client;

import com.vaadin.shared.communication.ClientRpc;

public interface CustomUIConnectorRpc extends ClientRpc {
public void test();
}

Loading…
Cancel
Save