* @param node a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
* @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
*/
- public static TaxonNode select(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, TaxonNode node) {
+ public static TaxonNode select(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, TaxonNode node, Classification classification) {
TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell,
conversation,
title,
excludeTaxa,
false,
- node);
+ node,
+ classification);
return getSelectionFromDialog(dialog);
}
private List<Classification> classifications;
private Classification selectedClassification;
+
+ private final Classification defaultClassification;
/**
* @param multi a boolean.
* @param node a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
*/
- protected TaxonNodeSelectionDialog(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node) {
+ protected TaxonNodeSelectionDialog(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node, Classification classification) {
super(shell, conversation, title, multi, TaxonNodeSelectionDialog.class.getCanonicalName(), node);
ILabelProvider labelProvider = new FilteredCdmResourceLabelProvider();
setListLabelProvider(labelProvider);
setDetailsLabelProvider(labelProvider);
+ if(classification != null){
+ selectedClassification = classification;
+ }
+ defaultClassification = classification;
}
/** {@inheritDoc} */
@Override
protected Control createExtendedContentArea(Composite parent) {
- return createTreeSelectionCombo(parent);
+ return createClassificationSelectionCombo(parent);
}
/*
* currently disabled tree selection composite
*/
- private Control createTreeSelectionCombo(Composite parent){
+ private Control createClassificationSelectionCombo(Composite parent){
// classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
Composite classificationSelection = new Composite(parent, SWT.NULL);
classificationSelection.setLayout(layout);
Label label = new Label(classificationSelection, SWT.NULL);
- // TODO not working is not really true but leave it there to remind everyone that this is under construction
+ // TODO not working is not really true but leave it here to remind everyone that this is under construction
label.setText("Select Classification (experimental)");
classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
classificationSelectionCombo.select(classifications.indexOf(selectedClassification));
// TODO remember last selection
-
classificationSelectionCombo.addSelectionListener(this);
+
+
return classificationSelection;
}
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.TaxonNodeSelectionDialog;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
AbstractSelectionElement<TaxonNode> {
public static final int DEFAULT = DELETABLE;
+ private Classification classification;
/**
* <p>
@Override
public void widgetSelected(SelectionEvent e) {
TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),
- getConversationHolder(), "Select parent taxon", null, null);
+ getConversationHolder(), "Select parent taxon", null, null, getClassification());
setSelectionInternal(newSelection);
}
+ /**
+ * @return
+ */
+ public Classification getClassification() {
+ return classification;
+ }
+
+ public void setClassification(Classification classification){
+ this.classification = classification;
+ }
+
/*
* (non-Javadoc)
*