Revision aeb34234
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/termvocabulary/TermVocabularyComboContentProvider.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.combo.termvocabulary; |
|
10 |
|
|
11 |
import java.util.Collection; |
|
12 |
|
|
13 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
|
14 |
|
|
15 |
/** |
|
16 |
* |
|
17 |
* @author pplitzner |
|
18 |
* @since Aug 17, 2018 |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class TermVocabularyComboContentProvider implements IStructuredContentProvider { |
|
22 |
|
|
23 |
@Override |
|
24 |
public Object[] getElements(Object inputElement) { |
|
25 |
if(inputElement instanceof Collection){ |
|
26 |
return ((Collection) inputElement).toArray(); |
|
27 |
} |
|
28 |
return null; |
|
29 |
} |
|
30 |
|
|
31 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/termvocabulary/TermVocabularyComboLabelProvider.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.combo.termvocabulary; |
|
10 |
|
|
11 |
import org.eclipse.jface.viewers.LabelProvider; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|
14 |
|
|
15 |
/** |
|
16 |
* |
|
17 |
* @author pplitzner |
|
18 |
* @since Aug 17, 2018 |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class TermVocabularyComboLabelProvider extends LabelProvider { |
|
22 |
|
|
23 |
@Override |
|
24 |
public String getText(Object element) { |
|
25 |
if(element instanceof TermVocabulary){ |
|
26 |
return ((TermVocabulary) element).getLabel(); |
|
27 |
} |
|
28 |
return super.getText(element); |
|
29 |
} |
|
30 |
|
|
31 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/termvocabulary/TermVocabularyComboViewer.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.combo.termvocabulary; |
|
10 |
|
|
11 |
import org.eclipse.jface.viewers.ILabelProvider; |
|
12 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
|
13 |
import org.eclipse.swt.widgets.Composite; |
|
14 |
|
|
15 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|
16 |
import eu.etaxonomy.taxeditor.ui.combo.AbstractComboComposite; |
|
17 |
|
|
18 |
/** |
|
19 |
* |
|
20 |
* @author pplitzner |
|
21 |
* @since Aug 17, 2018 |
|
22 |
* |
|
23 |
*/ |
|
24 |
public class TermVocabularyComboViewer extends AbstractComboComposite<TermVocabulary>{ |
|
25 |
|
|
26 |
public TermVocabularyComboViewer(Composite parent, int style) { |
|
27 |
super(parent, style); |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public String getElementLabel(TermVocabulary element) { |
|
32 |
return element!=null?element.getLabel():""; |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public IStructuredContentProvider getContentProvider() { |
|
37 |
return new TermVocabularyComboContentProvider(); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public ILabelProvider getLabelProvider() { |
|
42 |
return new TermVocabularyComboLabelProvider(); |
|
43 |
} |
|
44 |
|
|
45 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/webimport/termimport/GfBioTerminologyImportComposite.java | ||
---|---|---|
17 | 17 |
import org.eclipse.swt.widgets.Combo; |
18 | 18 |
import org.eclipse.swt.widgets.Composite; |
19 | 19 |
import org.eclipse.swt.widgets.Label; |
20 |
import org.eclipse.swt.widgets.List; |
|
20 | 21 |
import org.eclipse.swt.widgets.Text; |
21 | 22 |
import org.eclipse.swt.widgets.Tree; |
22 | 23 |
|
24 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
|
25 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|
23 | 26 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
27 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
28 |
import eu.etaxonomy.taxeditor.ui.combo.termvocabulary.TermVocabularyComboViewer; |
|
24 | 29 |
|
25 | 30 |
/** |
26 | 31 |
* @author pplitzner |
... | ... | |
43 | 48 |
private Text txtUri; |
44 | 49 |
private Text txtDescription; |
45 | 50 |
private Button btnLoadDetails; |
51 |
private Label lblNewLabel_3; |
|
52 |
private ScrolledComposite scrolledComposite; |
|
53 |
private List listSynonyms; |
|
54 |
private Composite composite_3; |
|
55 |
private Label lblNewLabel_4; |
|
56 |
private Button btnRemoveVocabulary; |
|
57 |
private TermVocabularyComboViewer termVocabularyComboViewer; |
|
46 | 58 |
|
47 | 59 |
public GfBioTerminologyImportComposite(Composite parent, int style) { |
48 | 60 |
super(parent, style); |
... | ... | |
65 | 77 |
btnSearch = new Button(composite, SWT.NONE); |
66 | 78 |
btnSearch.setText("Search"); |
67 | 79 |
|
80 |
composite_3 = new Composite(this, SWT.NONE); |
|
81 |
composite_3.setLayout(new GridLayout(3, false)); |
|
82 |
composite_3.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false, 1, 1)); |
|
83 |
|
|
84 |
lblNewLabel_4 = new Label(composite_3, SWT.NONE); |
|
85 |
lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
86 |
lblNewLabel_4.setText("Import Vocabulary"); |
|
87 |
|
|
88 |
termVocabularyComboViewer = new TermVocabularyComboViewer(composite_3, SWT.NONE); |
|
89 |
termVocabularyComboViewer.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1)); |
|
90 |
termVocabularyComboViewer.setInput(CdmStore.getService(IVocabularyService.class).list(TermVocabulary.class, null, null, null, null)); |
|
91 |
|
|
92 |
btnRemoveVocabulary = new Button(composite_3, SWT.NONE); |
|
93 |
btnRemoveVocabulary.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
94 |
btnRemoveVocabulary.setImage(ImageResources.getImage(ImageResources.TRASH_ICON)); |
|
95 |
|
|
68 | 96 |
composite_2 = new Composite(this, SWT.NONE); |
69 | 97 |
composite_2.setLayout(new GridLayout(2, false)); |
70 | 98 |
composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
... | ... | |
130 | 158 |
public Button getBtnLoadDetails() { |
131 | 159 |
return btnLoadDetails; |
132 | 160 |
} |
161 |
public TermVocabularyComboViewer getTermVocabularyComboViewer() { |
|
162 |
return termVocabularyComboViewer; |
|
163 |
} |
|
164 |
public Button getBtnRemoveVocabulary() { |
|
165 |
return btnRemoveVocabulary; |
|
166 |
} |
|
133 | 167 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/webimport/termimport/GfBioTerminologyImportPresenter.java | ||
---|---|---|
99 | 99 |
} |
100 | 100 |
}); |
101 | 101 |
|
102 |
//combo |
|
102 |
//terminology combo
|
|
103 | 103 |
String response = new RequestTerminologies().request(); |
104 | 104 |
if(response==null){ |
105 | 105 |
MessagingUtils.informationDialog(NO_CONNECTION_TITLE, NO_CONNECTION_MESSAGE); |
... | ... | |
121 | 121 |
} |
122 | 122 |
}); |
123 | 123 |
|
124 |
//vocabulary combo |
|
125 |
composite.getBtnRemoveVocabulary().addSelectionListener(new SelectionAdapter() { |
|
126 |
@Override |
|
127 |
public void widgetSelected(SelectionEvent e) { |
|
128 |
composite.getTermVocabularyComboViewer().setElement(null); |
|
129 |
} |
|
130 |
}); |
|
131 |
|
|
124 | 132 |
composite.getBtnLoadDetails().addSelectionListener(new SelectionAdapter() { |
125 | 133 |
@Override |
126 | 134 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
167 | 175 |
composite.getLblLabel().setText(""); |
168 | 176 |
composite.getLblUri().setText(""); |
169 | 177 |
composite.getLblDescription().setText(""); |
178 |
composite.getListSynonyms().removeAll(); |
|
170 | 179 |
} |
171 | 180 |
|
172 | 181 |
private void updateDetails(ISelection s) { |
Also available in: Unified diff
ref #7362 Add term vocabular combo