Project

General

Profile

« Previous | Next » 

Revision 0858c777

Added by Katja Luther almost 3 years ago

ref #8471: disable computed descriptions

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailElement.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
*/
9 9

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

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

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

  
17 21
/**
......
35 39
			ICdmFormElement formElement, int style) {
36 40
		super(cdmFormFactory, formElement);
37 41
	}
38
	
42

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

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

  
49 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
    }
50 70
}

Also available in: Unified diff