Refactor generic "open in..." framework
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / derivedUnit / PreservedSpecimenDeterminationHistoryDetailSection.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 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
11 package eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit;
12
13 import java.util.Collection;
14 import java.util.HashSet;
15 import java.util.Set;
16
17 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
19 import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
20 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
21 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
22
23 /**
24 * @author n.hoffmann
25 * @created May 11, 2011
26 * @version 1.0
27 */
28 public class PreservedSpecimenDeterminationHistoryDetailSection extends
29 PreservedSpecimenAbstractDeterminationEventDetailSection {
30
31 /**
32 * @param formFactory
33 * @param conversation
34 * @param parentElement
35 * @param style
36 */
37 public PreservedSpecimenDeterminationHistoryDetailSection(CdmFormFactory formFactory,
38 ConversationHolder conversation, ICdmFormElement parentElement,
39 int style) {
40 super(formFactory, conversation, parentElement, "Determination History", style);
41 }
42
43 /* (non-Javadoc)
44 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
45 */
46 @Override
47 public Collection<DeterminationEvent> getCollection(DerivedUnit entity) {
48 if(entity!=null){
49 Set<DeterminationEvent> events = entity.getDeterminations();
50 Set<DeterminationEvent> result = new HashSet<DeterminationEvent>();
51 for (DeterminationEvent event : events){
52 if (event.getPreferredFlag() != true){
53 result.add(event);
54 }
55 }
56 return result;
57 }
58 return null;
59 }
60
61 @Override
62 public void refresh() {
63 internalUpdateSection(false);
64 }
65
66
67 /* (non-Javadoc)
68 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
69 */
70 /** {@inheritDoc} */
71 @Override
72 protected String getTooltipString() {
73 return "Add a determination event to the history";
74 }
75
76 }