Project

General

Profile

Download (1.13 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * 
3
 */
4
package eu.etaxonomy.taxeditor.ui.section;
5

    
6
import java.util.Arrays;
7

    
8
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
9
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
10
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
11
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
12

    
13
/**
14
 * @author n.hoffmann
15
 *
16
 */
17
public abstract class AbstractIdentifiableEntityDetailElement<T extends IIdentifiableEntity> extends
18
		AbstractCdmDetailElement<T> {
19

    
20
	protected ToggleableTextElement toggleable_cache;
21
	
22
	public AbstractIdentifiableEntityDetailElement(CdmFormFactory formFactory,
23
			ICdmFormElement formElement) {
24
		super(formFactory, formElement);
25
	}
26
	
27
	public void updateToggleableCacheField(){
28
		if(! getEntity().isProtectedTitleCache()){
29
			toggleable_cache.setText(getEntity().generateTitle());
30
		}
31
	}
32
	
33
	protected void handleToggleableCacheField(){
34
		boolean pushedState = toggleable_cache.getState();
35
		
36
		getEntity().setTitleCache(toggleable_cache.getText(),
37
				pushedState);
38
		setIrrelevant(pushedState,
39
				Arrays.asList(new Object[] { toggleable_cache }));
40
		updateToggleableCacheField();
41
	}	
42
}
(5-5/8)