3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.dialogs
.filteredSelection
;
13 import java
.util
.UUID
;
15 import org
.eclipse
.swt
.widgets
.Shell
;
17 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
18 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
19 import eu
.etaxonomy
.cdm
.strategy
.cache
.reference
.ReferenceBaseDefaultCacheStrategy
;
20 import eu
.etaxonomy
.taxeditor
.editor
.newWizard
.AbstractNewEntityWizard
;
21 import eu
.etaxonomy
.taxeditor
.editor
.newWizard
.NewReferenceWizard
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 * <p>FilteredReferenceSelectionDialog class.</p>
31 public class FilteredReferenceSelectionDialog
extends AbstractFilteredCdmResourceSelectionDialog
<Reference
> {
36 * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
37 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
38 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
39 * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
41 public static Reference
select(Shell shell
, ConversationHolder conversation
, Reference reference
) {
42 FilteredReferenceSelectionDialog dialog
= new FilteredReferenceSelectionDialog(shell
, conversation
,
43 "Choose a reference", false, (Reference
) reference
);
44 return getSelectionFromDialog(dialog
);
49 * <p>Constructor for FilteredReferenceSelectionDialog.</p>
51 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
52 * @param title a {@link java.lang.String} object.
53 * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
54 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
55 * @param multi a boolean.
57 protected FilteredReferenceSelectionDialog(Shell shell
, ConversationHolder conversation
, String title
, boolean multi
, Reference reference
) {
58 super(shell
, conversation
, title
, multi
, FilteredReferenceSelectionDialog
.class.getCanonicalName(), null);
63 * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
67 protected Reference
getPersistentObject(UUID cdmUuid
) {
68 return CdmStore
.getReferenceService().load(cdmUuid
);
72 * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel()
76 protected void initModel() {
77 model
= CdmStore
.getReferenceService().getUuidAndTitleCache();
83 protected String
getTitle(Reference cdmObject
) {
84 if(cdmObject
.getAuthorTeam() == null){
85 return super.getTitle(cdmObject
);
87 return ReferenceBaseDefaultCacheStrategy
.putAuthorToEndOfString(cdmObject
.getTitleCache(), cdmObject
.getAuthorTeam().getTitleCache());
93 protected AbstractNewEntityWizard
getNewEntityWizard() {
94 return new NewReferenceWizard();
99 protected String
getNewWizardLinkText() {
100 return "Click <A>here</A> to create a new reference.";