import java.util.List;
+import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer;
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
*
*/
public class WorkingSetComposite extends Composite {
- private Text txt_label;
+ private Text txtWorkingSetLabel;
+ private TermUuidComboViewer comboRankMin;
+ private TermUuidComboViewer comboRankMax;
+ private FeatureTreeEditorComposite featureTreeEditorComposite;
+ private TreeViewer taxonNodeTree;
+ private NamedArea area;
public WorkingSetComposite(Composite parent, int style) {
super(parent, style);
- setLayout(new GridLayout(3, false));
+ setLayout(new GridLayout(4, false));
Label lblNewLabel = new Label(this, SWT.NONE);
lblNewLabel.setText("Working set label");
- txt_label = new Text(this, SWT.BORDER);
- txt_label.setEditable(false);
- txt_label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
+ txtWorkingSetLabel = new Text(this, SWT.BORDER);
+ txtWorkingSetLabel.setEditable(false);
+ txtWorkingSetLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
Label lblNewLabel_1 = new Label(this, SWT.NONE);
lblNewLabel_1.setText("Taxon filter");
+ featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
+ featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
+ featureTreeEditorComposite.init(null, null, null, null);
+
Label lblNewLabel_2 = new Label(this, SWT.NONE);
lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel_2.setText("Rank min");
- TermUuidComboViewer combo = new TermUuidComboViewer(this, SWT.NONE);
- combo.setInput(TermType.Rank);
- combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ comboRankMin = new TermUuidComboViewer(this, SWT.NONE);
+ comboRankMin.setInput(TermType.Rank);
+ comboRankMin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
Composite composite = new Composite(this, SWT.NONE);
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
- TreeViewer viewer = new TreeViewer(new Tree(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
+ taxonNodeTree = new TreeViewer(new Tree(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
- viewer.setContentProvider(new TaxonTreeNodeContentProvider());
- viewer.setLabelProvider(new TaxonTreeNodeLabelProvider());
+ taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider());
+ taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider());
List<Classification> list = CdmStore.getService(IClassificationService.class).list(Classification.class, null, null, null, null);
- viewer.setInput(list);
+ taxonNodeTree.setInput(list);
Label lblNewLabel_3 = new Label(this, SWT.NONE);
lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel_3.setText("Rank max");
- TermUuidComboViewer combo_1 = new TermUuidComboViewer(this, SWT.NONE);
- combo_1.setInput(TermType.Rank);
- combo_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ comboRankMax = new TermUuidComboViewer(this, SWT.NONE);
+ comboRankMax.setInput(TermType.Rank);
+ comboRankMax.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
Label lblNewLabel_4 = new Label(this, SWT.NONE);
lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
@Override
public void widgetSelected(SelectionEvent e) {
- NamedArea area = NamedAreaSelectionDialog.select(parent.getShell(), null, null, null);
+ area = NamedAreaSelectionDialog.select(parent.getShell(), null, null);
lblNewLabel_5.setText(area.getLabel());
}
// Disable the check that prevents subclassing of SWT components
}
public Text getTxt_label() {
- return txt_label;
+ return txtWorkingSetLabel;
+ }
+ public TermUuidComboViewer getComboRankMin() {
+ return comboRankMin;
+ }
+ public TermUuidComboViewer getComboRankMax() {
+ return comboRankMax;
+ }
+ public FeatureTree getCharacters(){
+ return featureTreeEditorComposite.getFeatureTree();
+ }
+ public TaxonNode getTaxonNode(){
+ ITreeSelection selection = (ITreeSelection) taxonNodeTree.getSelection();
+ if(selection!=null){
+ return (TaxonNode) selection.getFirstElement();
+ }
+ return null;
+ }
+ public NamedArea getArea(){
+ return area;
}
}