diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-05-03 13:37:56 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-05-03 13:37:56 +0300 |
commit | 3a7e95b98af0e9ad8f1d0160f6a1adcaa6cd8c58 (patch) | |
tree | 2345a81dea9a65f7fab763e3ba197ac82c04e51e | |
parent | 8a77872050b8b51013261458d2c766dc93ff6c11 (diff) | |
download | vaadin-framework-3a7e95b98af0e9ad8f1d0160f6a1adcaa6cd8c58.tar.gz vaadin-framework-3a7e95b98af0e9ad8f1d0160f6a1adcaa6cd8c58.zip |
Fix minor issues with Tree theme and TB API (#9226)
Removes background color from Tree, adds release notes mention, JavaDoc updates.
3 files changed, 38 insertions, 18 deletions
diff --git a/all/src/main/templates/release-notes.html b/all/src/main/templates/release-notes.html index 46b99dd727..d7546701ec 100644 --- a/all/src/main/templates/release-notes.html +++ b/all/src/main/templates/release-notes.html @@ -84,7 +84,7 @@ <ul> <li>Components In Grid</li> <li>HTML5 Drag and Drop support</li> - <li>TreeGrid and HierarchicalDataProvider</li> + <li>TreeGrid, Tree and HierarchicalDataProvider</li> <li>Improved OSGi Support</li> </ul> @@ -100,7 +100,8 @@ <h2 id="incompatible">Incompatible or Behavior-altering Changes in @version@</h2> - <li>The <tt>TreeGrid</tt> component replaces both <tt>TreeTable</tt> and <tt>Tree</tt> component</li> + <li>The <tt>TreeGrid</tt> component replaces <tt>TreeTable</tt> component</li> + <li>The <tt>Tree</tt> component replaces old <tt>Tree</tt> component</li> <li>The <tt>HierarchicalDataProvider</tt> interface replaces <tt>Container.Hierarchical</tt> and <<tt>InMemoryHierarchicalDataProvider</tt> replaces <tt>HierarchicalContainer</tt></li> <li>The <tt>DragSourceExtension</tt> and <tt>DropTargetExtension</tt> extensions replace the old DnD features</li> <li>OSGi bundle manifests of Vaadin Framework JARs no longer export <tt>/VAADIN</tt>, and there are new mechanisms for publishing static resources for OSGi</li> diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeElement.java index 80f90fd349..371cc8b31f 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeElement.java @@ -17,6 +17,7 @@ package com.vaadin.testbench.elements; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; @@ -109,25 +110,40 @@ public class TreeElement extends AbstractComponentElement { } /** - * Gets all items currently shown in this tree. + * Gets all items currently shown in this tree. The returned element objects + * are the rendered contents for each item. * - * @return list of all items + * @return list of content elements for all items */ public List<TestBenchElement> getAllItems() { - return TestBenchElement.wrapElements( - asTreeGrid().getBody().findElements(By.tagName("tr")), - getCommandExecutor()); + return asTreeGrid().getBody().findElements(By.tagName("tr")).stream() + .map(this::findCellContentFromRow).collect(Collectors.toList()); } /** - * Gets an item at given index. + * Gets an item at given index. The returned element object is the rendered + * content in the given index. * * @param index * 0-based row index - * @return item at given index + * @return content element for item at given index */ public TestBenchElement getItem(int index) { - return asTreeGrid().getCell(index, 0); + return findCellContentFromRow(asTreeGrid().getRow(index)); + } + + /** + * Finds the rendered cell content from given row element. This expects the + * row to contain only a single column rendered with TreeRenderer. + * + * @param rowElement + * the row element + * @return cell content element + */ + protected TestBenchElement findCellContentFromRow(WebElement rowElement) { + return TestBenchElement.wrapElement( + rowElement.findElement(By.className("gwt-HTML")), + getCommandExecutor()); } /** diff --git a/themes/src/main/themes/VAADIN/themes/valo/components/_newtree.scss b/themes/src/main/themes/VAADIN/themes/valo/components/_newtree.scss index 9929d7ef47..20af676e4b 100644 --- a/themes/src/main/themes/VAADIN/themes/valo/components/_newtree.scss +++ b/themes/src/main/themes/VAADIN/themes/valo/components/_newtree.scss @@ -6,16 +6,20 @@ $v-newtree-border-radius: 3px; @include valo-treegrid($primary-stylename); + .#{$primary-stylename} { + background-color: transparent; + } + .#{$primary-stylename}-row > td { background-color: transparent; border: none; } - + .#{$primary-stylename}-tablewrapper { background-color: transparent; border: none; } - + .#{$primary-stylename}-row-selected > .#{$primary-stylename}-cell { background-color: transparent; background-image: none; @@ -23,23 +27,23 @@ $v-newtree-border-radius: 3px; text-shadow: none; border: none; } - + .#{$primary-stylename}:focus .#{$primary-stylename}-rowmode-row-focused:before { display: none; } - + .#{$primary-stylename}-cell-content { border: $v-grid-cell-focused-border; border-color: transparent; border-radius: $v-newtree-border-radius; padding: $v-grid-cell-padding; } - - .#{$primary-stylename}:focus .#{$primary-stylename}-rowmode-cell-focused + + .#{$primary-stylename}:focus .#{$primary-stylename}-rowmode-cell-focused > .#{$primary-stylename}-node > .#{$primary-stylename}-cell-content { border: $v-grid-cell-focused-border; } - + // Selected .#{$primary-stylename}-row-selected { $grid-sel-bg: $v-grid-row-selected-background-color; @@ -56,4 +60,3 @@ $v-newtree-border-radius: 3px; } } } - |