Project

General

Profile

« Previous | Next » 

Revision 139902da

Added by Patrick Plitzner almost 11 years ago

  • completely removed DetailType enum and all its uses

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
1 1
// $Id$
2 2
/**
3 3
 * Copyright (C) 2007 EDIT
4
 * European Distributed Institute of Taxonomy 
4
 * European Distributed Institute of Taxonomy
5 5
 * http://www.e-taxonomy.eu
6
 * 
6
 *
7 7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
 * See LICENSE.TXT at the top of this package for the full license terms.
9 9
 */
......
12 12

  
13 13
import java.util.Arrays;
14 14

  
15
import org.eclipse.ui.forms.widgets.Section;
15
import org.eclipse.ui.forms.widgets.ExpandableComposite;
16 16

  
17 17
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
18 18
import eu.etaxonomy.cdm.model.name.NonViralName;
19 19
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
20 20
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
21 21
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
22
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
23 22
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
24 23
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
25 24
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
......
28 27
 * <p>
29 28
 * NonViralNameDetailElement class.
30 29
 * </p>
31
 * 
30
 *
32 31
 * @author n.hoffmann
33 32
 * @created May 20, 2010
34 33
 * @version 1.0
......
45 44
	 * <p>
46 45
	 * Constructor for NonViralNameDetailElement.
47 46
	 * </p>
48
	 * 
47
	 *
49 48
	 * @param formFactory
50 49
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
51 50
	 *            object.
......
60 59

  
61 60
	/*
62 61
	 * (non-Javadoc)
63
	 * 
62
	 *
64 63
	 * @see
65 64
	 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
66 65
	 * (eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement,
......
68 67
	 */
69 68
	/** {@inheritDoc} */
70 69
	@Override
71
	protected void createControls(ICdmFormElement formElement,
72
			final NonViralName entity, int style) {
73

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

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

  
83
		section_name = (NameDetailSection) formFactory.createCdmDetailSection(
84
				DetailType.SCIENTIFICNAME, getConversationHolder(),
85
				formElement, null, Section.TWISTIE | Section.EXPANDED);
86
		section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
87
		addControl(section_name);
88
		addElement(section_name);
89
		section_author = (AuthorshipDetailSection) formFactory
90
				.createCdmDetailSection(DetailType.AUTHORSHIP,
91
						getConversationHolder(), formElement, null,
92
						Section.TWISTIE | Section.EXPANDED);
93
		section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
94
		addControl(section_author);
95
		addElement(section_author);
96
		
97
		section_hybrid = (HybridDetailSection) formFactory.createCdmDetailSection(DetailType.HYBRID, 
98
						getConversationHolder(), formElement, null, 
99
						Section.TWISTIE);
100
		section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
101
		addControl(section_hybrid);
102
		addElement(section_hybrid);
103
	}
70
    protected void createControls(ICdmFormElement formElement, final NonViralName entity, int style) {
71

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

  
74
        combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
75
        combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
76

  
77
        section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
78
        section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
79
        addControl(section_name);
80
        addElement(section_name);
81
        section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
82
        section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
83
        addControl(section_author);
84
        addElement(section_author);
85

  
86
        section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
87
        section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
88
        addControl(section_hybrid);
89
        addElement(section_hybrid);
90
    }
104 91

  
105 92
	/** {@inheritDoc} */
106 93
	@Override
......
144 131

  
145 132
	/*
146 133
	 * (non-Javadoc)
147
	 * 
134
	 *
148 135
	 * @see
149 136
	 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
150 137
	 * .lang.Object)
......
159 146
			// initiating the free text name editor
160 147
			getEntity().setProtectedFullTitleCache(false);
161 148
		} else if (eventSource == section_name || eventSource == section_author) {
162
			if (getParentElement() instanceof AbstractCdmDetailSection)
163
				((AbstractCdmDetailSection) getParentElement()).updateTitle();
149
			if (getParentElement() instanceof AbstractCdmDetailSection) {
150
                ((AbstractCdmDetailSection) getParentElement()).updateTitle();
151
            }
164 152
			if (!toggleable_cache.getState()) {
165 153
				toggleable_cache.setText(getEntity().getTitleCache());
166 154
			}

Also available in: Unified diff