Project

General

Profile

Download (2.17 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.description;
11

    
12
import java.util.ArrayList;
13
import java.util.Collection;
14

    
15
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
19
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
20

    
21
/**
22
 * <p>DescriptionElementDetailElement class.</p>
23
 *
24
 * @author n.hoffmann
25
 * @created Mar 5, 2010
26
 * @version 1.0
27
 */
28
public class DescriptionElementDetailElement extends
29
		AbstractCdmDetailElement<DescriptionElementBase> {
30

    
31
	/**
32
	 * <p>Constructor for DescriptionElementDetailElement.</p>
33
	 *
34
	 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
35
	 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
36
	 * @param style a int.
37
	 */
38
	public DescriptionElementDetailElement(CdmFormFactory cdmFormFactory,
39
			ICdmFormElement formElement, int style) {
40
		super(cdmFormFactory, formElement);
41
	}
42

    
43
	/** {@inheritDoc} */
44
	@Override
45
	protected void createControls(ICdmFormElement formElement, DescriptionElementBase entity, int style) {
46
		formFactory.createDetailedDescriptionDetailElement(formElement, entity, style, isEnabled());
47
	}
48

    
49
	/** {@inheritDoc} */
50
	@Override
51
	public void handleEvent(Object eventSource) {
52

    
53
	}
54

    
55
	@Override
56
    protected void updateControlStates(){
57
        Collection<Object> except = new ArrayList<Object>();
58
        for(ICdmFormElement formElement:getElements()){
59
            if(formElement instanceof IEnableableFormElement && !((IEnableableFormElement) formElement).isEnabled()){
60
                except.add(formElement);
61
            }
62
        }
63
        if (getEntity().getInDescription().isComputed()){
64
            enabled = false;
65
         }else{
66
            enabled = true;
67
        }
68
        setEnabled(enabled, except);
69
    }
70
}
(6-6/26)