import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
private Composite composite;
private Button btnRemoveTerminology;
private ComboViewer comboTerminologies;
+ private Composite composite_1;
+ private Composite composite_2;
+ private Label lblNewLabel;
+ private Label lblNewLabel_1;
+ private Label lblNewLabel_2;
+ private Text txtLabel;
+ private Text txtUri;
+ private Text txtDescription;
public GfBioTerminologyImportComposite(Composite parent, int style) {
super(parent, style);
btnSearch = new Button(composite, SWT.NONE);
btnSearch.setText("Search");
- treeTermHierarchy = new TreeViewer(this, SWT.BORDER);
+ composite_2 = new Composite(this, SWT.NONE);
+ composite_2.setLayout(new GridLayout(2, false));
+ composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ treeTermHierarchy = new TreeViewer(composite_2, SWT.BORDER);
Tree tree = treeTermHierarchy.getTree();
- GridData gd_tree = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
- gd_tree.widthHint = 423;
- tree.setLayoutData(gd_tree);
+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ composite_1 = new Composite(composite_2, SWT.NONE);
+ composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ composite_1.setLayout(new GridLayout(2, false));
+
+ lblNewLabel = new Label(composite_1, SWT.NONE);
+ lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblNewLabel.setText("Label");
+
+ txtLabel = new Text(composite_1, SWT.NONE);
+ txtLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ lblNewLabel_1 = new Label(composite_1, SWT.NONE);
+ lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblNewLabel_1.setText("URI");
+
+ txtUri = new Text(composite_1, SWT.NONE);
+ txtUri.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ lblNewLabel_2 = new Label(composite_1, SWT.NONE);
+ lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblNewLabel_2.setText("Description");
+
+ txtDescription = new Text(composite_1, SWT.NONE);
+ txtDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
}
public TreeViewer getTreeTermHierarchy() {
return treeTermHierarchy;
public ComboViewer getComboTerminologies() {
return comboTerminologies;
}
+ public Text getLblDescription() {
+ return txtDescription;
+ }
+ public Text getLblUri() {
+ return txtUri;
+ }
+ public Text getLblLabel() {
+ return txtLabel;
+ }
}
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSourceAdapter;
composite.getTreeTermHierarchy().setLabelProvider(new OntologyTermLabelProvider());
//tree results
+ composite.getTreeTermHierarchy().addSelectionChangedListener(e->updateDetails(e.getSelection()));
composite.getTreeTermHierarchy().setContentProvider(new OntologyTermContentProvider());
composite.getTreeTermHierarchy().setLabelProvider(new OntologyTermLabelProvider());
Transfer[] transfers = new Transfer[] {LocalSelectionTransfer.getTransfer(),};
}
});
}
+
+ private void clearDetails(){
+ composite.getLblLabel().setText("");
+ composite.getLblUri().setText("");
+ composite.getLblDescription().setText("");
+ }
+
+ private void updateDetails(ISelection s) {
+ StructuredSelection selection = (StructuredSelection)s;
+ if(selection.isEmpty()){
+ clearDetails();
+ }
+ Object next = selection.iterator().next();
+ if(next instanceof OntologyTermWrapper){
+ OntologyTermWrapper wrapper = (OntologyTermWrapper)next;
+ String label = wrapper.getLabel();
+ String uri = wrapper.getUri();
+ String description = wrapper.getDescription();
+ composite.getLblLabel().setText(label!=null?label:"");
+ composite.getLblUri().setText(uri!=null?uri:"");
+ composite.getLblDescription().setText(description!=null?description:"");
+ }
+ }
private void search(){
String searchString = composite.getTxtSearch().getText();
*/
package eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper;
+import java.util.List;
+
/**
+ * Wrapper for terms received from the GfBio terminology service.
+ *
* @author pplitzner
* @since Apr 23, 2018
*
public class OntologyTermWrapper extends TermWrapper{
private String sourceTerminology;
+ private String description;
+ private List<String> synonyms;
+ private String comment;
public OntologyTermWrapper(String uri, String label, String sourceTerminology) {
super(uri, label);
this.sourceTerminology = sourceTerminology;
public String getSourceTerminology() {
return sourceTerminology;
}
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public List<String> getSynonyms() {
+ return synonyms;
+ }
+ public void setSynonyms(List<String> synonyms) {
+ this.synonyms = synonyms;
+ }
+ public String getComment() {
+ return comment;
+ }
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+ public void setSourceTerminology(String sourceTerminology) {
+ this.sourceTerminology = sourceTerminology;
+ }
}