Project

General

Profile

Download (2.13 KB) Statistics
| Branch: | Tag: | Revision:
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.RenderedWebElement;
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<String> footNoteKeys = new ArrayList<String>();
29

    
30
	private List<String> footNotes = new ArrayList<String>();
31

    
32
	private List<DescriptionElementRepresentation> descriptionElements = new ArrayList<DescriptionElementRepresentation>();
33

    
34
	private String featureType = null;
35

    
36

    
37
	public List<String> getFootNoteKeys() {
38
		return footNoteKeys;
39
	}
40

    
41
	public List<String> getFootNotes() {
42
		return footNotes;
43
	}
44

    
45
	public List<DescriptionElementRepresentation> getDescriptionElements() {
46
		return descriptionElements;
47
	}
48

    
49
	public String getFeatureType() {
50
		return featureType;
51
	}
52

    
53

    
54
	/**
55
	 * @param element
56
	 */
57
	public FeatureBlock(RenderedWebElement element, String enclosingTag, String elementTag) {
58
		super(element);
59

    
60
		List<WebElement> fnkList = element.findElements(By.className("footnote-key"));
61
		for(WebElement fnk : fnkList) {
62
			footNoteKeys.add(fnk.getText());
63
		}
64

    
65
		List<WebElement> fnList = element.findElements(By.className("footnote"));
66
		for(WebElement fn : fnList) {
67
			footNotes.add(fn.getText());
68
		}
69

    
70
		RenderedWebElement descriptionElementsRepresentation = (RenderedWebElement) element.findElement(By.className("description"));
71
		featureType = descriptionElementsRepresentation.getAttribute("id");
72
		assertEquals("Unexpected tag enclosing description element representations", enclosingTag, descriptionElementsRepresentation.getTagName());
73

    
74
		for(WebElement el : descriptionElementsRepresentation.findElements(By.tagName(elementTag))){
75
			descriptionElements.add(new DescriptionElementRepresentation((RenderedWebElement)el));
76
		}
77

    
78
	}
79

    
80

    
81

    
82
}
(4-4/6)