diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-01-05 16:26:22 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-01-07 11:03:06 +0000 |
commit | c7520351fef14334aa80305853afe7dcfff8609f (patch) | |
tree | 6ec81614bff81bb7ef1b4d596ec359e7b81f7432 /uitest | |
parent | bdec494f718d80cbd36363ce2e892647d31898d1 (diff) | |
download | vaadin-framework-c7520351fef14334aa80305853afe7dcfff8609f.tar.gz vaadin-framework-c7520351fef14334aa80305853afe7dcfff8609f.zip |
Support non-AbstractFieldConnector fields with Grid Editor (#19440)
Change-Id: Ib3eaf0b35cfe88391c8ab3b5fcbe668d67c2dd3c
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridWithLabelEditor.java | 154 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridWithLabelEditorTest.java | 37 |
2 files changed, 191 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridWithLabelEditor.java b/uitest/src/com/vaadin/tests/components/grid/GridWithLabelEditor.java new file mode 100644 index 0000000000..91c5a06c66 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/GridWithLabelEditor.java @@ -0,0 +1,154 @@ +/* + * 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.grid; + +import java.util.Collection; + +import com.vaadin.data.Validator; +import com.vaadin.data.Validator.InvalidValueException; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Field; +import com.vaadin.ui.Grid; +import com.vaadin.ui.Label; + +public class GridWithLabelEditor extends AbstractTestUI { + + public class LabelEditor extends Label implements Field<String> { + + @Override + public void focus() { + super.focus(); + } + + @Override + public boolean isInvalidCommitted() { + return false; + } + + @Override + public void setInvalidCommitted(boolean isCommitted) { + } + + @Override + public void commit() throws SourceException, InvalidValueException { + } + + @Override + public void discard() throws SourceException { + } + + @Override + public void setBuffered(boolean buffered) { + } + + @Override + public boolean isBuffered() { + return false; + } + + @Override + public boolean isModified() { + return false; + } + + @Override + public void addValidator(Validator validator) { + } + + @Override + public void removeValidator(Validator validator) { + } + + @Override + public void removeAllValidators() { + } + + @Override + public Collection<Validator> getValidators() { + return null; + } + + @Override + public boolean isValid() { + return true; + } + + @Override + public void validate() throws InvalidValueException { + } + + @Override + public boolean isInvalidAllowed() { + return false; + } + + @Override + public void setInvalidAllowed(boolean invalidValueAllowed) + throws UnsupportedOperationException { + } + + @Override + public int getTabIndex() { + return -1; + } + + @Override + public void setTabIndex(int tabIndex) { + } + + @Override + public boolean isRequired() { + return false; + } + + @Override + public void setRequired(boolean required) { + } + + @Override + public void setRequiredError(String requiredMessage) { + } + + @Override + public String getRequiredError() { + return null; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public void clear() { + } + + } + + @Override + protected void setup(VaadinRequest request) { + Grid grid = new Grid(); + addComponent(grid); + + grid.setEditorEnabled(true); + grid.addColumn("Foo", String.class).setEditorField(new LabelEditor()); + grid.addRow("FooFoo"); + + grid.editItem(grid.getContainerDataSource().firstItemId()); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/grid/GridWithLabelEditorTest.java b/uitest/src/com/vaadin/tests/components/grid/GridWithLabelEditorTest.java new file mode 100644 index 0000000000..7917d0e279 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/GridWithLabelEditorTest.java @@ -0,0 +1,37 @@ +/* + * 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.grid; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.vaadin.testbench.elements.GridElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class GridWithLabelEditorTest extends SingleBrowserTest { + + @Test + public void testNoExceptionOnEdit() { + setDebug(true); + openTestURL(); + + assertNoErrorNotifications(); + + assertEquals("LabelEditor content not correct.", "FooFoo", + $(GridElement.class).first().getEditor().getField(0).getText()); + } +} |