Revision e3a4a3ff
Added by Andreas Müller almost 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java | ||
---|---|---|
18 | 18 |
|
19 | 19 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
20 | 20 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
21 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
22 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
21 |
import eu.etaxonomy.cdm.model.name.INonViralName;
|
|
22 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
23 | 23 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
24 | 24 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
25 | 25 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
... | ... | |
34 | 34 |
/** |
35 | 35 |
* @author n.hoffmann |
36 | 36 |
* @created May 20, 2010 |
37 |
* @version 1.0 |
|
38 | 37 |
*/ |
39 |
public class NonViralNameDetailSection extends AbstractCdmDetailSection<NonViralName>
|
|
38 |
public class NonViralNameDetailSection extends AbstractCdmDetailSection<TaxonName>
|
|
40 | 39 |
implements ITaxonBaseDetailSection { |
41 | 40 |
|
42 | 41 |
private TaxonBase taxonBase; |
... | ... | |
67 | 66 |
Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){ |
68 | 67 |
@Override |
69 | 68 |
public void run() { |
70 |
TaxonNameBase taxonName = NameSelectionDialog.select(getShell(), getConversationHolder(), getEntity());
|
|
69 |
TaxonName taxonName = NameSelectionDialog.select(getShell(), getConversationHolder(), getEntity()); |
|
71 | 70 |
if(taxonName!=null){ |
72 |
if(taxonName.isInstanceOf(NonViralName.class)){ |
|
73 |
NonViralName nonViralName = HibernateProxyHelper.deproxy(taxonName, NonViralName.class); |
|
74 |
taxonBase.setName(nonViralName); |
|
75 |
// taxonBase.getTitleCache(); |
|
76 |
setEntity(nonViralName); |
|
77 |
firePropertyChangeEvent(NonViralNameDetailSection.this); |
|
78 |
} |
|
79 |
else{ |
|
80 |
MessagingUtils.warningDialog("Invalid name", this, "The selected name can not be used for this taxon."); |
|
81 |
} |
|
71 |
TaxonName nonViralName = HibernateProxyHelper.deproxy(taxonName); |
|
72 |
taxonBase.setName(nonViralName); |
|
73 |
// taxonBase.getTitleCache(); |
|
74 |
setEntity(nonViralName); |
|
75 |
firePropertyChangeEvent(NonViralNameDetailSection.this); |
|
82 | 76 |
} |
83 | 77 |
} |
84 | 78 |
}; |
... | ... | |
97 | 91 |
boolean confirm = MessagingUtils.confirmDialog("Confirm cloning", "Do you really want to clone the name?"); |
98 | 92 |
|
99 | 93 |
if(confirm){ |
100 |
NonViralName clonedName;
|
|
101 |
clonedName = (NonViralName) getEntity().clone();
|
|
94 |
TaxonName clonedName;
|
|
95 |
clonedName = (TaxonName) getEntity().clone();
|
|
102 | 96 |
setEntity(clonedName); |
103 | 97 |
taxonBase.setName(clonedName); |
104 | 98 |
taxonBase.generateTitle(); |
... | ... | |
117 | 111 |
} |
118 | 112 |
|
119 | 113 |
|
120 |
private boolean checkForMultipleNameUsages(NonViralName nonViralName) { |
|
114 |
private boolean checkForMultipleNameUsages(INonViralName nonViralName) {
|
|
121 | 115 |
return nonViralName.getTaxonBases().size() != 1; |
122 | 116 |
} |
123 | 117 |
|
... | ... | |
131 | 125 |
@Override |
132 | 126 |
public void setTaxonBase(TaxonBase taxon) { |
133 | 127 |
taxonBase = taxon; |
134 |
NonViralName name = (NonViralName) HibernateProxyHelper.deproxy(taxon.getName());
|
|
128 |
TaxonName name = HibernateProxyHelper.deproxy(taxon.getName());
|
|
135 | 129 |
setEntity(name); |
136 | 130 |
} |
137 | 131 |
|
... | ... | |
141 | 135 |
} |
142 | 136 |
|
143 | 137 |
@Override |
144 |
protected AbstractCdmDetailElement<NonViralName> createCdmDetailElement(AbstractCdmDetailSection<NonViralName> parentElement, int style) { |
|
138 |
protected AbstractCdmDetailElement<TaxonName> createCdmDetailElement( |
|
139 |
AbstractCdmDetailSection<TaxonName> parentElement, int style) { |
|
145 | 140 |
return formFactory.createNonViralNameDetailElement(parentElement); |
146 | 141 |
} |
147 | 142 |
} |
Also available in: Unified diff
ref #6446 merge taxon name subclasses in TaxEditor