Project

General

Profile

Download (1.82 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2012 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 org.apache.log4j.Logger;
12
import org.openqa.selenium.By;
13
import org.openqa.selenium.NoSuchElementException;
14
import org.openqa.selenium.WebElement;
15

    
16
import eu.etaxonomy.dataportal.CdmEntityClassAttributes;
17

    
18
/**
19
 * @author andreas
20
 * @since Jul 30, 2012
21
 *
22
 */
23
public class TypeDesignationElement extends BaseElement {
24

    
25
    private static final Logger logger = Logger.getLogger(TypeDesignationElement.class);
26

    
27
    private final WebElement status;
28

    
29
    private WebElement nameDescription = null;
30

    
31
    private TypeDesignationType typeDesignationType = null;
32

    
33
    public TypeDesignationElement(WebElement element) {
34
        super(element);
35
        status = element.findElement(By.cssSelector(".status"));
36
        try {
37
            nameDescription = element.findElement(By.cssSelector(".description"));
38
        } catch (NoSuchElementException e) {
39
            // IGNORE
40
        }
41
        CdmEntityClassAttributes attr;
42
        try {
43
            attr = new CdmEntityClassAttributes(element.getAttribute("class"));
44
            typeDesignationType = TypeDesignationType.valueOfCdmClass(attr.getCdmType());
45
        } catch (Exception e) {
46
            logger.error(e);
47
        }
48

    
49
    }
50

    
51
    public String statusToString(){
52
        return status.getText();
53
    }
54

    
55
    public TypeDesignationType getTypeDesignationType() {
56
        return typeDesignationType;
57
    }
58

    
59
    /**
60
     * contains nomenclatorical status, protologues, etc.
61
     *
62
     * @return the nameDescription
63
     */
64
    public WebElement getNameDescription() {
65
        return nameDescription;
66
    }
67

    
68
}
(14-14/15)