fixes #2189
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / preference / wizard / VocabularyTermWizardPage.java
index af1273f12bf65d1ebc9afa116ec72eeadfdce677..ffb37c01138bb23cfce61a2ecfe6f3835e90769d 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.Representation;
 
 /**
  * <p>VocabularyTermWizardPage class.</p>
@@ -35,8 +36,6 @@ public class VocabularyTermWizardPage<T extends DefinedTermBase> extends WizardP
        private Text text_label;
        private Text text_labelAbbreviation;
        private Text text_description;
-
-       private T term = null;
        
        /**
         * <p>Constructor for VocabularyTermWizardPage.</p>
@@ -90,13 +89,11 @@ public class VocabularyTermWizardPage<T extends DefinedTermBase> extends WizardP
                
                setControl(composite);
                
-               if(getWizard().getTerm() != null){
-                       DefinedTermBase<T> term = getWizard().getTerm();
-                       text_label.setText(term.getLabel());
-                       // why can't we access labelAbbreviation
-//                     text_labelAbbreviation.setText(feature.get)
-                       // why can't we access the term string?
-//                     text_description.setText(feature.getT)
+               if(getWizard().getRepresentation() != null){
+                       Representation representation = getWizard().getRepresentation();
+                       text_label.setText(representation.getLabel());
+                       text_labelAbbreviation.setText(representation.getAbbreviatedLabel());
+                       text_description.setText(representation.getDescription());
                }
                
                setPageComplete(false);
@@ -108,11 +105,22 @@ public class VocabularyTermWizardPage<T extends DefinedTermBase> extends WizardP
         */
        /** {@inheritDoc} */
        public void modifyText(ModifyEvent e) {
+               Object eventSource = e.getSource();
+               if(eventSource == text_label){
+                       getWizard().getRepresentation().setLabel(text_label.getText());
+               }
+               else if(eventSource == text_labelAbbreviation){
+                       getWizard().getRepresentation().setAbbreviatedLabel(text_labelAbbreviation.getText());
+               }
+               else if(eventSource == text_description){
+                       getWizard().getRepresentation().setText(text_description.getText());
+               }  
+               
+               
                if(text_label.getText().length() > 0){
                        setPageComplete(true);
-                               
-                       getWizard().setTerm(text_description.getText(), text_label.getText(), text_labelAbbreviation.getText());
-               } else {
+               }
+               else {
                        setPageComplete(false);
                }
        }