Project

General

Profile

Download (3.42 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.service.ICollectionService;
17
import eu.etaxonomy.cdm.model.occurrence.Collection;
18
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
19
import eu.etaxonomy.taxeditor.newWizard.NewCollectionWizard;
20
import eu.etaxonomy.taxeditor.store.CdmStore;
21

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

    
32
	/**
33
	 * <p>select</p>
34
	 *
35
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
36
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
37
	 * @param collection a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
38
	 * @return a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
39
	 */
40
	public static Collection select(Shell shell, //ConversationHolder conversation,
41
	        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,//ConversationHolder conversation,
58
			 String title, boolean multi,
59
			String settings, Collection cdmObject) {
60
		super(shell, //conversation,
61
		        title, multi, settings, cdmObject);
62
	}
63

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

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

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

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

    
100

    
101
}
(8-8/41)