Project

General

Profile

Download (2.07 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

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

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

    
15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16
import eu.etaxonomy.cdm.model.agent.AgentBase;
17
import eu.etaxonomy.cdm.model.agent.Person;
18
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
22

    
23
/**
24
 * <p>PersonWizardPage class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created Jun 1, 2010
28
 * @version 1.0
29
 */
30
public class PersonWizardPage extends AbstractCdmEntityWizardPage<Person> {
31

    
32
    PersonDetailElement personElement;
33

    
34

    
35
	/**
36
	 * <p>Constructor for PersonWizardPage.</p>
37
	 *
38
	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
39
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
40
	 * @param entity a {@link eu.etaxonomy.cdm.model.agent.Person} object.
41
	 */
42
	public PersonWizardPage(CdmFormFactory formFactory, ConversationHolder conversation,
43
			Person entity) {
44
		super(formFactory, conversation, entity);
45
		setTitle("Person");
46
	}
47

    
48

    
49
	/* (non-Javadoc)
50
	 * @see eu.etaxonomy.taxeditor.forms.CdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
51
	 */
52
	/** {@inheritDoc} */
53
	@Override
54
	public AbstractCdmDetailElement<Person> createElement(ICdmFormElement rootElement) {
55
		personElement = formFactory.createPersonDetailElement(rootElement, SWT.NULL);
56
		personElement.setEntity(entity);
57
		return personElement;
58
	}
59

    
60
	@Override
61
    protected boolean titleCacheIsNotEmpty() {
62
        if (getEntity() instanceof AgentBase) {
63
            return !StringUtils.isEmpty(entity.getTitleCache());
64
        }
65
        return true;
66
    }
67
}
(6-6/12)