Revision 7efbd7cf
Added by Katja Luther almost 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
|
|
11 |
package eu.etaxonomy.taxeditor.ui.dialog.selection; |
|
12 |
|
|
13 |
import java.util.UUID; |
|
14 |
|
|
15 |
import org.eclipse.swt.widgets.Shell; |
|
16 |
|
|
17 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
|
18 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
|
19 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
20 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
21 |
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; |
|
22 |
import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard; |
|
23 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author pplitzner |
|
27 |
*/ |
|
28 |
public class SpecimenOrObservationBaseSelectionDialog extends |
|
29 |
AbstractFilteredCdmResourceSelectionDialog<SpecimenOrObservationBase> { |
|
30 |
|
|
31 |
public static SpecimenOrObservationBase select(Shell shell, ConversationHolder conversation, SpecimenOrObservationBase observation){ |
|
32 |
SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, conversation, |
|
33 |
"Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation); |
|
34 |
return getSelectionFromDialog(dialog); |
|
35 |
} |
|
36 |
|
|
37 |
protected SpecimenOrObservationBaseSelectionDialog(Shell shell, ConversationHolder conversation, |
|
38 |
String title, boolean multi, String settings, |
|
39 |
SpecimenOrObservationBase cdmObject) { |
|
40 |
super(shell, conversation, title, multi, settings, cdmObject); |
|
41 |
} |
|
42 |
|
|
43 |
/** {@inheritDoc} */ |
|
44 |
@Override |
|
45 |
protected SpecimenOrObservationBase getPersistentObject(UUID uuid) { |
|
46 |
Object object = CdmStore.getService(IOccurrenceService.class).load(uuid); |
|
47 |
return HibernateProxyHelper.deproxy(object, SpecimenOrObservationBase.class); |
|
48 |
} |
|
49 |
|
|
50 |
/** {@inheritDoc} */ |
|
51 |
@Override |
|
52 |
protected void initModel() { |
|
53 |
model = CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache(); |
|
54 |
} |
|
55 |
|
|
56 |
/** {@inheritDoc} */ |
|
57 |
@Override |
|
58 |
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { |
|
59 |
return new NewDerivedUnitBaseWizard(); |
|
60 |
} |
|
61 |
|
|
62 |
/** {@inheritDoc} */ |
|
63 |
@Override |
|
64 |
protected String getNewWizardLinkText() { |
|
65 |
return String.format("Create a new <a>%1s</a>", "field unit/derived unit"); |
|
66 |
} |
|
67 |
} |
|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
|
|
11 |
package eu.etaxonomy.taxeditor.ui.dialog.selection; |
|
12 |
|
|
13 |
import java.util.UUID; |
|
14 |
|
|
15 |
import org.eclipse.swt.widgets.Shell; |
|
16 |
|
|
17 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
|
18 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
|
19 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
20 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
21 |
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; |
|
22 |
import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard; |
|
23 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author pplitzner |
|
27 |
*/ |
|
28 |
public class SpecimenOrObservationBaseSelectionDialog extends |
|
29 |
AbstractFilteredCdmResourceSelectionDialog<SpecimenOrObservationBase> { |
|
30 |
|
|
31 |
public static SpecimenOrObservationBase select(Shell shell, ConversationHolder conversation, SpecimenOrObservationBase observation){ |
|
32 |
SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, conversation, |
|
33 |
"Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation); |
|
34 |
return getSelectionFromDialog(dialog); |
|
35 |
} |
|
36 |
|
|
37 |
protected SpecimenOrObservationBaseSelectionDialog(Shell shell, ConversationHolder conversation, |
|
38 |
String title, boolean multi, String settings, |
|
39 |
SpecimenOrObservationBase cdmObject) { |
|
40 |
super(shell, conversation, title, multi, settings, cdmObject); |
|
41 |
} |
|
42 |
|
|
43 |
/** {@inheritDoc} */ |
|
44 |
@Override |
|
45 |
protected SpecimenOrObservationBase getPersistentObject(UUID uuid) { |
|
46 |
Object object = CdmStore.getService(IOccurrenceService.class).load(uuid); |
|
47 |
return HibernateProxyHelper.deproxy(object, SpecimenOrObservationBase.class); |
|
48 |
} |
|
49 |
|
|
50 |
/** {@inheritDoc} */ |
|
51 |
@Override |
|
52 |
protected void initModel() { |
|
53 |
model = CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache(null, null); |
|
54 |
} |
|
55 |
|
|
56 |
/** {@inheritDoc} */ |
|
57 |
@Override |
|
58 |
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { |
|
59 |
return new NewDerivedUnitBaseWizard(); |
|
60 |
} |
|
61 |
|
|
62 |
/** {@inheritDoc} */ |
|
63 |
@Override |
|
64 |
protected String getNewWizardLinkText() { |
|
65 |
return String.format("Create a new <a>%1s</a>", "field unit/derived unit"); |
|
66 |
} |
|
67 |
} |
Also available in: Unified diff
use the CdmFilteredSelectionDialog