Project

General

Profile

« Previous | Next » 

Revision 48584197

Added by Patrick Plitzner over 8 years ago

Avoid exception loop when taxon name is null (#4996)

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
46 46
	/** {@inheritDoc} */
47 47
	@Override
48 48
    protected void createControls(ICdmFormElement formElement, final NonViralName entity, int style) {
49
	    //name can be null in rare cases. Temporary solution for #4221. May be obsolete when
50
	    //#4393 (Make changing name of a taxon possible in details view) is implemented.
51
	    if(entity==null){
52
	        formFactory.createEmptyElement(formElement, "No name associated with this taxon.");
49
	    toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
50

  
51
	    combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
52
	    combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
53

  
54
	    //TODO RL
55
	    if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
56
	        toggleable_cache.setVisible(false);
57
	        combo_nomenclaturalCode.setVisible(false);
53 58
	    }
54
	    else {
55
	        toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
56

  
57
	        combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
58
	        combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
59

  
60
	        //TODO RL
61
	        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
62
	            toggleable_cache.setVisible(false);
63
	            combo_nomenclaturalCode.setVisible(false);
64
	        }
65

  
66
	        section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
67
	        section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
68
	        addControl(section_name);
69
	        addElement(section_name);
70
	        section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
71
	        section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
72
	        addControl(section_author);
73
	        addElement(section_author);
74

  
75
	        //TODO RL
76
	        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
77
	            section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
78
	            section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
79
	            addControl(section_hybrid);
80
	            addElement(section_hybrid);
81
	        }
59

  
60
	    section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
61
	    section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
62
	    addControl(section_name);
63
	    addElement(section_name);
64
	    section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
65
	    section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
66
	    addControl(section_author);
67
	    addElement(section_author);
68

  
69
	    //TODO RL
70
	    if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
71
	        section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
72
	        section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
73
	        addControl(section_hybrid);
74
	        addElement(section_hybrid);
82 75
	    }
83 76
    }
84 77

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
204 204

  
205 205
        destroySections();
206 206
        if (input instanceof TaxonBase) {
207
            createTaxonSections(rootElement);
207
            if(((TaxonBase) input).getName()==null){
208
                createEmptySection(rootElement);
209
            }
210
            else{
211
                createTaxonSections(rootElement);
212
            }
208 213

  
209 214
        } else if (input instanceof NonViralName) {
210 215
            createNameSections(rootElement);

Also available in: Unified diff