Change-Id: I35375d2b39fbd666d848f6ffa62aa0ce1c0d4fadtags/7.4.0.alpha2
@@ -275,7 +275,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
* correctly. This issue manifests when a Combobox is placed in | |||
* another popupView which also needs to calculate the absoluteTop() | |||
* to position itself. #9768 | |||
* | |||
* | |||
* After deferring the showSuggestions method, a problem with | |||
* navigating in the combo box occurs. Because of that the method | |||
* navigateItemAfterPageChange in ComboBoxConnector class, which | |||
@@ -445,7 +445,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
* because otherwise the waiting flag will be reset in | |||
* the first response and the second response will be | |||
* ignored, causing an empty popup... | |||
* | |||
* | |||
* As long as the scrolling delay is suitable | |||
* double/triple clicks will work by scrolling two or | |||
* three pages at a time and this should not be a | |||
@@ -480,7 +480,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.user.client.ui.Widget#onBrowserEvent(com.google.gwt | |||
* .user.client.Event) | |||
@@ -540,7 +540,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.user.client.ui.PopupPanel$PositionCallback#setPosition | |||
* (int, int) | |||
@@ -633,7 +633,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.event.logical.shared.CloseHandler#onClose(com.google | |||
* .gwt.event.logical.shared.CloseEvent) | |||
@@ -978,7 +978,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.user.client.ui.Widget#onBrowserEvent(com.google.gwt | |||
* .user.client.Event) | |||
@@ -1151,7 +1151,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.user.client.ui.Composite#onBrowserEvent(com.google.gwt | |||
* .user.client.Event) | |||
@@ -1478,7 +1478,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt | |||
* .event.dom.client.KeyDownEvent) | |||
@@ -1801,7 +1801,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.event.dom.client.FocusHandler#onFocus(com.google.gwt.event | |||
* .dom.client.FocusEvent) | |||
@@ -1845,7 +1845,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.event.dom.client.BlurHandler#onBlur(com.google.gwt.event | |||
* .dom.client.BlurEvent) | |||
@@ -1885,6 +1885,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
// much of the TAB handling takes place here | |||
if (tabPressedWhenPopupOpen) { | |||
tabPressedWhenPopupOpen = false; | |||
waitingForFilteringResponse = false; | |||
suggestionPopup.menu.doSelectedItemAction(); | |||
suggestionPopup.hide(); | |||
} else if ((!suggestionPopup.isAttached() && waitingForFilteringResponse) | |||
@@ -1909,7 +1910,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see com.vaadin.client.Focusable#focus() | |||
*/ | |||
@@ -1,12 +1,9 @@ | |||
package com.vaadin.tests.components.combobox; | |||
import java.util.Map; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.tests.util.Log; | |||
import com.vaadin.ui.ComboBox; | |||
public class ComboBoxSlow extends TestBase { | |||
@@ -22,19 +19,6 @@ public class ComboBoxSlow extends TestBase { | |||
return "The ComboBox artificially introduces a server delay to more easily spot problems"; | |||
} | |||
public class SlowComboBox extends ComboBox { | |||
@Override | |||
public void changeVariables(Object source, Map<String, Object> variables) { | |||
try { | |||
Thread.sleep(1000); | |||
} catch (InterruptedException e) { | |||
// TODO Auto-generated catch block | |||
e.printStackTrace(); | |||
} | |||
super.changeVariables(source, variables); | |||
} | |||
} | |||
@Override | |||
protected void setup() { | |||
addComponent(log); | |||
@@ -44,11 +28,9 @@ public class ComboBoxSlow extends TestBase { | |||
cb.addItem("Item " + i); | |||
} | |||
cb.addListener(new ValueChangeListener() { | |||
@Override | |||
public void valueChange(ValueChangeEvent event) { | |||
log.log("Value changed to " + cb.getValue()); | |||
} | |||
}); | |||
addComponent(cb); |
@@ -0,0 +1,68 @@ | |||
/* | |||
* Copyright 2000-2014 Vaadin Ltd. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | |||
* use this file except in compliance with the License. You may obtain a copy of | |||
* the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.tests.components.combobox; | |||
import com.vaadin.data.Container; | |||
import com.vaadin.data.util.IndexedContainer; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.shared.ui.combobox.FilteringMode; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
import com.vaadin.ui.TextField; | |||
import com.vaadin.ui.VerticalLayout; | |||
/** | |||
* A test case for typing in combo box input field fast plus then press TAB. | |||
* When type fast and then press tab didn't add new item. Uses SlowComboBox, | |||
* which has a delay in setVariables method | |||
*/ | |||
public class ComboBoxTabWhenFilter extends AbstractTestUI { | |||
public static final String DESCRIPTION = "Adding new item by typing fast plus then press TAB, very quickly, should add new item and change focus."; | |||
@Override | |||
protected void setup(VaadinRequest request) { | |||
final VerticalLayout layout = new VerticalLayout(); | |||
layout.setMargin(true); | |||
setContent(layout); | |||
SlowComboBox comboBox = new SlowComboBox(); | |||
comboBox.setNullSelectionAllowed(false); | |||
comboBox.setImmediate(true); | |||
Container container = createContainer(); | |||
comboBox.setContainerDataSource(container); | |||
comboBox.setNewItemsAllowed(true); | |||
comboBox.setFilteringMode(FilteringMode.CONTAINS); | |||
layout.addComponent(comboBox); | |||
layout.addComponent(new TextField()); | |||
} | |||
private IndexedContainer createContainer() { | |||
IndexedContainer container = new IndexedContainer(); | |||
for (int i = 0; i < 100000; ++i) { | |||
container.addItem("Item " + i); | |||
} | |||
return container; | |||
} | |||
@Override | |||
protected String getTestDescription() { | |||
return DESCRIPTION; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 12325; | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
/* | |||
* Copyright 2000-2014 Vaadin Ltd. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | |||
* use this file except in compliance with the License. You may obtain a copy of | |||
* the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.tests.components.combobox; | |||
import java.util.Map; | |||
import com.vaadin.ui.ComboBox; | |||
/** | |||
* A combo box component with delay. Can be useful to use while testing UI. | |||
*/ | |||
public class SlowComboBox extends ComboBox { | |||
@Override | |||
public void changeVariables(Object source, Map<String, Object> variables) { | |||
try { | |||
Thread.sleep(1000); | |||
} catch (InterruptedException e) { | |||
e.printStackTrace(); | |||
} | |||
super.changeVariables(source, variables); | |||
} | |||
} |