Browse Source

#6902 Table empties field on Layout.replaceComponent

svn changeset:22788/svn branch:6.7
tags/7.0.0.alpha2
Artur Signell 12 years ago
parent
commit
0f7bf07b0a

+ 12
- 0
src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java View File

@@ -2592,6 +2592,17 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
break;
}
break;
case Event.ONCONTEXTMENU:
if (client.hasEventListeners(VScrollTable.this,
HEADER_CLICK_EVENT_ID)) {
// Prevent showing the browser's context menu when there is
// a right click listener.
event.preventDefault();
}
break;
case Event.ONDBLCLICK:
fireHeaderClickedEvent(event);
break;
case Event.ONTOUCHMOVE:
case Event.ONMOUSEMOVE:
if (dragging) {
@@ -4736,6 +4747,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
Paintable paintable = client.getPaintable(uidl);
paintable.updateFromUIDL(uidl, client);
}
pendingComponentPaints.clear();
}
}


+ 47
- 0
tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html View File

@@ -0,0 +1,47 @@
<?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>TextFieldValueGoesMissing</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TextFieldValueGoesMissing</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/run/com.vaadin.tests.components.table.TextFieldValueGoesMissing?restartApplication</td>
<td></td>
</tr>
<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td>73,10</td>
</tr>
<tr>
<td>enterCharacter</td>
<td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td>test</td>
</tr>
<tr>
<td>click</td>
<td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
<td>contextmenu</td>
<td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td>test</td>
</tr>
</tbody></table>
</body>
</html>

+ 7
- 3
tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java View File

@@ -17,11 +17,15 @@ public class TextFieldValueGoesMissing extends TestBase {
final Label label1 = new Label("1");
final Label label2 = new Label("2");

Button button = new Button("Refresh");
Button button = new Button("Replace label");
button.addListener(new Button.ClickListener() {

public void buttonClick(ClickEvent event) {
verticalLayout.replaceComponent(label1, label2);
if (verticalLayout.getComponentIndex(label1) > -1) {
verticalLayout.replaceComponent(label1, label2);
} else {
verticalLayout.replaceComponent(label2, label1);
}
}
});
verticalLayout.addComponent(button);
@@ -41,7 +45,7 @@ public class TextFieldValueGoesMissing extends TestBase {

@Override
protected String getDescription() {
return "Enter a text in the TextField in the table and press the 'replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents";
return "Enter a text in the TextField in the table and press the 'Replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents";
}

@Override

Loading…
Cancel
Save