* @param abbreviatedLabel a {@link java.lang.String} object.
*/
public void setTerm(String text, String label, String abbreviatedLabel) {
-
- try {
- if(getTerm() == null){
- term = (T) termClass.newInstance();
-
- term.addRepresentation(new Representation(text, label, abbreviatedLabel, CdmStore.getDefaultLanguage()));
- }else{
- Representation representation = term.getPreferredRepresentation(CdmStore.getDefaultLanguage());
- representation.setText(text);
- representation.setLabel(label);
- representation.setAbbreviatedLabel(abbreviatedLabel);
- }
-
- } catch (InstantiationException e) {
- StoreUtil.error(this.getClass(), "InstantiationException when setting term", e);
- } catch (IllegalAccessException e) {
- StoreUtil.error(this.getClass(), "IllegalAccessException when setting term", e);
- }
-
+ Representation representation = getTerm().getRepresentation(CdmStore.getDefaultLanguage());
+ representation.setText(text);
+ representation.setLabel(label);
+ representation.setAbbreviatedLabel(abbreviatedLabel);
}
/**
* @return the term
*/
public T getTerm() {
+ if(term == null){
+ try {
+ term = (T) termClass.newInstance();
+
+ term.addRepresentation(Representation.NewInstance("", "", "", CdmStore.getDefaultLanguage()));
+ } catch (InstantiationException e) {
+ StoreUtil.error(this.getClass(), "InstantiationException when setting term", e);
+ } catch (IllegalAccessException e) {
+ StoreUtil.error(this.getClass(), "IllegalAccessException when setting term", e);
+ }
+ }
return term;
}
- public Representation getRepresentation(){
- return term != null ? term.getRepresentation(CdmStore.getDefaultLanguage()) : null;
+ public Representation getRepresentation(){
+ return getTerm().getRepresentation(CdmStore.getDefaultLanguage());
}
/**
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.Representation;
if(getWizard().getRepresentation() != null){
Representation representation = getWizard().getRepresentation();
- text_label.setText(representation.getLabel());
- text_labelAbbreviation.setText(representation.getAbbreviatedLabel());
- text_description.setText(representation.getDescription());
+ text_label.setText(CdmUtils.Nz(representation.getLabel()));
+ text_labelAbbreviation.setText(CdmUtils.Nz(representation.getAbbreviatedLabel()));
+ text_description.setText(CdmUtils.Nz(representation.getDescription()));
}
setPageComplete(false);