Project

General

Profile

« Previous | Next » 

Revision f9517a12

Added by Patrick Plitzner over 7 years ago

ref #5458 Add taxon filter to distribution settings

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/container/TaxonNodeContainer.java
18 18
	private static Map<Object, Object> itemCache = new HashMap<>();
19 19

  
20 20
	/**
21
	 * Creates a new taxon node container
22
	 * @param parentNode the parent node which will <b>not</b> be included
23
	 * in the result but only its child nodes
21
     * Creates a new taxon node container
22
	 * @param roots the root elements of the table
24 23
	 */
25 24
	public TaxonNodeContainer(Collection<UuidAndTitleCache<TaxonNode>> roots) {
26 25
	    addContainerProperty(LABEL, String.class, "[no taxon]");
27 26
	    for (UuidAndTitleCache<TaxonNode> root: roots) {
28 27
	        addItem(root);
29
            addChildItems(root);
28
	        addChildItems(root);
30 29
        }
31 30
	}
32 31

  
......
37 36
	public Item addItem(Object itemId) {
38 37
	    if(itemId instanceof UuidAndTitleCache){
39 38
	        UuidAndTitleCache<TaxonNode> uuidAndTitleCache = (UuidAndTitleCache<TaxonNode>) itemId;
40
            if(!itemCache.keySet().contains(uuidAndTitleCache.getId())){
41
	            Item item = super.addItem(itemId);
42
	            item.getItemProperty(TaxonNodeContainer.LABEL).setValue(uuidAndTitleCache.getTitleCache());
43
	            itemCache.put(((UuidAndTitleCache<TaxonNode>) itemId).getId(), false);
44
                return item;
45
	        }
39
	        Item item = super.addItem(itemId);
40
	        item.getItemProperty(TaxonNodeContainer.LABEL).setValue(uuidAndTitleCache.getTitleCache());
41
	        itemCache.put(((UuidAndTitleCache<TaxonNode>) itemId).getId(), false);
42
	        return item;
46 43
        }
47 44
	    return null;
48 45
	}

Also available in: Unified diff