diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2014-12-15 16:31:26 +0200 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2014-12-17 14:28:55 +0200 |
commit | 6ed909f2c61f7d434d1c91549dcda27cfa3698a8 (patch) | |
tree | ca0f593f146bf7d24e3747fe7cf764b82a4062ea /uitest | |
parent | 4a3a97c0d07861568d336ac7f3e0ed496dc8fcbb (diff) | |
download | vaadin-framework-6ed909f2c61f7d434d1c91549dcda27cfa3698a8.tar.gz vaadin-framework-6ed909f2c61f7d434d1c91549dcda27cfa3698a8.zip |
Change "editor row" to just "editor" in method names and javadoc (#13334)
Change-Id: Idafdbe3d71a38a979e1eeb07c527f66ce61ccfa9
Diffstat (limited to 'uitest')
8 files changed, 118 insertions, 120 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/EditorRowUI.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java index 3891583098..fe4b4342a2 100644 --- a/uitest/src/com/vaadin/tests/components/grid/EditorRowUI.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java @@ -22,7 +22,7 @@ import com.vaadin.ui.Grid; import com.vaadin.ui.PasswordField; import com.vaadin.ui.TextField; -public class EditorRowUI extends AbstractTestUI { +public class GridEditorUI extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { @@ -33,15 +33,15 @@ public class EditorRowUI extends AbstractTestUI { // Don't use address since there's no converter grid.removeColumn("address"); - grid.setEditorRowEnabled(true); + grid.setEditorEnabled(true); - grid.setEditorRowField("firstName", new PasswordField()); + grid.setEditorField("firstName", new PasswordField()); TextField lastNameField = (TextField) grid - .getEditorRowField("lastName"); + .getEditorField("lastName"); lastNameField.setMaxLength(50); - grid.getEditorRowField("phoneNumber").setReadOnly(true); + grid.getEditorField("phoneNumber").setReadOnly(true); addComponent(grid); } diff --git a/uitest/src/com/vaadin/tests/components/grid/EditorRowUITest.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java index 269f997c95..6c386eec03 100644 --- a/uitest/src/com/vaadin/tests/components/grid/EditorRowUITest.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java @@ -30,29 +30,29 @@ import com.vaadin.tests.annotations.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("grid") -public class EditorRowUITest extends MultiBrowserTest { +public class GridEditorUITest extends MultiBrowserTest { @Test - public void testEditorRow() { + public void testEditor() { setDebug(true); openTestURL(); assertFalse("Sanity check", isElementPresent(PasswordFieldElement.class)); - openEditorRow(5); + openEditor(5); new Actions(getDriver()).sendKeys(Keys.ESCAPE).perform(); - openEditorRow(10); + openEditor(10); - assertTrue("Edtor row should be opened with a password field", + assertTrue("Edtor should be opened with a password field", isElementPresent(PasswordFieldElement.class)); assertFalse("Notification was present", isElementPresent(NotificationElement.class)); } - private void openEditorRow(int rowIndex) { + private void openEditor(int rowIndex) { GridElement grid = $(GridElement.class).first(); GridCellElement cell = grid.getCell(rowIndex, 1); diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index 62f3488447..9aceef70bb 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -189,7 +189,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { grid.setSelectionMode(SelectionMode.NONE); - grid.getEditorRowField(getColumnProperty(3)).setReadOnly(true); + grid.getEditorField(getColumnProperty(3)).setReadOnly(true); createGridActions(); @@ -203,7 +203,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { createRowActions(); - createEditorRowActions(); + createEditorActions(); addHeightActions(); @@ -853,48 +853,46 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { }, null); } - protected void createEditorRowActions() { - createBooleanAction("Enabled", "Editor row", false, + protected void createEditorActions() { + createBooleanAction("Enabled", "Editor", false, new Command<Grid, Boolean>() { @Override public void execute(Grid c, Boolean value, Object data) { - c.setEditorRowEnabled(value); + c.setEditorEnabled(value); } }); - createClickAction("Edit item 5", "Editor row", - new Command<Grid, String>() { - @Override - public void execute(Grid c, String value, Object data) { - c.editItem(5); - } - }, null); + createClickAction("Edit item 5", "Editor", new Command<Grid, String>() { + @Override + public void execute(Grid c, String value, Object data) { + c.editItem(5); + } + }, null); - createClickAction("Edit item 100", "Editor row", + createClickAction("Edit item 100", "Editor", new Command<Grid, String>() { @Override public void execute(Grid c, String value, Object data) { c.editItem(100); } }, null); - createClickAction("Save", "Editor row", new Command<Grid, String>() { + createClickAction("Save", "Editor", new Command<Grid, String>() { @Override public void execute(Grid c, String value, Object data) { try { - c.saveEditorRow(); + c.saveEditor(); } catch (CommitException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, null); - createClickAction("Cancel edit", "Editor row", - new Command<Grid, String>() { - @Override - public void execute(Grid c, String value, Object data) { - c.cancelEditorRow(); - } - }, null); + createClickAction("Cancel edit", "Editor", new Command<Grid, String>() { + @Override + public void execute(Grid c, String value, Object data) { + c.cancelEditor(); + } + }, null); } @SuppressWarnings("boxing") diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java index 50e1034b50..279f75492e 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java @@ -90,11 +90,11 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { return footerCells; } - protected WebElement getEditorRow() { + protected WebElement getEditor() { List<WebElement> elems = getGridElement().findElements( By.className("v-grid-editor-row")); - assertLessThanOrEqual("number of editor rows", elems.size(), 1); + assertLessThanOrEqual("number of editors", elems.size(), 1); return elems.isEmpty() ? null : elems.get(0); } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientCompositeEditorRowTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientCompositeEditorTest.java index 1fa8549b1c..29e6fed68c 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientCompositeEditorRowTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientCompositeEditorTest.java @@ -2,7 +2,7 @@ package com.vaadin.tests.components.grid.basicfeatures.client; import org.junit.Before; -public class GridClientCompositeEditorRowTest extends GridEditorRowClientTest { +public class GridClientCompositeEditorTest extends GridEditorClientTest { @Override @Before diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorRowClientTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java index f3c49db39e..5db7f3a0b9 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorRowClientTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java @@ -34,34 +34,34 @@ import org.openqa.selenium.interactions.Actions; import com.vaadin.tests.components.grid.basicfeatures.GridBasicClientFeaturesTest; import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeatures; -public class GridEditorRowClientTest extends GridBasicClientFeaturesTest { +public class GridEditorClientTest extends GridBasicClientFeaturesTest { @Before public void setUp() { openTestURL(); - selectMenuPath("Component", "Editor row", "Enabled"); + selectMenuPath("Component", "Editor", "Enabled"); } @Test public void testProgrammaticOpeningClosing() { - selectMenuPath("Component", "Editor row", "Edit row 5"); - assertNotNull(getEditorRow()); + selectMenuPath("Component", "Editor", "Edit row 5"); + assertNotNull(getEditor()); - selectMenuPath("Component", "Editor row", "Cancel edit"); - assertNull(getEditorRow()); + selectMenuPath("Component", "Editor", "Cancel edit"); + assertNull(getEditor()); assertEquals("Row 5 edit cancelled", - findElement(By.className("editor-row-log")).getText()); + findElement(By.className("grid-editor-log")).getText()); } @Test public void testProgrammaticOpeningWithScroll() { - selectMenuPath("Component", "Editor row", "Edit row 100"); - assertNotNull(getEditorRow()); + selectMenuPath("Component", "Editor", "Edit row 100"); + assertNotNull(getEditor()); } @Test(expected = NoSuchElementException.class) public void testVerticalScrollLocking() { - selectMenuPath("Component", "Editor row", "Edit row 5"); + selectMenuPath("Component", "Editor", "Edit row 5"); getGridElement().getCell(200, 0); } @@ -72,27 +72,27 @@ public class GridEditorRowClientTest extends GridBasicClientFeaturesTest { new Actions(getDriver()).sendKeys(Keys.ENTER).perform(); - assertNotNull(getEditorRow()); + assertNotNull(getEditor()); new Actions(getDriver()).sendKeys(Keys.ESCAPE).perform(); - assertNull(getEditorRow()); + assertNull(getEditor()); assertEquals("Row 4 edit cancelled", - findElement(By.className("editor-row-log")).getText()); + findElement(By.className("grid-editor-log")).getText()); - // Disable editor row - selectMenuPath("Component", "Editor row", "Enabled"); + // Disable editor + selectMenuPath("Component", "Editor", "Enabled"); getGridElement().getCell(5, 0).click(); new Actions(getDriver()).sendKeys(Keys.ENTER).perform(); - assertNull(getEditorRow()); + assertNull(getEditor()); } @Test public void testWidgetBinding() throws Exception { - selectMenuPath("Component", "Editor row", "Edit row 100"); - WebElement editorRow = getEditorRow(); + selectMenuPath("Component", "Editor", "Edit row 100"); + WebElement editor = getEditor(); - List<WebElement> widgets = editorRow.findElements(By + List<WebElement> widgets = editor.findElements(By .className("gwt-TextBox")); assertEquals(GridBasicFeatures.COLUMNS, widgets.size()); @@ -108,10 +108,10 @@ public class GridEditorRowClientTest extends GridBasicClientFeaturesTest { @Test public void testWithSelectionColumn() throws Exception { selectMenuPath("Component", "State", "Selection mode", "multi"); - selectMenuPath("Component", "State", "Editor row", "Edit row 5"); + selectMenuPath("Component", "State", "Editor", "Edit row 5"); - WebElement editorRow = getEditorRow(); - List<WebElement> selectorDivs = editorRow.findElements(By + WebElement editor = getEditor(); + List<WebElement> selectorDivs = editor.findElements(By .cssSelector("div")); assertTrue("selector column cell should've been empty", selectorDivs @@ -122,15 +122,15 @@ public class GridEditorRowClientTest extends GridBasicClientFeaturesTest { @Test public void testSave() { - selectMenuPath("Component", "Editor row", "Edit row 100"); + selectMenuPath("Component", "Editor", "Edit row 100"); - WebElement textField = getEditorRow().findElements( + WebElement textField = getEditor().findElements( By.className("gwt-TextBox")).get(0); textField.clear(); textField.sendKeys("Changed"); - WebElement saveButton = getEditorRow().findElement( + WebElement saveButton = getEditor().findElement( By.className("v-editor-row-save")); saveButton.click(); @@ -140,15 +140,15 @@ public class GridEditorRowClientTest extends GridBasicClientFeaturesTest { @Test public void testProgrammaticSave() { - selectMenuPath("Component", "Editor row", "Edit row 100"); + selectMenuPath("Component", "Editor", "Edit row 100"); - WebElement textField = getEditorRow().findElements( + WebElement textField = getEditor().findElements( By.className("gwt-TextBox")).get(0); textField.clear(); textField.sendKeys("Changed"); - selectMenuPath("Component", "Editor row", "Save"); + selectMenuPath("Component", "Editor", "Save"); assertEquals("Changed", getGridElement().getCell(100, 0).getText()); } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorRowTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java index f07d33080d..2afa9ec04e 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorRowTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java @@ -18,6 +18,7 @@ package com.vaadin.tests.components.grid.basicfeatures.server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.util.List; @@ -32,53 +33,52 @@ import org.openqa.selenium.interactions.Actions; import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeatures; import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest; -public class GridEditorRowTest extends GridBasicFeaturesTest { +public class GridEditorTest extends GridBasicFeaturesTest { @Before public void setUp() { openTestURL(); - selectMenuPath("Component", "Editor row", "Enabled"); + selectMenuPath("Component", "Editor", "Enabled"); } @Test public void testProgrammaticOpeningClosing() { - selectMenuPath("Component", "Editor row", "Edit item 5"); - assertEditorRowOpen(); + selectMenuPath("Component", "Editor", "Edit item 5"); + assertEditorOpen(); - selectMenuPath("Component", "Editor row", "Cancel edit"); - assertEditorRowClosed(); + selectMenuPath("Component", "Editor", "Cancel edit"); + assertEditorClosed(); } @Test public void testProgrammaticOpeningWhenDisabled() { - selectMenuPath("Component", "Editor row", "Enabled"); - selectMenuPath("Component", "Editor row", "Edit item 5"); - assertEditorRowClosed(); - assertEquals( - "5. Exception occured, java.lang.IllegalStateExceptionEditor row is not enabled", - getLogRow(0)); + selectMenuPath("Component", "Editor", "Enabled"); + selectMenuPath("Component", "Editor", "Edit item 5"); + assertEditorClosed(); + boolean thrown = getLogRow(0).startsWith( + "5. Exception occured, java.lang.IllegalStateException"); + assertTrue("IllegalStateException thrown", thrown); } @Test public void testDisablingWhileOpen() { - selectMenuPath("Component", "Editor row", "Edit item 5"); - selectMenuPath("Component", "Editor row", "Enabled"); - assertEditorRowOpen(); - assertEquals( - "5. Exception occured, java.lang.IllegalStateExceptionCannot disable the editor row while an item (5) is being edited.", - getLogRow(0)); - + selectMenuPath("Component", "Editor", "Edit item 5"); + selectMenuPath("Component", "Editor", "Enabled"); + assertEditorOpen(); + boolean thrown = getLogRow(0).startsWith( + "5. Exception occured, java.lang.IllegalStateException"); + assertTrue("IllegalStateException thrown", thrown); } @Test public void testProgrammaticOpeningWithScroll() { - selectMenuPath("Component", "Editor row", "Edit item 100"); - assertEditorRowOpen(); + selectMenuPath("Component", "Editor", "Edit item 100"); + assertEditorOpen(); } @Test(expected = NoSuchElementException.class) public void testVerticalScrollLocking() { - selectMenuPath("Component", "Editor row", "Edit item 5"); + selectMenuPath("Component", "Editor", "Edit item 5"); getGridElement().getCell(200, 0); } @@ -86,24 +86,24 @@ public class GridEditorRowTest extends GridBasicFeaturesTest { public void testKeyboardOpeningClosing() { getGridElement().getCell(4, 0).click(); - assertEditorRowClosed(); + assertEditorClosed(); new Actions(getDriver()).sendKeys(Keys.ENTER).perform(); - assertEditorRowOpen(); + assertEditorOpen(); new Actions(getDriver()).sendKeys(Keys.ESCAPE).perform(); - assertEditorRowClosed(); + assertEditorClosed(); - // Disable editor row - selectMenuPath("Component", "Editor row", "Enabled"); + // Disable Editor + selectMenuPath("Component", "Editor", "Enabled"); getGridElement().getCell(5, 0).click(); new Actions(getDriver()).sendKeys(Keys.ENTER).perform(); - assertEditorRowClosed(); + assertEditorClosed(); } @Test public void testComponentBinding() { - selectMenuPath("Component", "State", "Editor row", "Edit item 100"); + selectMenuPath("Component", "State", "Editor", "Edit item 100"); List<WebElement> widgets = getEditorWidgets(); assertEquals("Number of widgets", GridBasicFeatures.COLUMNS, @@ -117,7 +117,7 @@ public class GridEditorRowTest extends GridBasicFeaturesTest { @Test public void testSave() { - selectMenuPath("Component", "Editor row", "Edit item 100"); + selectMenuPath("Component", "Editor", "Edit item 100"); WebElement textField = getEditorWidgets().get(0); @@ -125,7 +125,7 @@ public class GridEditorRowTest extends GridBasicFeaturesTest { textField.sendKeys(" changed"); - WebElement saveButton = getEditorRow().findElement( + WebElement saveButton = getEditor().findElement( By.className("v-editor-row-save")); saveButton.click(); @@ -136,7 +136,7 @@ public class GridEditorRowTest extends GridBasicFeaturesTest { @Test public void testProgrammaticSave() { - selectMenuPath("Component", "Editor row", "Edit item 100"); + selectMenuPath("Component", "Editor", "Edit item 100"); WebElement textField = getEditorWidgets().get(0); @@ -144,25 +144,25 @@ public class GridEditorRowTest extends GridBasicFeaturesTest { textField.sendKeys(" changed"); - selectMenuPath("Component", "Editor row", "Save"); + selectMenuPath("Component", "Editor", "Save"); assertEquals("(100, 0) changed", getGridElement().getCell(100, 0) .getText()); } - private void assertEditorRowOpen() { - assertNotNull("Editor row open", getEditorRow()); + private void assertEditorOpen() { + assertNotNull("Editor open", getEditor()); assertEquals("Number of widgets", GridBasicFeatures.COLUMNS, getEditorWidgets().size()); } - private void assertEditorRowClosed() { - assertNull("Editor row closed", getEditorRow()); + private void assertEditorClosed() { + assertNull("Editor closed", getEditor()); } private List<WebElement> getEditorWidgets() { - assertNotNull(getEditorRow()); - return getEditorRow().findElements(By.className("v-textfield")); + assertNotNull(getEditor()); + return getEditor().findElements(By.className("v-textfield")); } } diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java index 71fc47277f..f66347bd2d 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java @@ -46,7 +46,7 @@ import com.vaadin.client.widget.escalator.Cell; import com.vaadin.client.widget.escalator.FlyweightCell; import com.vaadin.client.widget.grid.CellReference; import com.vaadin.client.widget.grid.CellStyleGenerator; -import com.vaadin.client.widget.grid.EditorRowHandler; +import com.vaadin.client.widget.grid.EditorHandler; import com.vaadin.client.widget.grid.RowReference; import com.vaadin.client.widget.grid.RowStyleGenerator; import com.vaadin.client.widget.grid.datasources.ListDataSource; @@ -92,19 +92,19 @@ public class GridBasicClientFeaturesWidget extends TEXT_RENDERER, HTML_RENDERER, NUMBER_RENDERER, DATE_RENDERER; } - private class TestEditorRowHandler implements EditorRowHandler<List<Data>> { + private class TestEditorHandler implements EditorHandler<List<Data>> { private Map<Grid.Column<?, ?>, TextBox> widgets = new HashMap<Grid.Column<?, ?>, TextBox>(); private Label log = new Label(); { - log.addStyleName("editor-row-log"); + log.addStyleName("grid-editor-log"); addSouth(log, 20); } @Override - public void bind(EditorRowRequest<List<Data>> request) { + public void bind(EditorRequest<List<Data>> request) { List<Data> rowData = ds.getRow(request.getRowIndex()); boolean hasSelectionColumn = !(grid.getSelectionModel() instanceof None); @@ -117,13 +117,13 @@ public class GridBasicClientFeaturesWidget extends } @Override - public void cancel(EditorRowRequest<List<Data>> request) { + public void cancel(EditorRequest<List<Data>> request) { log.setText("Row " + request.getRowIndex() + " edit cancelled"); request.invokeCallback(); } @Override - public void save(EditorRowRequest<List<Data>> request) { + public void save(EditorRequest<List<Data>> request) { log.setText("Row " + request.getRowIndex() + " edit committed"); List<Data> rowData = ds.getRow(request.getRowIndex()); @@ -252,7 +252,7 @@ public class GridBasicClientFeaturesWidget extends grid.setDataSource(ds); grid.addSelectAllHandler(ds.getSelectAllHandler()); grid.setSelectionMode(SelectionMode.NONE); - grid.setEditorRowHandler(new TestEditorRowHandler()); + grid.setEditorHandler(new TestEditorHandler()); sorter = new ListSorter<List<Data>>(grid); @@ -377,7 +377,7 @@ public class GridBasicClientFeaturesWidget extends createColumnsMenu(); createHeaderMenu(); createFooterMenu(); - createEditorRowMenu(); + createEditorMenu(); createInternalsMenu(); createDataSourceMenu(); @@ -906,41 +906,41 @@ public class GridBasicClientFeaturesWidget extends }, menuPath); } - private void createEditorRowMenu() { + private void createEditorMenu() { addMenuCommand("Enabled", new ScheduledCommand() { @Override public void execute() { - grid.setEditorRowEnabled(!grid.isEditorRowEnabled()); + grid.setEditorEnabled(!grid.isEditorEnabled()); } - }, "Component", "Editor row"); + }, "Component", "Editor"); addMenuCommand("Edit row 5", new ScheduledCommand() { @Override public void execute() { grid.editRow(5); } - }, "Component", "Editor row"); + }, "Component", "Editor"); addMenuCommand("Edit row 100", new ScheduledCommand() { @Override public void execute() { grid.editRow(100); } - }, "Component", "Editor row"); + }, "Component", "Editor"); addMenuCommand("Save", new ScheduledCommand() { @Override public void execute() { - grid.saveEditorRow(); + grid.saveEditor(); } - }, "Component", "Editor row"); + }, "Component", "Editor"); addMenuCommand("Cancel edit", new ScheduledCommand() { @Override public void execute() { - grid.cancelEditorRow(); + grid.cancelEditor(); } - }, "Component", "Editor row"); + }, "Component", "Editor"); } |