Project

General

Profile

Download (1.12 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2021 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.dataportal.elements;
10

    
11
import java.util.List;
12
import java.util.stream.Collectors;
13

    
14
import org.openqa.selenium.By;
15
import org.openqa.selenium.WebElement;
16

    
17
import eu.etaxonomy.dataportal.selenium.XPathTools;
18

    
19
/**
20
 * @author a.kohlbecker
21
 * @since Mar 18, 2021
22
 */
23
public class DerivedUnitTree extends BaseElement {
24

    
25

    
26
    private List<DerivedUnitTreeNode> rootNodes = null;
27

    
28

    
29
    public DerivedUnitTree(WebElement element) {
30
        super(element);
31
        rootNodes = element.findElements(By.xpath("./div" + XPathTools.classAttrContains("item-list") +"/ul/li")).stream()
32
        .map(el -> new DerivedUnitTreeNode(el))
33
        .collect(Collectors.toList());
34
    }
35

    
36
    public static DerivedUnitTree from(WebElement element) {
37
        return new DerivedUnitTree(element);
38
    }
39

    
40
    public List<DerivedUnitTreeNode> getRootNodes() {
41
        return rootNodes;
42
    }
43

    
44
}
(4-4/27)