diff options
author | Ilia Motornyi <elmot@vaadin.com> | 2018-02-15 15:33:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-15 15:33:05 +0200 |
commit | 6d84351fee4bdb6e877d9100c8645e6c6044864e (patch) | |
tree | e11270aa15b3b348b9ee3ff8714fc126b4a6af34 /uitest/src/main | |
parent | fd4dedf921f6cf0f80bfedac8474562b41325e56 (diff) | |
download | vaadin-framework-6d84351fee4bdb6e877d9100c8645e6c6044864e.tar.gz vaadin-framework-6d84351fee4bdb6e877d9100c8645e6c6044864e.zip |
Allow configuring content modes for Grid cell tooltips (#10632)
* Allow configuring content modes for Grid cell tooltips
Diffstat (limited to 'uitest/src/main')
-rw-r--r-- | uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java index 700a79d14a..354222ce4f 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -30,6 +30,7 @@ import java.util.Random; import com.vaadin.annotations.Theme; import com.vaadin.shared.data.sort.SortDirection; +import com.vaadin.shared.ui.ContentMode; import com.vaadin.tests.components.AbstractComponentTest; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -138,7 +139,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { @Override public String getDescription(RowReference row) { - return "Row tooltip for row " + row.getItemId(); + return "<b>Row</b> tooltip\n for row " + row.getItemId(); } }; @@ -147,7 +148,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { @Override public String getDescription(CellReference cell) { if ("Column 0".equals(cell.getPropertyId())) { - return "Cell tooltip for row " + cell.getItemId() + return "<b>Cell</b> tooltip\n for row " + cell.getItemId() + ", column 0"; } else { return null; @@ -668,22 +669,40 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }); - createBooleanAction("Row description generator", "State", false, - new Command<Grid, Boolean>() { + LinkedHashMap<String, ContentMode> contentModes = new LinkedHashMap<String, ContentMode>(); + contentModes.put("None", null); + // Abusing an unused value for this special case + contentModes.put("Plain text", ContentMode.TEXT); + contentModes.put("Preformatted(Default)", ContentMode.PREFORMATTED); + contentModes.put("HTML", ContentMode.HTML); + createSelectAction("Row description generator", "State", contentModes, + "None", new Command<Grid, ContentMode>() { @Override - public void execute(Grid c, Boolean value, Object data) { - c.setRowDescriptionGenerator( - value ? rowDescriptionGenerator : null); + public void execute(Grid grid, ContentMode mode, Object data) { + if (mode == null) { + grid.setRowDescriptionGenerator(null); + } else if (mode == ContentMode.PREFORMATTED) { + grid.setRowDescriptionGenerator(rowDescriptionGenerator); + } else { + grid.setRowDescriptionGenerator( + rowDescriptionGenerator, mode); + } } }); - createBooleanAction("Cell description generator", "State", false, - new Command<Grid, Boolean>() { + createSelectAction("Cell description generator", "State", + contentModes, "None", new Command<Grid, ContentMode>() { @Override - public void execute(Grid c, Boolean value, Object data) { - c.setCellDescriptionGenerator( - value ? cellDescriptionGenerator : null); + public void execute(Grid grid, ContentMode mode, Object data) { + if (mode == null) { + grid.setCellDescriptionGenerator(null); + } else if (mode == ContentMode.PREFORMATTED) { + grid.setCellDescriptionGenerator(cellDescriptionGenerator); + } else { + grid.setCellDescriptionGenerator( + cellDescriptionGenerator, mode); + } } }); |