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.ArrayList;
|
13
|
import java.util.List;
|
14
|
|
15
|
import static junit.framework.Assert.*;
|
16
|
|
17
|
import org.openqa.selenium.By;
|
18
|
import org.openqa.selenium.WebElement;
|
19
|
import org.openqa.selenium.WebElement;
|
20
|
|
21
|
/**
|
22
|
* @author andreas
|
23
|
* @date Jul 4, 2011
|
24
|
*
|
25
|
*/
|
26
|
public class FeatureBlock extends DrupalBlock {
|
27
|
|
28
|
private List<LinkElement> footNoteKeys = new ArrayList<LinkElement>();
|
29
|
|
30
|
private List<BaseElement> footNotes = new ArrayList<BaseElement>();
|
31
|
|
32
|
private List<BaseElement> originalSources = new ArrayList<BaseElement>();
|
33
|
|
34
|
private List<DescriptionElementRepresentation> descriptionElements = new ArrayList<DescriptionElementRepresentation>();
|
35
|
|
36
|
private String featureType = null;
|
37
|
|
38
|
|
39
|
public List<LinkElement> getFootNoteKeys() {
|
40
|
return footNoteKeys;
|
41
|
}
|
42
|
|
43
|
public List<BaseElement> getFootNotes() {
|
44
|
return footNotes;
|
45
|
}
|
46
|
|
47
|
public List<BaseElement> getOriginalSources() {
|
48
|
return originalSources;
|
49
|
}
|
50
|
|
51
|
|
52
|
public List<DescriptionElementRepresentation> getDescriptionElements() {
|
53
|
return descriptionElements;
|
54
|
}
|
55
|
|
56
|
public String getFeatureType() {
|
57
|
return featureType;
|
58
|
}
|
59
|
|
60
|
|
61
|
/**
|
62
|
* @param element
|
63
|
*/
|
64
|
public FeatureBlock(WebElement element, String enclosingTag, String elementTag) {
|
65
|
super(element);
|
66
|
|
67
|
List<WebElement> fnkList = element.findElements(By.className("footnote-key"));
|
68
|
for(WebElement fnk : fnkList) {
|
69
|
footNoteKeys.add(new LinkElement(fnk.findElement(By.tagName("a"))));
|
70
|
}
|
71
|
|
72
|
List<WebElement> fnList = element.findElements(By.className("footnote"));
|
73
|
for(WebElement fn : fnList) {
|
74
|
footNotes.add(new BaseElement(fn));
|
75
|
}
|
76
|
|
77
|
List<WebElement> sourcesList = element.findElements(By.className("sources"));
|
78
|
for(WebElement source : sourcesList) {
|
79
|
originalSources.add(new BaseElement(source));
|
80
|
}
|
81
|
|
82
|
WebElement descriptionElementsRepresentation = element.findElement(By.className("description"));
|
83
|
featureType = descriptionElementsRepresentation.getAttribute("id");
|
84
|
assertEquals("Unexpected tag enclosing description element representations", enclosingTag, descriptionElementsRepresentation.getTagName());
|
85
|
|
86
|
for(WebElement el : descriptionElementsRepresentation.findElements(By.tagName(elementTag))){
|
87
|
descriptionElements.add(new DescriptionElementRepresentation(el));
|
88
|
}
|
89
|
|
90
|
}
|
91
|
|
92
|
|
93
|
|
94
|
|
95
|
}
|