Project

General

Profile

« Previous | Next » 

Revision 2a7820b7

Added by Patrick Plitzner over 9 years ago

  • added label to EmptyElement
    • added EmptyElement to NonViralNameDetailSection if taxon.getName() is null (fixes #4221)

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
70 70
	/** {@inheritDoc} */
71 71
	@Override
72 72
    protected void createControls(ICdmFormElement formElement, final NonViralName entity, int style) {
73

  
74
        toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
75

  
76
       	combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
77
       	combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
78
       	
79
        //TODO RL
80
       	if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
81
        	toggleable_cache.setVisible(false);
82
        	combo_nomenclaturalCode.setVisible(false);
83
        }
84
        
85
        section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
86
        section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
87
        addControl(section_name);
88
        addElement(section_name);
89
        section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
90
        section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
91
        addControl(section_author);
92
        addElement(section_author);
93

  
94
        //TODO RL
95
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
96
	        section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
97
	        section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
98
	        addControl(section_hybrid);
99
	        addElement(section_hybrid);
100
        }       
73
	    //name can be null in rare cases. Temporary solution for #4221. May be obsolete when
74
	    //#4393 (Make changing name of a taxon possible in details view) is implemented.
75
	    if(entity==null){
76
	        formFactory.createEmptyElement(formElement, "No name associated with this taxon.");
77
	    }
78
	    else {
79
	        toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
80

  
81
	        combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
82
	        combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
83

  
84
	        //TODO RL
85
	        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
86
	            toggleable_cache.setVisible(false);
87
	            combo_nomenclaturalCode.setVisible(false);
88
	        }
89

  
90
	        section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
91
	        section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
92
	        addControl(section_name);
93
	        addElement(section_name);
94
	        section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
95
	        section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
96
	        addControl(section_author);
97
	        addElement(section_author);
98

  
99
	        //TODO RL
100
	        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
101
	            section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
102
	            section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
103
	            addControl(section_hybrid);
104
	            addElement(section_hybrid);
105
	        }
106
	    }
101 107
    }
102 108

  
103 109
	/** {@inheritDoc} */
......
107 113

  
108 114
		// disable nomenclatural code, because changing of nom.code is not
109 115
		// implemented on library side
110
		combo_nomenclaturalCode.setEnabled(false);
116
		if(combo_nomenclaturalCode!=null){
117
		    combo_nomenclaturalCode.setEnabled(false);
118
		}
111 119

  
112
		setIrrelevant(toggleable_cache.getState(),
113
				Arrays.asList(new Object[] { toggleable_cache }));
120
		if(toggleable_cache!=null){
121
		    setIrrelevant(toggleable_cache.getState(),
122
		            Arrays.asList(new Object[] { toggleable_cache }));
123
		}
114 124
	}
115 125

  
116 126
	/** {@inheritDoc} */
117 127
	@Override
118 128
	public void setEntity(NonViralName entity) {
119 129
		super.setEntity(entity);
120
		if (section_name!=null) section_name.setEntity(entity);
121
		if (section_author!=null) section_author.setEntity(entity);
122
		if (section_hybrid!=null) section_hybrid.setEntity(entity);
130
		if (section_name!=null) {
131
            section_name.setEntity(entity);
132
        }
133
		if (section_author!=null) {
134
            section_author.setEntity(entity);
135
        }
136
		if (section_hybrid!=null) {
137
            section_hybrid.setEntity(entity);
138
        }
123 139
	}
124 140

  
125 141
	/** {@inheritDoc} */

Also available in: Unified diff