Browse Source

ComboBox: fixes #1224 and some false information on status panel

svn changeset:3286/svn branch:trunk
tags/6.7.0.beta1
Matti Tahvonen 16 years ago
parent
commit
840ea59e0f
1 changed files with 15 additions and 7 deletions
  1. 15
    7
      src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java

+ 15
- 7
src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java View File

@@ -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;

Loading…
Cancel
Save