Revision 8c550777
Added by Andreas Müller over 10 years ago
.gitattributes | ||
---|---|---|
1235 | 1235 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/DerivedUnitSelectionDialog.java -text |
1236 | 1236 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FeatureSelectionDialog.java -text |
1237 | 1237 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FeatureTreeSelectionDialog.java -text |
1238 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FieldObservationSelectionDialog.java -text
|
|
1238 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FieldUnitSelectionDialog.java -text
|
|
1239 | 1239 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/GrantedAuthoritySelectionDialog.java -text |
1240 | 1240 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/GroupSelectionDialog.java -text |
1241 | 1241 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/InstitutionSelectionDialog.java -text |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FieldObservationSelectionDialog.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.FieldUnit; |
|
21 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
22 |
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; |
|
23 |
import eu.etaxonomy.taxeditor.newWizard.NewFieldUnitWizard; |
|
24 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
25 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
26 |
|
|
27 |
/** |
|
28 |
* <p>FilteredFieldObservationSelectionDialog class.</p> |
|
29 |
* |
|
30 |
* @author n.hoffmann |
|
31 |
* @created Jun 17, 2010 |
|
32 |
* @version 1.0 |
|
33 |
*/ |
|
34 |
public class FieldObservationSelectionDialog extends |
|
35 |
AbstractFilteredCdmResourceSelectionDialog<FieldUnit> { |
|
36 |
|
|
37 |
/** |
|
38 |
* <p>select</p> |
|
39 |
* |
|
40 |
* @param shell a {@link org.eclipse.swt.widgets.Shell} object. |
|
41 |
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
42 |
* @param observation a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object. |
|
43 |
* @return a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object. |
|
44 |
*/ |
|
45 |
public static FieldUnit select(Shell shell, ConversationHolder conversation, FieldUnit observation){ |
|
46 |
FieldObservationSelectionDialog dialog = new FieldObservationSelectionDialog(shell, conversation, |
|
47 |
"Choose Derived Unit", false, FieldObservationSelectionDialog.class.getCanonicalName(), observation); |
|
48 |
return getSelectionFromDialog(dialog); |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* <p>Constructor for FilteredFieldObservationSelectionDialog.</p> |
|
53 |
* |
|
54 |
* @param shell a {@link org.eclipse.swt.widgets.Shell} object. |
|
55 |
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
56 |
* @param title a {@link java.lang.String} object. |
|
57 |
* @param multi a boolean. |
|
58 |
* @param settings a {@link java.lang.String} object. |
|
59 |
* @param cdmObject a {@link eu.etaxonomy.cdm.model.occurrence.FieldObservation} object. |
|
60 |
*/ |
|
61 |
protected FieldObservationSelectionDialog(Shell shell, ConversationHolder conversation, |
|
62 |
String title, boolean multi, String settings, |
|
63 |
FieldUnit cdmObject) { |
|
64 |
super(shell, conversation, title, multi, settings, cdmObject); |
|
65 |
} |
|
66 |
|
|
67 |
/* (non-Javadoc) |
|
68 |
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID) |
|
69 |
*/ |
|
70 |
/** {@inheritDoc} */ |
|
71 |
@Override |
|
72 |
protected FieldUnit getPersistentObject(UUID uuid) { |
|
73 |
Object object = CdmStore.getService(IOccurrenceService.class).load(uuid); |
|
74 |
|
|
75 |
SpecimenOrObservationBase specimenObservationBase = (SpecimenOrObservationBase) HibernateProxyHelper.deproxy(object); |
|
76 |
|
|
77 |
if(specimenObservationBase instanceof FieldUnit){ |
|
78 |
return (FieldUnit) specimenObservationBase; |
|
79 |
} |
|
80 |
StoreUtil.error(this.getClass(), "Selected object is not a field observation", null); |
|
81 |
return null; |
|
82 |
} |
|
83 |
|
|
84 |
/* (non-Javadoc) |
|
85 |
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel() |
|
86 |
*/ |
|
87 |
/** {@inheritDoc} */ |
|
88 |
@Override |
|
89 |
protected void initModel() { |
|
90 |
model = CdmStore.getService(IOccurrenceService.class).getFieldUnitUuidAndTitleCache(); |
|
91 |
} |
|
92 |
|
|
93 |
/** {@inheritDoc} */ |
|
94 |
@Override |
|
95 |
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { |
|
96 |
return new NewFieldUnitWizard(); |
|
97 |
} |
|
98 |
|
|
99 |
/** {@inheritDoc} */ |
|
100 |
@Override |
|
101 |
protected String getNewWizardLinkText() { |
|
102 |
return String.format("Create a new <a>%1s</a>", "Field Observation "); |
|
103 |
} |
|
104 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FieldUnitSelectionDialog.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.FieldUnit; |
|
21 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
22 |
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; |
|
23 |
import eu.etaxonomy.taxeditor.newWizard.NewFieldUnitWizard; |
|
24 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
25 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
26 |
|
|
27 |
/** |
|
28 |
* <p>FilteredFieldObservationSelectionDialog class.</p> |
|
29 |
* |
|
30 |
* @author n.hoffmann |
|
31 |
* @created Jun 17, 2010 |
|
32 |
* @version 1.0 |
|
33 |
*/ |
|
34 |
public class FieldUnitSelectionDialog extends |
|
35 |
AbstractFilteredCdmResourceSelectionDialog<FieldUnit> { |
|
36 |
|
|
37 |
/** |
|
38 |
* <p>select</p> |
|
39 |
* |
|
40 |
* @param shell a {@link org.eclipse.swt.widgets.Shell} object. |
|
41 |
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
42 |
* @param observation a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object. |
|
43 |
* @return a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object. |
|
44 |
*/ |
|
45 |
public static FieldUnit select(Shell shell, ConversationHolder conversation, FieldUnit observation){ |
|
46 |
FieldUnitSelectionDialog dialog = new FieldUnitSelectionDialog(shell, conversation, |
|
47 |
"Choose Derived Unit", false, FieldUnitSelectionDialog.class.getCanonicalName(), observation); |
|
48 |
return getSelectionFromDialog(dialog); |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* <p>Constructor for FilteredFieldObservationSelectionDialog.</p> |
|
53 |
* |
|
54 |
* @param shell a {@link org.eclipse.swt.widgets.Shell} object. |
|
55 |
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
56 |
* @param title a {@link java.lang.String} object. |
|
57 |
* @param multi a boolean. |
|
58 |
* @param settings a {@link java.lang.String} object. |
|
59 |
* @param cdmObject a {@link eu.etaxonomy.cdm.model.occurrence.FieldObservation} object. |
|
60 |
*/ |
|
61 |
protected FieldUnitSelectionDialog(Shell shell, ConversationHolder conversation, |
|
62 |
String title, boolean multi, String settings, |
|
63 |
FieldUnit cdmObject) { |
|
64 |
super(shell, conversation, title, multi, settings, cdmObject); |
|
65 |
} |
|
66 |
|
|
67 |
/* (non-Javadoc) |
|
68 |
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID) |
|
69 |
*/ |
|
70 |
/** {@inheritDoc} */ |
|
71 |
@Override |
|
72 |
protected FieldUnit getPersistentObject(UUID uuid) { |
|
73 |
Object object = CdmStore.getService(IOccurrenceService.class).load(uuid); |
|
74 |
|
|
75 |
SpecimenOrObservationBase specimenObservationBase = (SpecimenOrObservationBase) HibernateProxyHelper.deproxy(object); |
|
76 |
|
|
77 |
if(specimenObservationBase instanceof FieldUnit){ |
|
78 |
return (FieldUnit) specimenObservationBase; |
|
79 |
} |
|
80 |
StoreUtil.error(this.getClass(), "Selected object is not a field unit", null); |
|
81 |
return null; |
|
82 |
} |
|
83 |
|
|
84 |
/* (non-Javadoc) |
|
85 |
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel() |
|
86 |
*/ |
|
87 |
/** {@inheritDoc} */ |
|
88 |
@Override |
|
89 |
protected void initModel() { |
|
90 |
model = CdmStore.getService(IOccurrenceService.class).getFieldUnitUuidAndTitleCache(); |
|
91 |
} |
|
92 |
|
|
93 |
/** {@inheritDoc} */ |
|
94 |
@Override |
|
95 |
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { |
|
96 |
return new NewFieldUnitWizard(); |
|
97 |
} |
|
98 |
|
|
99 |
/** {@inheritDoc} */ |
|
100 |
@Override |
|
101 |
protected String getNewWizardLinkText() { |
|
102 |
return String.format("Create a new <a>%1s</a>", "Field Unit "); |
|
103 |
} |
|
104 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java | ||
---|---|---|
91 | 91 |
return (T) DerivedUnitSelectionDialog.select(shell, conversation, (DerivedUnit) curentSelection); |
92 | 92 |
} |
93 | 93 |
if(clazz.equals(FieldUnit.class)){ |
94 |
return (T) FieldObservationSelectionDialog.select(shell, conversation, (FieldUnit) curentSelection);
|
|
94 |
return (T) FieldUnitSelectionDialog.select(shell, conversation, (FieldUnit) curentSelection);
|
|
95 | 95 |
} |
96 | 96 |
if(clazz.equals(NamedArea.class)){ |
97 | 97 |
return (T) NamedAreaSelectionDialog.select(shell, conversation, (NamedArea) curentSelection); |
Also available in: Unified diff
rename field observation in NewFieldObservationWizard.java and rename the class #3566