Project

General

Profile

Download (3.41 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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

    
10
package eu.etaxonomy.taxeditor.ui.dialog.selection;
11

    
12
import java.util.UUID;
13

    
14
import org.eclipse.swt.widgets.Shell;
15

    
16
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
17
import eu.etaxonomy.cdm.api.service.ICollectionService;
18
import eu.etaxonomy.cdm.model.occurrence.Collection;
19
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
20
import eu.etaxonomy.taxeditor.newWizard.NewCollectionWizard;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * <p>FilteredCollectionSelectionDialog class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created Oct 13, 2010
28
 * @version 1.0
29
 */
30
public class CollectionSelectionDialog extends
31
		AbstractFilteredCdmResourceSelectionDialog<Collection> {
32

    
33
	/**
34
	 * <p>select</p>
35
	 *
36
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
37
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
38
	 * @param collection a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
39
	 * @return a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
40
	 */
41
	public static Collection select(Shell shell, ConversationHolder conversation, Collection collection){
42
		CollectionSelectionDialog dialog = new CollectionSelectionDialog(shell, conversation,
43
				"Choose Collection", false, CollectionSelectionDialog.class.getCanonicalName(), collection);
44
		return getSelectionFromDialog(dialog);
45
	}
46

    
47
	/**
48
	 * <p>Constructor for FilteredCollectionSelectionDialog.</p>
49
	 *
50
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
51
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
52
	 * @param title a {@link java.lang.String} object.
53
	 * @param multi a boolean.
54
	 * @param settings a {@link java.lang.String} object.
55
	 * @param cdmObject a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
56
	 */
57
	protected CollectionSelectionDialog(Shell shell,
58
			ConversationHolder conversation, String title, boolean multi,
59
			String settings, Collection cdmObject) {
60
		super(shell, conversation, title, multi, settings, cdmObject);
61
	}
62

    
63
	/* (non-Javadoc)
64
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
65
	 */
66
	/** {@inheritDoc} */
67
	@Override
68
	protected Collection getPersistentObject(UUID uuid) {
69
		return CdmStore.getService(ICollectionService.class).load(uuid);
70
	}
71

    
72
	/* (non-Javadoc)
73
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
74
	 */
75
	/** {@inheritDoc} */
76
	@Override
77
	protected void search() {
78
		model = CdmStore.getService(ICollectionService.class).getUuidAndTitleCache(null, null);
79
	}
80

    
81
	/* (non-Javadoc)
82
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
83
	 */
84
	/** {@inheritDoc} */
85
	@Override
86
	protected String[] getNewWizardText() {
87
        return new String[]{ "Collection "};
88
	}
89

    
90
	/* (non-Javadoc)
91
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard()
92
	 */
93
	/** {@inheritDoc} */
94
	@Override
95
	protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
96
		return new NewCollectionWizard();
97
	}
98

    
99

    
100
}
(8-8/40)