Revision fe0647c6
Added by Patrick Plitzner about 8 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java | ||
---|---|---|
203 | 203 |
|
204 | 204 |
//init tree |
205 | 205 |
updateRootEntities(((DerivateViewEditorInput)getEditorInput()).getDerivativeUuids()); |
206 |
//set taxon filter |
|
207 |
derivateSearchCompositeController.setTaxonFilter(((DerivateViewEditorInput) getEditorInput()).getTaxonUuid()); |
|
206 | 208 |
//reset status bar |
207 | 209 |
getEditorSite().getActionBars().getStatusLineManager().setMessage(""); |
208 | 210 |
|
... | ... | |
276 | 278 |
getEditorSite().getActionBars().getStatusLineManager().setMessage(rootElements.size() +" derivative hierarchies found"); |
277 | 279 |
|
278 | 280 |
//set selection to derivatives if the filter criteria |
279 |
//taxon assignment or or derivative type are set
|
|
281 |
//taxon assignment or derivative type are set |
|
280 | 282 |
if(derivates!=null && !derivateSearchCompositeController.isDefaultSearch()){ |
281 | 283 |
List<TreeNode> nodesToSelect = new ArrayList<TreeNode>(); |
282 | 284 |
for (SpecimenOrObservationBase specimenOrObservationBase : derivates) { |
... | ... | |
566 | 568 |
@Override |
567 | 569 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
568 | 570 |
derivateSearchCompositeController.setEnabled(!listenToSelectionChange); |
569 |
viewer.getTree().setEnabled(true); |
|
571 |
if(!viewer.getTree().isDisposed()){ |
|
572 |
viewer.getTree().setEnabled(true); |
|
573 |
} |
|
570 | 574 |
refreshTree(); |
571 | 575 |
} |
572 | 576 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java | ||
---|---|---|
25 | 25 |
*/ |
26 | 26 |
public class DerivateViewEditorInput implements IEditorInput { |
27 | 27 |
|
28 |
Collection<UUID> derivativeUuids; |
|
28 |
private Collection<UUID> derivativeUuids; |
|
29 |
private UUID taxonUuid; |
|
29 | 30 |
|
30 | 31 |
public DerivateViewEditorInput() { |
31 | 32 |
} |
32 | 33 |
|
33 |
public DerivateViewEditorInput(Collection<UUID> derivativeUuids) { |
|
34 |
public DerivateViewEditorInput(Collection<UUID> derivativeUuids, UUID taxonUuid) {
|
|
34 | 35 |
this.derivativeUuids = derivativeUuids; |
36 |
this.taxonUuid = taxonUuid; |
|
37 |
} |
|
38 |
|
|
39 |
public DerivateViewEditorInput(Collection<UUID> derivativeUuids) { |
|
40 |
this(derivativeUuids, null); |
|
35 | 41 |
} |
36 | 42 |
|
37 | 43 |
public Collection<UUID> getDerivativeUuids() { |
38 | 44 |
return derivativeUuids; |
39 | 45 |
} |
40 | 46 |
|
47 |
public UUID getTaxonUuid() { |
|
48 |
return taxonUuid; |
|
49 |
} |
|
50 |
|
|
41 | 51 |
@Override |
42 | 52 |
public Object getAdapter(Class adapter) { |
43 | 53 |
return null; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForTaxonNode.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
12 | 12 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
13 |
import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator; |
|
13 | 14 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
14 | 15 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
15 | 16 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
... | ... | |
28 | 29 |
|
29 | 30 |
@Override |
30 | 31 |
protected void open(ExecutionEvent event, TaxonNode entity) { |
31 |
List<SpecimenOrObservationBase> specimens = CdmStore.getService(IOccurrenceService.class).listByAssociatedTaxon(SpecimenOrObservationBase.class, null, entity.getTaxon(), null, null, null, null, null); |
|
32 |
FindOccurrencesConfigurator config = new FindOccurrencesConfigurator(); |
|
33 |
UUID taxonUuid = entity.getTaxon().getUuid(); |
|
34 |
config.setAssociatedTaxonUuid(taxonUuid); |
|
35 |
List<SpecimenOrObservationBase> specimens = CdmStore.getService(IOccurrenceService.class).findByTitle(config).getRecords(); |
|
32 | 36 |
Collection<UUID> specimenUuids = new ArrayList<UUID>(); |
33 | 37 |
for (SpecimenOrObservationBase specimenOrObservationBase : specimens) { |
34 | 38 |
specimenUuids.add(specimenOrObservationBase.getUuid()); |
35 | 39 |
} |
36 | 40 |
try { |
37 |
EditorUtil.open(new DerivateViewEditorInput(specimenUuids)); |
|
41 |
EditorUtil.open(new DerivateViewEditorInput(specimenUuids, taxonUuid));
|
|
38 | 42 |
} catch (PartInitException e) { |
39 | 43 |
MessagingUtils.error(OpenDerivateViewHandler.class, "Derivative Editor could not be opened", e); |
40 | 44 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter; |
11 | 11 |
|
12 | 12 |
import java.util.List; |
13 |
import java.util.UUID; |
|
13 | 14 |
|
14 | 15 |
import org.eclipse.swt.SWT; |
15 | 16 |
import org.eclipse.swt.layout.GridData; |
... | ... | |
19 | 20 |
import org.eclipse.swt.widgets.Widget; |
20 | 21 |
|
21 | 22 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
23 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
22 | 24 |
import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator; |
23 | 25 |
import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator.AssignmentStatus; |
26 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
24 | 27 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
25 | 28 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
26 | 29 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
30 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
27 | 31 |
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView; |
32 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
28 | 33 |
import eu.etaxonomy.taxeditor.store.SearchManager; |
29 | 34 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory; |
30 | 35 |
import eu.etaxonomy.taxeditor.ui.mvc.combo.EnumTermComboController; |
... | ... | |
137 | 142 |
|
138 | 143 |
/** |
139 | 144 |
* Checks whether or not the search criteria are set to their default value.<br> |
140 |
* This does not consider the title search field.
|
|
145 |
* This does not consider the title search field. |
|
141 | 146 |
* @return <code>true</code> if search criteria are set to default. |
142 | 147 |
*/ |
143 | 148 |
public boolean isDefaultSearch(){ |
... | ... | |
163 | 168 |
labelProvider.setConversation(conversationHolder); |
164 | 169 |
} |
165 | 170 |
|
171 |
public void setTaxonFilter(UUID taxonUuid) { |
|
172 |
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonUuid); |
|
173 |
if(taxonBase!=null && taxonBase.isInstanceOf(Taxon.class)){ |
|
174 |
selectedTaxon = HibernateProxyHelper.deproxy(taxonBase, Taxon.class); |
|
175 |
derivateSearchComposite.getTextTaxonName().setText(taxonBase.getTitleCache()); |
|
176 |
derivateSearchComposite.getLbltaxonAssignment().setEnabled(false); |
|
177 |
derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ASSIGNED_SPECIMENS); |
|
178 |
derivateSearchComposite.getComboTaxonAssignment().setEnabled(false); |
|
179 |
} |
|
180 |
} |
|
181 |
|
|
166 | 182 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java | ||
---|---|---|
39 | 39 |
import eu.etaxonomy.cdm.model.media.Media; |
40 | 40 |
import eu.etaxonomy.cdm.model.name.NameRelationship; |
41 | 41 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
42 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
|
43 | 42 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
44 | 43 |
import eu.etaxonomy.cdm.model.reference.Reference; |
45 | 44 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
... | ... | |
179 | 178 |
"mediaSpecimen" |
180 | 179 |
}); |
181 | 180 |
|
182 |
if(configurator.getClazz()==null){ |
|
183 |
if(showFieldUnits){ |
|
184 |
configurator.setClazz(SpecimenOrObservationBase.class); |
|
185 |
} |
|
186 |
else{ |
|
187 |
configurator.setClazz(DerivedUnit.class); |
|
188 |
} |
|
189 |
} |
|
190 | 181 |
List<String> occurrencePropertyPaths = new ArrayList<String>(); |
191 | 182 |
occurrencePropertyPaths.addAll(BASE_OCCURRENCE_INIT_STRATEGY); |
192 | 183 |
for(String propertyPath:BASE_OCCURRENCE_INIT_STRATEGY) { |
Also available in: Unified diff
Set taxon filter when opening derivativwe editor from taxon navigator
#5514