Project

General

Profile

Revision c2c4af3c

IDc2c4af3c84cf7816e91210f9de8397726a186f66
Parent 9fde8b52
Child e203f88d

Added by Patrick Plitzner about 4 years ago

ref #5458 Add root node to node container constructor

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/container/TaxonNodeContainer.java
17 17
public class TaxonNodeContainer extends IndexedContainer {
18 18

  
19 19
	public static final String LABEL = "label";
20

  
21
	public TaxonNodeContainer() {
22
		List<TaxonNode> taxonNodeList = getTaxonNodeList();
20
	
21
	/**
22
	 * Creates a new taxon node container
23
	 * @param parentNode the parent node which will <b>not</b> be included
24
	 * in the result but only its child nodes
25
	 */
26
	public TaxonNodeContainer(TaxonNode parentNode) {
27
		List<TaxonNode> taxonNodeList = getTaxonNodeList(parentNode);
23 28
		addContainerProperty(LABEL, String.class, "[no taxon]");
24 29
		for (TaxonNode taxonNode : taxonNodeList) {
25 30
			Item item = addItem(taxonNode);
......
32 37
		}
33 38
	}
34 39
	
35
	public List<TaxonNode> getTaxonNodeList() {
40
	public List<TaxonNode> getTaxonNodeList(TaxonNode parentNode) {
36 41
		List<TaxonNode> nodes = new ArrayList<TaxonNode>();
37 42
		
38 43
		List<String> nodeInitStrategy = Arrays.asList(new String[]{
......
41 46
	            "classification"
42 47
	    });
43 48

  
44
		IClassificationService classificationService = CdmSpringContextHelper.getClassificationService();
45
		List<Classification> classificationList = classificationService.listClassifications(null, null, null, nodeInitStrategy);
46
		for (Classification classification : classificationList) {
47
			nodes.add(classification.getRootNode());
49
		if(parentNode==null){
50
			//just load classifications
51
			IClassificationService classificationService = CdmSpringContextHelper.getClassificationService();
52
			List<Classification> classificationList = classificationService.listClassifications(null, null, null, nodeInitStrategy);
53
			for (Classification classification : classificationList) {
54
				nodes.add(classification.getRootNode());
55
			}
48 56
		}
49
		for (Classification classification : classificationList) {
50
			nodes.addAll(addChildNodes(classification.getRootNode()));
57
		else{
58
			//load child nodes
59
			nodes.addAll(addChildNodes(parentNode));
51 60
		}
52 61
		return nodes;
53 62
	}
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/SettingsConfigWindow.java
69 69
    }
70 70

  
71 71
    private void init() {
72
        Container taxonNodeContainer = new TaxonNodeContainer();
72
        Container taxonNodeContainer = new TaxonNodeContainer(null);
73 73
        Container distributionContainer = presenter.getDistributionContainer();
74 74
        TermVocabulary chosenArea = presenter.getChosenArea();
75 75
        taxoNodeBox.setItemCaptionPropertyId(TaxonNodeContainer.LABEL);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)