aboutsummaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2010-05-27 10:54:52 +0000
committerHenri Sara <henri.sara@itmill.com>2010-05-27 10:54:52 +0000
commit3051f78452bc7687da48400d670f9baefa1ed1b0 (patch)
treedc42093a1d91414b179c3d26f0c994bc12ed20fd /src/com
parent327bf1d1c711941a7bf360fe7d8eb79be7e9f8c1 (diff)
downloadvaadin-framework-3051f78452bc7687da48400d670f9baefa1ed1b0.tar.gz
vaadin-framework-3051f78452bc7687da48400d670f9baefa1ed1b0.zip
#5053 and #5083: Last ComboBox item may not be shown if null selection enabled, incorrect display of filtered items when null selection is allowed
svn changeset:13393/svn branch:6.3
Diffstat (limited to 'src/com')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java12
-rw-r--r--src/com/vaadin/ui/Select.java11
2 files changed, 12 insertions, 11 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
index 6030236073..eb8dc85705 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
@@ -200,20 +200,18 @@ public class VFilterSelect extends Composite implements Paintable, Field,
topPosition += tb.getOffsetHeight();
setPopupPosition(x, topPosition);
- int nullOffset = (nullSelectionAllowed ? 1 : 0);
+ int nullOffset = (nullSelectionAllowed && "".equals(lastFilter) ? 1
+ : 0);
boolean firstPage = (currentPage == 0);
final int first = currentPage * pageLength + 1
- (firstPage ? 0 : nullOffset);
final int last = first + currentSuggestions.size() - 1
- - (firstPage ? nullOffset : 0);
+ - (firstPage && "".equals(lastFilter) ? nullOffset : 0);
final int matches = totalSuggestions - nullOffset;
if (last > 0) {
// nullsel not counted, as requested by user
- DOM.setInnerText(status, (matches == 0 ? 0 : first)
- + "-"
- + ("".equals(lastFilter) && nullSelectionAllowed
- && currentPage == 0 ? last - 1 : last) + "/"
- + matches);
+ DOM.setInnerText(status, (matches == 0 ? 0 : first) + "-"
+ + last + "/" + matches);
} else {
DOM.setInnerText(status, "");
}
diff --git a/src/com/vaadin/ui/Select.java b/src/com/vaadin/ui/Select.java
index 467a21b259..0f33529714 100644
--- a/src/com/vaadin/ui/Select.java
+++ b/src/com/vaadin/ui/Select.java
@@ -165,11 +165,14 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering,
}
List options = getFilteredOptions();
- options = sanitetizeList(options, needNullSelectOption);
+ boolean nullFilteredOut = filterstring != null
+ && !"".equals(filterstring)
+ && filteringMode != FILTERINGMODE_OFF;
+ options = sanitetizeList(options, needNullSelectOption
+ && !nullFilteredOut);
final boolean paintNullSelection = needNullSelectOption
- && (currentPage == 0 && (getFilteringMode() == FILTERINGMODE_OFF
- || filterstring == null || filterstring.equals("")));
+ && currentPage == 0 && !nullFilteredOut;
if (paintNullSelection) {
target.startTag("so");
@@ -218,7 +221,7 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering,
+ (needNullSelectOption ? 1 : 0));
if (filteredOptions != null) {
target.addAttribute("totalMatches", filteredOptions.size()
- + (needNullSelectOption ? 1 : 0));
+ + (needNullSelectOption && !nullFilteredOut ? 1 : 0));
}
// Paint variables