package eu.etaxonomy.taxeditor.view.webimport.termimport;
import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
+import org.eclipse.wb.swt.SWTResourceManager;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
private Text txtDescription;
private Button btnLoadDetails;
private Label lblNewLabel_3;
- private ScrolledComposite scrolledComposite;
- private List listSynonyms;
private Composite composite_3;
private Label lblNewLabel_4;
private Button btnRemoveVocabulary;
private TermVocabularyComboViewer termVocabularyComboViewer;
+ private List list;
+ private ListViewer listSynonyms;
public GfBioTerminologyImportComposite(Composite parent, int style) {
super(parent, style);
lblNewLabel.setText("Label");
txtLabel = new Text(composite_1, SWT.NONE);
+ txtLabel.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
+ txtLabel.setEditable(false);
txtLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblNewLabel_1 = new Label(composite_1, SWT.NONE);
lblNewLabel_1.setText("URI");
txtUri = new Text(composite_1, SWT.NONE);
+ txtUri.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
+ txtUri.setEditable(false);
txtUri.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblNewLabel_2 = new Label(composite_1, SWT.NONE);
lblNewLabel_2.setText("Description");
txtDescription = new Text(composite_1, SWT.NONE);
+ txtDescription.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
+ txtDescription.setEditable(false);
txtDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ lblNewLabel_3 = new Label(composite_1, SWT.NONE);
+ lblNewLabel_3.setText("Synonyms");
+
+ listSynonyms = new ListViewer(composite_1, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ list = listSynonyms.getList();
+ list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ list.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
}
public TreeViewer getTreeTermHierarchy() {
return treeTermHierarchy;
public Button getBtnLoadDetails() {
return btnLoadDetails;
}
+ public ListViewer getListSynonyms() {
+ return listSynonyms;
+ }
public TermVocabularyComboViewer getTermVocabularyComboViewer() {
return termVocabularyComboViewer;
}
*/
package eu.etaxonomy.taxeditor.view.webimport.termimport.parser;
+import java.util.ArrayList;
+import java.util.List;
+
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
return null;
}
+ public static List<String> parseSynonyms(JSONObject jsonObject) throws JSONException{
+ List<String> synonyms = new ArrayList<>();
+ String synomymKey = "synonyms";
+ if(jsonObject.has(synomymKey)){
+ JSONArray jsonArray = jsonObject.getJSONArray(synomymKey);
+ for(int i=0;i<jsonArray.length();i++){
+ synonyms.add(jsonArray.getString(i));
+ }
+ }
+ return synonyms;
+ }
+
public static String parseTerminology(JSONObject jsonObject) throws JSONException {
return jsonObject.getString("sourceTerminology");
}
String request = new RequestTerm(wrapper.getUri(), wrapper.getSourceTerminology()).request();
OntologyTermWrapper detailTerm = TermParser.parseSingleTerm(request);
wrapper.setDescription(detailTerm.getDescription());
+ wrapper.setSynonyms(detailTerm.getSynonyms());
}
}