From: Pekka Hyvönen Date: Tue, 11 Dec 2012 10:47:49 +0000 (+0200) Subject: ComboBox should have getter and setter methods for pageLength #5381 X-Git-Tag: 7.0.0.beta11~47^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2a6e9153c9589f4aac37593945ace8499eb32305;p=vaadin-framework.git ComboBox should have getter and setter methods for pageLength #5381 Change-Id: I92597e49f2dc12c9fb90c2a35a213386da56bb3f --- 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 @@ -791,6 +791,27 @@ public class ComboBox extends AbstractSelect implements return false; } + /** + * 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 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 @@ + + + + + + +SelectPageLength + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SelectPageLength
open/run/com.vaadin.tests.components.combobox.ComboBoxPageLength?restartApplication
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VFilterSelect[0]#button9,12
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item761,8
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VFilterSelect[0]#button10,14
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item7pagelength-8-page-1
assertElementNotPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[8]pagelength-8-page-1
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]68,7
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0pagelength-8-page-2
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item7pagelength-8-page-2
assertElementNotPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[8]pagelength-8-page-2
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]68,7
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0pagelength-8-page-3
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3pagelength-8-page-3
waitForElementNotPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[4]
assertElementNotPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[4]pagelength-8-page-3
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item338,6
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VFilterSelect[0]#button7,9
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0pagelength-20-page-1
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item19pagelength-20-page-1
assertElementNotPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[20]pagelength-20-page-1
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1126,7
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]#item040,5
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VOverlay[0]/VMenuBar[0]#item418,11
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VOverlay[1]/VMenuBar[0]#item051,10
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::/VVerticalLayout[0]/VVerticalLayout[0]/VFilterSelect[0]#button11,13
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0pagelength-2-page-2
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1pagelength-2-page-2
assertElementNotPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[2]pagelength-2-page-2
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[0]/domChild[0]78,4
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0pagelength-2-page-1
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1pagelength-2-page-1
assertElementNotPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxPageLength::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[2]pagelength-2-page-1
+ + \ 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 { + + @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."; + } + +}