import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.reference.NamedSourceBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.SecundumSource;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.StoreUtil;
*/
public class SecundumSourceElement extends OriginalSourceElement<SecundumSource> {
+ protected EntitySelectionElement<TaxonName> select_nameUsedInSource;
/**
* @param formFactory
* @param formElement
setEntityWithoutUpdate(HibernateProxyHelper.deproxy(entity));
- this.selection_Ref = formFactory.createSelectionElement(Reference.class, formElement, "Secundum", null, EntitySelectionElement.ALL, style);
+ this.selection_Ref = formFactory.createSelectionElement(Reference.class, formElement, "Secundum", getEntity()!= null? getEntity().getCitation(): null, EntitySelectionElement.ALL, style);
- if (getEntity() != null){
- selection_Ref.setEntity(getEntity().getCitation());
- }
selection_Ref.setBackground(this.getPersistentBackground());
for (ICdmFormElement element: selection_Ref.getElements()){
element.setBackground(getPersistentBackground());
Label sep = formFactory.createLabel(formElement.getLayoutComposite(), "");
sep.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-
-
+ if (this.cdmEntity instanceof Taxon){
+ select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Name in Source", entity != null? ((NamedSourceBase)entity).getNameUsedInSource(): null, EntitySelectionElement.DELETABLE, style);
+ }
+
externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, "Links", false, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
externalLinks.setEmptySectionString("No links yet.");
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
externalLinks.setEntity(getEntity());
externalLinks.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
-
-
+
addControl(externalLinks);
addElement(externalLinks);
-
-// advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
-// TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
-//
-// advancedSection.setLayoutData(layoutData);
-// advancedSection.setBackground(this.getPersistentBackground());
-// advancedSection.setEntity(entity);
-// advancedSection.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
-// addControl(advancedSection);
-// addElement(advancedSection);
this.getLayoutComposite().layout();
+
}
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource.equals(select_nameUsedInSource)){
+ getEntity().setNameUsedInSource(select_nameUsedInSource.getEntity());
+ }else{
+ super.handleEvent(eventSource);
+ }
+ }
+
}