Project

General

Profile

« Previous | Next » 

Revision 4e34a1f2

Added by Katja Luther over 6 years ago

ref #7143: enable finish in create person dialog if titleCache is set

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonDetailElement.java
1 1
/**
2 2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy 
3
 * European Distributed Institute of Taxonomy
4 4
 * http://www.e-taxonomy.eu
5
 * 
5
 *
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
......
25 25
 * <p>
26 26
 * PersonDetailElement class.
27 27
 * </p>
28
 * 
28
 *
29 29
 * @author n.hoffmann
30 30
 * @created Mar 8, 2010
31 31
 * @version 1.0
......
45 45
	 * <p>
46 46
	 * Constructor for PersonDetailElement.
47 47
	 * </p>
48
	 * 
48
	 *
49 49
	 * @param cdmFormFactory
50 50
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
51 51
	 *            object.
......
77 77
				"Firstname", entity.getFirstname(), SWT.NULL);
78 78
		text_initials = formFactory.createTextWithLabelElement(formElement,
79 79
				"Initials", entity.getInitials(), SWT.NULL);
80
		
80

  
81 81
		text_lastname = formFactory.createTextWithLabelElement(formElement,
82 82
				"Lastname", entity.getLastname(), SWT.NULL);
83 83

  
......
103 103
	/** {@inheritDoc} */
104 104
	@Override
105 105
	public void handleEvent(Object eventSource) {
106
		if (eventSource == toggleable_cache) {	
107
			handleToggleableCacheField();			
106
		if (eventSource == toggleable_cache) {
107
			handleToggleableCacheField();
108 108
		} else if (eventSource == text_nomenclaturalTitle) {
109 109
			getEntity()
110 110
					.setNomenclaturalTitle(text_nomenclaturalTitle.getText());
......
120 120
			getEntity().setSuffix(text_suffix.getText());
121 121
		}
122 122

  
123
		if (eventSource != toggleable_cache) {
124
			toggleable_cache.setText(getEntity().getTitleCache());
123
		//if (eventSource != toggleable_cache) {
124
		if (getEntity().isProtectedTitleCache()){
125
			toggleable_cache.setText(getEntity().generateTitle());
125 126
		}
126 127

  
127 128
		firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
128 129
	}
129
	
130

  
130 131
	@Override
131 132
	protected void handleToggleableCacheField() {
132 133
        boolean pushedState = toggleable_cache.getState();
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonDetailSection.java
54 54
	protected AbstractCdmDetailElement<Person> createCdmDetailElement(AbstractCdmDetailSection<Person> parentElement, int style) {
55 55
	    return formFactory.createPersonDetailElement(parentElement, style);
56 56
	}
57

  
58

  
57 59
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonWizardPage.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.ui.section.agent;
11 11

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

  
14 15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16
import eu.etaxonomy.cdm.model.agent.AgentBase;
15 17
import eu.etaxonomy.cdm.model.agent.Person;
16 18
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
17 19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
......
51 53
		personElement.setEntity(entity);
52 54
		return personElement;
53 55
	}
56

  
57
	@Override
58
    protected boolean titleCacheIsNotEmpty() {
59
        if (getEntity() instanceof AgentBase) {
60

  
61

  
62
            return !StringUtils.isEmpty(entity.getTitleCache());
63
        }
64
        return true;
65
    }
54 66
}

Also available in: Unified diff