From: Matti Tahvonen Date: Thu, 20 Dec 2007 16:04:05 +0000 (+0000) Subject: ComboBox: fixes #1224 and some false information on status panel X-Git-Tag: 6.7.0.beta1~5205 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=840ea59e0feb5163653b411a7f2b5c8e35a08f44;p=vaadin-framework.git ComboBox: fixes #1224 and some false information on status panel svn changeset:3286/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java index 36a3379f60..238afd859b 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java @@ -132,10 +132,16 @@ public class IFilterSelect extends Composite implements Paintable, setPopupPosition(x, y); final int first = currentPage * PAGELENTH + 1; final int last = first + currentSuggestions.size() - 1; - DOM.setInnerText(status, (totalSuggestions == 0 ? 0 : first) + "-" - + last + "/" + totalSuggestions); + final int matches = totalSuggestions + - (nullSelectionAllowed ? 1 : 0); + if (last > 0) { + DOM.setInnerText(status, (totalSuggestions == 0 ? 0 : first) + + "-" + last + "/" + matches); + } else { + DOM.setInnerText(status, ""); + } setPrevButtonActive(first > 1); - setNextButtonActive(last < totalSuggestions); + setNextButtonActive(last < matches); // clear previously fixed width menu.setWidth(""); @@ -333,9 +339,11 @@ public class IFilterSelect extends Composite implements Paintable, * to avoid height changes when quickly "scrolling" to last page */ public void fixHeightTo(int pagelenth) { - final int pixels = pagelenth * (getOffsetHeight() - 2) - / currentSuggestions.size(); - setHeight((pixels + 2) + "px"); + if (currentSuggestions.size() > 0) { + final int pixels = pagelenth * (getOffsetHeight() - 2) + / currentSuggestions.size(); + setHeight((pixels + 2) + "px"); + } } public void setSuggestions(Collection suggestions) { @@ -446,7 +454,7 @@ public class IFilterSelect extends Composite implements Paintable, } public boolean hasNextPage() { - if (totalSuggestions > (currentPage + 1) * PAGELENTH) { + if (totalMatches > (currentPage + 1) * PAGELENTH) { return true; } else { return false;