summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-02-15 18:11:57 +0200
committerLeif Åstrand <leif@vaadin.com>2012-02-15 18:11:57 +0200
commite7792742a7bc1e13ceeffb9561f32d9bc01338b2 (patch)
treea1c0f110b62b8ecdc54dc5bfe11cdf2adc602cf8
parentc6b25e1cd70e4c0070df500b99f476bf1a1551b1 (diff)
parent3c2de952974b3e0e82de7951d814fd6312b434af (diff)
downloadvaadin-framework-e7792742a7bc1e13ceeffb9561f32d9bc01338b2.tar.gz
vaadin-framework-e7792742a7bc1e13ceeffb9561f32d9bc01338b2.zip
Merge remote branch 'origin/6.8'
Conflicts: src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java1
-rw-r--r--tests/testbench/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.html42
-rw-r--r--tests/testbench/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.java53
-rw-r--r--tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java17
-rw-r--r--tests/testbench/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java3
6 files changed, 121 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
index 0083cc83c2..5e061175c0 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
@@ -1157,9 +1157,11 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* The URI of the icon
*/
protected void setSelectedItemIcon(String iconUri) {
- if (iconUri == null || iconUri == "") {
- panel.remove(selectedItemIcon);
- updateRootWidth();
+ if (iconUri == null || iconUri.length() == 0) {
+ if (selectedItemIcon.isAttached()) {
+ panel.remove(selectedItemIcon);
+ updateRootWidth();
+ }
} else {
panel.insert(selectedItemIcon, 0);
selectedItemIcon.setUrl(iconUri);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java
index ee8aedd642..eaf9eec16a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java
@@ -170,6 +170,7 @@ public class VFilterSelectPaintable extends VAbstractPaintableWidget {
getWidgetForPaintable().tb.setValue("");
}
}
+ getWidgetForPaintable().setSelectedItemIcon(null);
getWidgetForPaintable().selectedOptionKey = null;
}
diff --git a/tests/testbench/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.html b/tests/testbench/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.html
new file mode 100644
index 0000000000..fc3862ebb7
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.html
@@ -0,0 +1,42 @@
+<?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>RemovalOfSelectedIcon</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">RemovalOfSelectedIcon</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.combobox.RemovalOfSelectedIcon?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxRemovalOfSelectedIcon::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[1]</td>
+ <td>9,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxRemovalOfSelectedIcon::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1</td>
+ <td>131,3</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxRemovalOfSelectedIcon::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>combobox-empty-and-widths-match</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.java b/tests/testbench/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.java
new file mode 100644
index 0000000000..a79b85ece4
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.java
@@ -0,0 +1,53 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComboBox;
+
+@SuppressWarnings("serial")
+public class RemovalOfSelectedIcon extends TestBase {
+
+ @Override
+ protected void setup() {
+
+ final ComboBox cb1 = createComboBox("Don't touch this combobox");
+ addComponent(cb1);
+
+ final ComboBox cb2 = createComboBox("Select icon test combobox");
+ addComponent(cb2);
+
+ Button btClear = new Button("Clear button");
+ btClear.setImmediate(true);
+ btClear.addListener(new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ cb2.removeAllItems();
+ cb2.setContainerDataSource(null);
+ }
+ });
+
+ addComponent(btClear);
+ }
+
+ private ComboBox createComboBox(String caption) {
+ ComboBox cb = new ComboBox(caption);
+ cb.setImmediate(true);
+ cb.addItem(1);
+ cb.setItemCaption(1, "icon test");
+ cb.setItemIcon(1, new ThemeResource("menubar/img/checked.png"));
+ return cb;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Clear button must remove selected icon, and comboboxes' widths must stay same.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4353;
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java
index 2f30b623fd..f9a7d572e3 100644
--- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java
+++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java
@@ -191,8 +191,13 @@ public class OrderedLayoutCases extends AbstractTestRoot {
new ClickListener() {
public void buttonClick(ClickEvent event) {
resetState();
+ setState(sizeBar, 2, 1);
// width: 350px to middle child
setChildState(1, 0, 2);
+ // middle center allign to middle child
+ setChildState(1, 4, 5);
+ // long captions to right child
+ setChildState(2, 2, 2);
}
}));
caseBar.addComponent(new Button("Undefined with relative",
@@ -223,6 +228,10 @@ public class OrderedLayoutCases extends AbstractTestRoot {
setState(sizeBar, 3, 1);
// width: 350px to middle child
setChildState(1, 0, 2);
+ // short caption for middle child
+ setChildState(1, 2, 1);
+ // top center align for middle child
+ setChildState(1, 4, 2);
}
}));
@@ -238,6 +247,8 @@ public class OrderedLayoutCases extends AbstractTestRoot {
setChildState(1, 3, 1);
// Align bottom left to middle child
setChildState(1, 4, 6);
+ // Long caption to middle child
+ setChildState(1, 2, 2);
}
}));
@@ -249,6 +260,8 @@ public class OrderedLayoutCases extends AbstractTestRoot {
setState(sizeBar, 0, 3);
// Layout height: 350px
setState(sizeBar, 1, 2);
+ // Long caption to left child
+ setChildState(0, 2, 2);
// Width 350px to middle child
setChildState(1, 0, 2);
// Apply to left and middle child
@@ -271,6 +284,8 @@ public class OrderedLayoutCases extends AbstractTestRoot {
setChildState(0, 1, 2);
// Height: 100% to middle child
setChildState(1, 1, 4);
+ // Short caption to middle child
+ setChildState(1, 2, 1);
// Alignment: bottom left to right child
setChildState(2, 4, 7);
}
@@ -282,6 +297,8 @@ public class OrderedLayoutCases extends AbstractTestRoot {
resetState();
// Height: 350px to left child
setChildState(0, 1, 2);
+ // Short caption to left child
+ setChildState(0, 2, 1);
// Height: 100% to middle child
setChildState(1, 1, 4);
// Alignment: bottom left to right child
diff --git a/tests/testbench/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/tests/testbench/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java
index 73211bb96d..0c4d1f2f03 100644
--- a/tests/testbench/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java
+++ b/tests/testbench/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java
@@ -66,6 +66,9 @@ public class GridLayoutTests extends AbstractLayoutTests {
glo.replaceComponent(row1, row1 = new DateField());
glo.replaceComponent(row2, row2 = new DateField());
glo.replaceComponent(row3, row3 = new DateField());
+ ((DateField) row1).setResolution(DateField.RESOLUTION_SEC);
+ ((DateField) row2).setResolution(DateField.RESOLUTION_SEC);
+ ((DateField) row2).setResolution(DateField.RESOLUTION_SEC);
glo.setComponentAlignment(col2, alignments[6]);
glo.setComponentAlignment(col3, alignments[7]);
glo.setComponentAlignment(col1, alignments[8]);