From 6c56ee878aa8391e37cbdfa947e0a10879aeacb7 Mon Sep 17 00:00:00 2001 From: Katja Luther Date: Fri, 1 Jul 2016 13:30:20 +0200 Subject: [PATCH] #5908: add a default representation to a term with no representation --- .../taxeditor/ui/element/RepresentationElement.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/RepresentationElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/RepresentationElement.java index b17f8e903..e784d8df5 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/RepresentationElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/RepresentationElement.java @@ -44,6 +44,7 @@ SelectionListener{ protected TextWithLabelElement element_text; protected Button button; + //protected Button deleteButton; protected Representation selectedRepresentation; protected TermBase term; @@ -139,9 +140,7 @@ SelectionListener{ combo_language.addSelectionListener(this); addControl(formFactory.createLabel(getLayoutComposite(), "")); - - - } + } public List getLanguages() { @@ -203,6 +202,11 @@ SelectionListener{ public void setTerm( TermBase term, boolean update) { this.term = term; + if (term.getRepresentations().isEmpty()){ + //if the term has no representation at all, create a default one. + Representation rep = Representation.NewInstance("", "", "", PreferencesUtil.getGlobalLanguage()); + term.addRepresentation(rep); + } if (selectedRepresentation != null) { combo_language.setTerms(getLanguages()); -- 2.34.1