Revision 2fab6704
Added by Katja Luther almost 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/AbstractTermBaseDetailElement.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2009 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 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.ui.section.vocabulary; |
11 | 11 |
|
12 |
import eu.etaxonomy.cdm.model.common.Language;
|
|
13 |
import eu.etaxonomy.cdm.model.common.Representation; |
|
12 |
import org.eclipse.swt.widgets.Button;
|
|
13 |
|
|
14 | 14 |
import eu.etaxonomy.cdm.model.common.TermBase; |
15 | 15 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
16 | 16 |
import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester; |
17 | 17 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
18 | 18 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
19 | 19 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
20 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
|
20 |
import eu.etaxonomy.taxeditor.ui.element.RepresentationElement;
|
|
21 | 21 |
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement; |
22 | 22 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
23 | 23 |
|
... | ... | |
28 | 28 |
*/ |
29 | 29 |
public abstract class AbstractTermBaseDetailElement<T extends TermBase> extends AbstractCdmDetailElement<T> { |
30 | 30 |
|
31 |
protected TextWithLabelElement text_label;
|
|
32 |
protected TextWithLabelElement text_description; |
|
31 |
//protected TextWithLabelElement text_label;
|
|
32 |
//protected TextWithLabelElement text_description;
|
|
33 | 33 |
protected UriWithLabelElement uri_uri; |
34 |
protected TextWithLabelElement text_abbreviatedLabel; |
|
35 |
|
|
34 |
//protected TextWithLabelElement text_abbreviatedLabel; |
|
35 |
//protected TermComboElement<Language> combo_language; |
|
36 |
//private TermBase term; |
|
37 |
//protected Representation representation; |
|
38 |
protected RepresentationElement element_Representation; |
|
39 |
private Button button; |
|
40 |
|
|
41 |
|
|
36 | 42 |
/** |
37 | 43 |
* @param formFactory |
38 | 44 |
* @param formElement |
... | ... | |
41 | 47 |
ICdmFormElement formElement) { |
42 | 48 |
super(formFactory, formElement); |
43 | 49 |
} |
44 |
|
|
50 |
|
|
45 | 51 |
@Override |
46 | 52 |
protected void createControls(ICdmFormElement formElement, |
47 | 53 |
T entity, int style) { |
48 |
|
|
49 |
Representation representation = getEntity().getPreferredRepresentation(CdmStore.getDefaultLanguage()); |
|
50 |
|
|
51 |
text_label = formFactory.createTextWithLabelElement(formElement, "Label", representation.getLabel(), style); |
|
52 |
text_abbreviatedLabel = formFactory.createTextWithLabelElement(formElement, "Abbrev. Label", representation.getAbbreviatedLabel(), style); |
|
53 |
text_description = formFactory.createMultiLineTextWithLabel(formElement, "Description", 100, style); |
|
54 |
text_description.setText(representation.getDescription()); |
|
54 |
|
|
55 |
element_Representation = formFactory.createRepresentationElement(formElement, getEntity().getPreferredRepresentation(CdmStore.getDefaultLanguage()),getEntity(), 100, style, false); |
|
56 |
|
|
55 | 57 |
uri_uri = formFactory.createUriWithLabelElement(formElement, "URI", getEntity().getUri(), style); |
56 |
|
|
58 |
|
|
57 | 59 |
} |
58 | 60 |
|
59 |
@Override |
|
61 |
|
|
62 |
|
|
63 |
@Override |
|
60 | 64 |
public void setEntity(T entity) { |
61 | 65 |
super.setEntity(entity); |
62 | 66 |
setEnabled(TermBasePropertyTester.isModifiable(entity)); |
63 | 67 |
} |
64 |
|
|
65 |
protected void handleRepresentation(Object eventSource){ |
|
66 |
T entity = getEntity(); |
|
67 |
Representation representation = entity.getRepresentation(CdmStore.getDefaultLanguage()); |
|
68 |
|
|
69 |
if (representation == null){ |
|
70 |
return; |
|
71 |
} |
|
72 |
|
|
73 |
if (eventSource == text_label){ |
|
74 |
representation.setLabel(text_label.getText()); |
|
75 |
entity.setLabel(text_label.getText()); |
|
76 |
}else if (eventSource == text_abbreviatedLabel){ |
|
77 |
representation.setAbbreviatedLabel(text_abbreviatedLabel.getText()); |
|
78 |
}else if (eventSource == text_description){ |
|
79 |
representation.setText(text_description.getText()); |
|
80 |
} |
|
81 |
} |
|
68 |
|
|
69 |
|
|
82 | 70 |
|
83 | 71 |
public abstract TermVocabulary getVocabulary(); |
84 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
85 | 75 |
} |
Also available in: Unified diff
add multilanguage support for terms