Project

General

Profile

« Previous | Next » 

Revision 9ef89740

Added by Katja Luther almost 3 years ago

ref #7309: collector and nomenclatural title fields show cache if empty

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java
259 259
            return super.toString();
260 260
        }
261 261
    }
262

  
263
    public void setMessage(String message) {
264
        text.setMessage(message);
265
    }
262 266
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonDetailElement.java
8 8
 */
9 9
package eu.etaxonomy.taxeditor.ui.section.agent;
10 10

  
11
import org.apache.commons.lang.StringUtils;
11 12
import org.eclipse.swt.SWT;
12 13

  
13 14
import eu.etaxonomy.cdm.model.agent.Person;
......
29 30
public class PersonDetailElement extends AbstractIdentifiableEntityDetailElement<Person> {
30 31

  
31 32
	private TextWithLabelElement text_nomenclaturalTitle;
33
//	private TextWithLabelElement text_nomenclaturalTitleCache;
32 34
	private TextWithLabelElement text_collectorTitle;
35
//	private TextWithLabelElement text_collectorTitleCache;
33 36
	private TextWithLabelElement text_firstname;
34 37
	private TextWithLabelElement text_lastname;
35 38
	private TextWithLabelElement text_prefix;
......
52 55
				"Title Cache", entity.getTitleCache(),
53 56
				entity.isProtectedTitleCache(), SWT.NULL);
54 57

  
58

  
59

  
55 60
		text_nomenclaturalTitle = formFactory.createTextWithLabelElement(
56
				formElement, "Abbrev. Title", entity.getNomenclaturalTitle(),
57
				SWT.NULL);
61
                formElement, "Abbrev. Title", entity.getNomenclaturalTitle(),
62
                SWT.SEARCH);
63

  
64
		text_nomenclaturalTitle.setMessage(entity.getNomenclaturalTitleCache());
65

  
66

  
58 67
		text_collectorTitle = formFactory.createTextWithLabelElement(
59 68
                formElement, "Collector Title", entity.getCollectorTitle(),
60
                SWT.NULL);
69
                SWT.SEARCH);
70

  
71
		text_collectorTitle.setMessage(entity.getCollectorTitleCache());
72

  
61 73
		text_lastname = formFactory.createTextWithLabelElement(formElement,
62 74
                "Familiy Name", entity.getFamilyName(), SWT.NULL);
63 75
		text_firstname = formFactory.createTextWithLabelElement(formElement,
......
69 81
		time_lifespan = formFactory.createTimePeriodElement(formElement, "Lifespan", entity.getLifespan(), SWT.NULL);
70 82
		text_orcid = formFactory.createOrcidWithLabelElement(formElement, "ORCID", entity.getOrcid(), SWT.NULL);
71 83
		text_lsid = formFactory.createLsidWithExceptionLabelElement(formElement, "LSID", entity.getLsid(), SWT.NULL);
84

  
72 85
		getLayoutComposite().layout();
73 86

  
74 87
	    //cache relevance
......
77 90
        registerCacheRelevance(text_prefix);
78 91
        registerCacheRelevance(text_suffix);
79 92
        registerCacheRelevance(text_initials);
93

  
94

  
95

  
80 96
	}
81 97

  
82 98
	@Override
......
91 107
		if (eventSource == toggleable_cache) {
92 108
			handleToggleableCacheField();
93 109
		} else if (eventSource == text_nomenclaturalTitle) {
94
			getEntity().setNomenclaturalTitle(text_nomenclaturalTitle.getText());
110
		    if (StringUtils.isBlank(text_nomenclaturalTitle.getText()) && getEntity().getNomenclaturalTitle() != null){
111
                getEntity().setNomenclaturalTitle(null);
112

  
113
            }else if (StringUtils.isNotBlank(text_nomenclaturalTitle.getText()) ){
114
                getEntity().setNomenclaturalTitle(text_nomenclaturalTitle.getText());
115

  
116
            }
95 117
		} else if (eventSource == text_collectorTitle) {
96
            getEntity().setCollectorTitle(text_collectorTitle.getText());
118
		    if (StringUtils.isBlank(text_collectorTitle.getText()) && getEntity().getCollectorTitle() != null){
119
		        getEntity().setCollectorTitle(null);
120

  
121
		    }else if (StringUtils.isNotBlank(text_collectorTitle.getText()) ){
122
		        getEntity().setCollectorTitle(text_collectorTitle.getText());
123

  
124
		    }
97 125
        }else if (eventSource == text_firstname) {
98 126
			getEntity().setGivenName(text_firstname.getText());
99 127
		}else if (eventSource == text_initials) {
......
111 139
        }else if (eventSource == time_lifespan) {
112 140
            getEntity().setLifespan(time_lifespan.getTimePeriod());
113 141
        }
142
		text_nomenclaturalTitle.setMessage(getEntity().getNomenclaturalTitleCache());
143
		text_collectorTitle.setMessage(getEntity().getCollectorTitleCache());
114 144

  
115
		//if (eventSource != toggleable_cache) {
116 145
		if (!getEntity().isProtectedTitleCache()){
117 146
			toggleable_cache.setText(getEntity().generateTitle());
118 147
		}
119 148

  
120 149
		firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
150

  
121 151
	}
122 152

  
123 153
	@Override

Also available in: Unified diff