1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2011 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.dataportal.elements;
|
11
|
|
12
|
import java.util.Arrays;
|
13
|
import java.util.List;
|
14
|
|
15
|
import org.openqa.selenium.RenderedWebElement;
|
16
|
|
17
|
/**
|
18
|
* @author andreas
|
19
|
* @date Jul 1, 2011
|
20
|
*
|
21
|
*/
|
22
|
public class BaseElement {
|
23
|
|
24
|
public List<String> classAttributes = null;
|
25
|
|
26
|
private String text = null;
|
27
|
|
28
|
public String getText() {
|
29
|
return text;
|
30
|
}
|
31
|
|
32
|
public void setText(String text) {
|
33
|
this.text = text;
|
34
|
}
|
35
|
|
36
|
public List<String> getClassAttributes() {
|
37
|
return classAttributes;
|
38
|
}
|
39
|
|
40
|
public void setClassAttributes(List<String> classAttributes) {
|
41
|
this.classAttributes = classAttributes;
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* @param element
|
46
|
*/
|
47
|
public BaseElement(RenderedWebElement element) {
|
48
|
|
49
|
// read text
|
50
|
text = element.getText();
|
51
|
|
52
|
// read and tokenize the class attribute
|
53
|
if (element.getAttribute("class") != null) {
|
54
|
String[] classTokens = element.getAttribute("class").split("\\s");
|
55
|
setClassAttributes(Arrays.asList(classTokens));
|
56
|
}
|
57
|
}
|
58
|
|
59
|
}
|