Project

General

Profile

« Previous | Next » 

Revision 3be6ef3e

Added by Niels Hoffmann over 13 years ago

performed javacscript:fix and worked on documentation

View differences:

taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/MisapplicationContainer.java
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.editor.name;
11

  
12
import org.eclipse.swt.graphics.Font;
13

  
14
import eu.etaxonomy.cdm.model.taxon.Taxon;
15
import eu.etaxonomy.taxeditor.editor.EditorUtil;
16
import eu.etaxonomy.taxeditor.preference.Resources;
17

  
18
/**
19
 * @author p.ciardelli
20
 * @created 13.01.2009
21
 * @version 1.0
22
 */
23
public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
24
	
25
	public MisapplicationContainer(TaxonNameEditor editor, AbstractGroup group, Taxon misappliedName) {
26
		super(editor, group, misappliedName);
27
	}
28
	
29

  
30
	/* (non-Javadoc)
31
	 * @see eu.etaxonomy.taxeditor.editor.name.NameComposite#initializeComposite()
32
	 */
33
	@Override
34
	protected void initializeComposite() {
35
		setIsDraggable(true);
36
		setIcon(MISAPPLIEDNAME_ICON);
37
		setFont(getViewerFont());
38
		setIndent(MISAPPLIEDNAME_INDENT);
39
		
40
		showSec();		
41
		
42
		initTextViewer();
43
	}
44

  
45
	private void showSec() {
46
		if (getMisappliedName() == null) {
47
			return;
48
		}
49
		
50
		if (getMisappliedName().getSec() == null) {
51
			setNonEditableInfo("sec. ???", false);
52
		} else {
53
			String title = getMisappliedName().getSec().getTitleCache();
54
			setNonEditableInfo("sec. " + title, false);
55
		}
56
	}
57
	
58
	public Taxon getMisappliedName() {
59
		return getTaxonBase();
60
	}
61

  
62
	@Override
63
	protected Font getViewerFont() {
64
		return EditorUtil.getFont(Resources.MISAPPLIEDNAME_FONT);
65
	}
66
	
67
	protected void calculateErrors() {
68
		super.calculateErrors();
69
		
70
		nameViewer.setShowSecError(getMisappliedName());
71
	}
72
	
73

  
74
	@Override
75
	protected void updateNonEditableInfo() {
76
		showSec();
77
	}
78

  
79
}
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.editor.name;
11

  
12
import org.eclipse.swt.graphics.Font;
13

  
14
import eu.etaxonomy.cdm.model.taxon.Taxon;
15
import eu.etaxonomy.taxeditor.editor.EditorUtil;
16
import eu.etaxonomy.taxeditor.preference.Resources;
17

  
18
/**
19
 * <p>MisapplicationContainer class.</p>
20
 *
21
 * @author p.ciardelli
22
 * @created 13.01.2009
23
 * @version 1.0
24
 */
25
public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
26
	
27
	/**
28
	 * <p>Constructor for MisapplicationContainer.</p>
29
	 *
30
	 * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
31
	 * @param group a {@link eu.etaxonomy.taxeditor.editor.name.AbstractGroup} object.
32
	 * @param misappliedName a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
33
	 */
34
	public MisapplicationContainer(TaxonNameEditor editor, AbstractGroup group, Taxon misappliedName) {
35
		super(editor, group, misappliedName);
36
	}
37
	
38

  
39
	/* (non-Javadoc)
40
	 * @see eu.etaxonomy.taxeditor.editor.name.NameComposite#initializeComposite()
41
	 */
42
	/** {@inheritDoc} */
43
	@Override
44
	protected void initializeComposite() {
45
		setIsDraggable(true);
46
		setIcon(MISAPPLIEDNAME_ICON);
47
		setFont(getViewerFont());
48
		setIndent(MISAPPLIEDNAME_INDENT);
49
		
50
		showSec();		
51
		
52
		initTextViewer();
53
	}
54

  
55
	private void showSec() {
56
		if (getMisappliedName() == null) {
57
			return;
58
		}
59
		
60
		if (getMisappliedName().getSec() == null) {
61
			setNonEditableInfo("sec. ???", false);
62
		} else {
63
			String title = getMisappliedName().getSec().getTitleCache();
64
			setNonEditableInfo("sec. " + title, false);
65
		}
66
	}
67
	
68
	/**
69
	 * <p>getMisappliedName</p>
70
	 *
71
	 * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
72
	 */
73
	public Taxon getMisappliedName() {
74
		return getTaxonBase();
75
	}
76

  
77
	/** {@inheritDoc} */
78
	@Override
79
	protected Font getViewerFont() {
80
		return EditorUtil.getFont(Resources.MISAPPLIEDNAME_FONT);
81
	}
82
	
83
	/**
84
	 * <p>calculateErrors</p>
85
	 */
86
	protected void calculateErrors() {
87
		super.calculateErrors();
88
		
89
		nameViewer.setShowSecError(getMisappliedName());
90
	}
91
	
92

  
93
	/** {@inheritDoc} */
94
	@Override
95
	protected void updateNonEditableInfo() {
96
		showSec();
97
	}
98

  
99
}

Also available in: Unified diff