3 * Copyright (C) 2018 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.feature
;
12 import java
.util
.Collection
;
13 import java
.util
.Comparator
;
15 import org
.eclipse
.core
.runtime
.IStatus
;
16 import org
.eclipse
.jface
.wizard
.WizardDialog
;
17 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
18 import eu
.etaxonomy
.cdm
.persistence
.dto
.FeatureStateDto
;
19 import eu
.etaxonomy
.cdm
.persistence
.dto
.FeatureStateDtoComparator
;
20 import eu
.etaxonomy
.cdm
.persistence
.dto
.TermNodeDto
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
31 public class InapplicableIfEntityCollectionSection
extends AbstractEntityCollectionSection
<TermNodeDto
, FeatureStateDto
>{
33 public InapplicableIfEntityCollectionSection(CdmFormFactory formFactory
, ConversationHolder conversation
,
34 ICdmFormElement parentElement
, int style
) {
35 super(formFactory
, conversation
, parentElement
, "Inapplicable If", style
);
43 public Collection
<FeatureStateDto
> getCollection(TermNodeDto entity
) {
44 return entity
.getInapplicableIf();
51 public Comparator
<FeatureStateDto
> getComparator() {
52 return new FeatureStateDtoComparator();
60 public FeatureStateDto
createNewElement() {
61 FeatureStateWizard wizard
= new FeatureStateWizard(getEntity(), formFactory
);
62 WizardDialog dialog
= new WizardDialog(getLayoutComposite().getShell(), wizard
);
63 int status
= dialog
.open();
64 if(status
== IStatus
.OK
) {
65 return wizard
.getFeatureStateDto();
74 public void addElement(FeatureStateDto element
) {
75 getEntity().getInapplicableIf().add(element
);
82 public FeatureStateDto
addExisting() {
90 public boolean allowAddExisting() {
98 public void removeElement(FeatureStateDto element
) {
99 getEntity().getInapplicableIf().remove(element
);
104 public String
getEmptyString() {
105 return "No feature state added yet.";
110 protected String
getTooltipString() {
111 return "Add a feature state";