summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/com/vaadin/ui/ComboBox.java21
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxPageLength.html176
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxPageLength.java40
3 files changed, 237 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/ComboBox.java b/server/src/com/vaadin/ui/ComboBox.java
index c35ecdb21f..3bf6ee992b 100644
--- a/server/src/com/vaadin/ui/ComboBox.java
+++ b/server/src/com/vaadin/ui/ComboBox.java
@@ -792,6 +792,27 @@ public class ComboBox extends AbstractSelect implements
}
/**
+ * Returns the page length of the suggestion popup.
+ *
+ * @return the pageLength
+ */
+ public int getPageLength() {
+ return pageLength;
+ }
+
+ /**
+ * Sets the page length for the suggestion popup. Setting the page length to
+ * 0 will disable suggestion popup paging (all items visible).
+ *
+ * @param pageLength
+ * the pageLength to set
+ */
+ public void setPageLength(int pageLength) {
+ this.pageLength = pageLength;
+ markAsDirty();
+ }
+
+ /**
* Sets whether to scroll the selected item visible (directly open the page
* on which it is) when opening the combo box popup or not. Only applies to
* single select mode.
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxPageLength.html b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxPageLength.html
new file mode 100644
index 0000000000..3f0782742f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxPageLength.html
@@ -0,0 +1,176 @@
+<?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>SelectPageLength</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">SelectPageLength</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.combobox.ComboBoxPageLength?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VFilterSelect[0]#button</td>
+ <td>9,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item7</td>
+ <td>61,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VFilterSelect[0]#button</td>
+ <td>10,14</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item7</td>
+ <td>pagelength-8-page-1</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[8]</td>
+ <td>pagelength-8-page-1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>68,7</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0</td>
+ <td>pagelength-8-page-2</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item7</td>
+ <td>pagelength-8-page-2</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[8]</td>
+ <td>pagelength-8-page-2</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>68,7</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0</td>
+ <td>pagelength-8-page-3</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3</td>
+ <td>pagelength-8-page-3</td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[4]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[4]</td>
+ <td>pagelength-8-page-3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3</td>
+ <td>38,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VFilterSelect[0]#button</td>
+ <td>7,9</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0</td>
+ <td>pagelength-20-page-1</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item19</td>
+ <td>pagelength-20-page-1</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[20]</td>
+ <td>pagelength-20-page-1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1</td>
+ <td>126,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]#item0</td>
+ <td>40,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>18,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>51,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VFilterSelect[0]#button</td>
+ <td>11,13</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0</td>
+ <td>pagelength-2-page-2</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1</td>
+ <td>pagelength-2-page-2</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[2]</td>
+ <td>pagelength-2-page-2</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>78,4</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0</td>
+ <td>pagelength-2-page-1</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1</td>
+ <td>pagelength-2-page-1</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[2]</td>
+ <td>pagelength-2-page-1</td>
+</tr>
+</tbody></table>
+</body>
+</html> \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxPageLength.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxPageLength.java
new file mode 100644
index 0000000000..6807b21424
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxPageLength.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxPageLength extends ComboBoxes2<ComboBox> {
+
+ @Override
+ public void initializeComponents() {
+ super.initializeComponents();
+ getComponent().addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ if (event.getProperty() != null) {
+ if (event.getProperty().getValue() != null) {
+ Integer value = Integer.parseInt(((String) event
+ .getProperty().getValue()).split(" ")[1]);
+ getComponent().setPageLength(value);
+ } else {
+ getComponent().setPageLength(0);
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5381;
+ }
+
+ @Override
+ protected String getDescription() {
+ return super.getDescription()
+ + ", changing ComboBox value will change the ComboBox pageLength to the # of the selected item, or to 0 in null selection.";
+ }
+
+}