Project

General

Profile

Revision adb4cbcf

IDadb4cbcf29a146102cbf21d096506dd2af24686d
Parent b5f4e4d3
Child 99742785

Added by Patrick Plitzner about 1 year ago

ref #8150 Allow editing representation label of characters in details

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java
11 11
import org.eclipse.swt.widgets.Label;
12 12
import org.eclipse.ui.forms.widgets.ExpandableComposite;
13 13

  
14
import eu.etaxonomy.cdm.model.common.Language;
15
import eu.etaxonomy.cdm.model.common.Representation;
14 16
import eu.etaxonomy.cdm.model.description.Character;
17
import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
15 18
import eu.etaxonomy.taxeditor.model.ColorResources;
16 19
import eu.etaxonomy.taxeditor.preference.Resources;
20
import eu.etaxonomy.taxeditor.store.CdmStore;
17 21
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 22
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
19 23
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20 24
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
25
import eu.etaxonomy.taxeditor.ui.element.RepresentationElement;
21 26
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
22 27
import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection;
23 28
import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection;
......
34 39

  
35 40
    private ICdmFormElement parentFormElement;
36 41

  
42
    protected RepresentationElement element_Representation;
43

  
37 44
    private CheckboxElement supportsQuantitativeData;
38 45

  
39 46
    private CheckboxElement supportsCategoricalData;
......
54 61
	@Override
55 62
	protected void createControls(ICdmFormElement formElement, Character entity, int style) {
56 63
	    this.parentFormElement = formElement;
64
	    element_Representation = formFactory.createTranslatableRepresentationElement(formElement,  getEntity().getPreferredRepresentation(CdmStore.getDefaultLanguage()),getEntity(), 100, style, true);
57 65
	    Label lblStructure = new Label(formElement.getLayoutComposite(), style);
58 66
	    lblStructure.setText("Structure");
59 67
	    Label lblStructureText = new Label(formElement.getLayoutComposite(), style);
......
94 102
        }
95 103
    }
96 104

  
105
    @Override
106
    public void setEntity(Character entity) {
107
        super.setEntity(entity);
108
        setEnabled(TermBasePropertyTester.isModifiable(entity));
109
    }
110

  
97 111
	@Override
98 112
	public void handleEvent(Object eventSource) {
99 113
	    if(eventSource == supportsQuantitativeData || eventSource == supportsCategoricalData){
......
118 132
	            removeCategoricalWidgets();
119 133
	        }
120 134
	    }
135
	    else if (eventSource == element_Representation) {
136
            Representation selectedRepresentation = element_Representation.getSelectedRepresentation();
137
            if(selectedRepresentation!=null){
138
                Language representationLanguage = selectedRepresentation.getLanguage();
139
                if(representationLanguage==null){
140
                    representationLanguage = Language.getDefaultLanguage();
141
                }
142
                getEntity().setLabel(selectedRepresentation.getLabel(),  representationLanguage);
143
                getEntity().getRepresentation(representationLanguage).setAbbreviatedLabel(selectedRepresentation.getAbbreviatedLabel());
144
                getEntity().getRepresentation(representationLanguage).setText(selectedRepresentation.getDescription());
145
            }
146
            getEntity().setTitleCache(null);
147
        }
121 148
	}
122 149

  
123 150
	private void activateQuantitativeWidgets(){

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)