1
|
/**
|
2
|
* Copyright (C) 2014 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.dialog.selection;
|
10
|
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.eclipse.swt.widgets.Shell;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;
|
16
|
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
17
|
import eu.etaxonomy.cdm.model.molecular.Amplification;
|
18
|
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
19
|
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
|
20
|
import eu.etaxonomy.taxeditor.newWizard.NewAmplificationWizard;
|
21
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
22
|
|
23
|
/**
|
24
|
* @author pplitzner
|
25
|
* @date 11.03.2014
|
26
|
*
|
27
|
*/
|
28
|
public class AmplificationSelectionDialog extends
|
29
|
AbstractFilteredCdmResourceSelectionDialog<Amplification> {
|
30
|
|
31
|
public static Amplification select(Shell shell,
|
32
|
Amplification amplification){
|
33
|
AmplificationSelectionDialog dialog = new AmplificationSelectionDialog(shell, //conversation,
|
34
|
"Choose Amplification", false, AmplificationSelectionDialog.class.getCanonicalName(), amplification);
|
35
|
return getSelectionFromDialog(dialog);
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
|
40
|
*/
|
41
|
protected AmplificationSelectionDialog(Shell shell,
|
42
|
String title,
|
43
|
boolean multi, String settings, Amplification cdmObject) {
|
44
|
super(shell, //conversation,
|
45
|
title, multi, settings, cdmObject);
|
46
|
}
|
47
|
|
48
|
/** {@inheritDoc} */
|
49
|
@Override
|
50
|
protected Amplification getPersistentObject(UUID uuid) {
|
51
|
Object object = CdmStore.getService(IAmplificationService.class).load(uuid);
|
52
|
|
53
|
Amplification amplification = (Amplification) HibernateProxyHelper.deproxy(object);
|
54
|
|
55
|
if(amplification != null){
|
56
|
return amplification;
|
57
|
}
|
58
|
MessagingUtils.error(this.getClass(), "Selected element is not an amplification", null);
|
59
|
return null;
|
60
|
}
|
61
|
|
62
|
/** {@inheritDoc} */
|
63
|
@Override
|
64
|
protected void callService(String pattern) {
|
65
|
|
66
|
model = CdmStore.getService(IAmplificationService.class).getAmplificationUuidAndLabelCache(limitOfInitialElements, pattern);
|
67
|
// model = CdmStore.getService(IAmplificationService.class).getAmplificationUuidAndLabelCache();
|
68
|
|
69
|
}
|
70
|
|
71
|
/* (non-Javadoc)
|
72
|
* @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#getTitle(eu.etaxonomy.cdm.model.common.ICdmBase)
|
73
|
*/
|
74
|
@Override
|
75
|
protected String getTitle(Amplification cdmObject) {
|
76
|
if(cdmObject!=null){
|
77
|
return cdmObject.getLabelCache();
|
78
|
}
|
79
|
return super.getTitle(cdmObject);
|
80
|
}
|
81
|
|
82
|
/** {@inheritDoc} */
|
83
|
@Override
|
84
|
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
|
85
|
return new NewAmplificationWizard();
|
86
|
}
|
87
|
|
88
|
/** {@inheritDoc} */
|
89
|
@Override
|
90
|
protected String[] getNewWizardText() {
|
91
|
String[] result = new String[1];
|
92
|
result[0] = "New Amplification";
|
93
|
return result;
|
94
|
}
|
95
|
}
|