+ public TermComboElement(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection, boolean addEmptyElement,
+ int style) {
+ this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style, false);
+ }
+ public TermComboElement(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection, boolean addEmptyElement,
+ int style, boolean useAbbrevLabel) {
+ this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style, useAbbrevLabel);
+
+ }
+
+ private TermComboElement(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, Class<T> termClass, TermType termType, TermVocabulary<?> termVocabulary, String labelString, T selection, boolean addEmptyElement,
+ int style, boolean useAbbrevLabel) {
+ super(formFactory, parentElement);
+
+ this.termType = termType;
+ this.termVocabulary = termVocabulary;
+ this.termClass = termClass;
+ this.addEmptyElement = addEmptyElement;
+ this.useAbbrevLabel = useAbbrevLabel;
+ if (labelString != null) {
+ label.setText(labelString);
+ }
+
+ if(termType!=null){
+ //TODO try to remove generic T and avoid classes to be used
+ populateTerms((List<T>) getTermManager().getPreferredTerms(termType));
+ }
+ else if(termVocabulary!=null){
+ populateTerms((List<T>) getTermManager().getPreferredTerms(termVocabulary));
+ }
+ else if(this.termClass!=null){
+ populateTerms(getPreferredTerms());
+ }
+
+ combo.addSelectionListener(this);
+ combo.addDisposeListener(this);
+ PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this);
+
+ if (selection != null) {
+ setSelection(selection);
+ }