2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
;
12 import java
.util
.ArrayList
;
13 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import org
.eclipse
.swt
.widgets
.Shell
;
18 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
19 import eu
.etaxonomy
.cdm
.api
.service
.ITermService
;
20 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
21 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
22 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
23 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
28 * @created Dec 6, 2010
31 public class FeatureSelectionDialog
extends
32 AbstractFilteredCdmResourceSelectionDialog
<Feature
> {
34 public static Feature
select(Shell shell
, ConversationHolder conversation
, Feature feature
){
35 FeatureSelectionDialog dialog
= new FeatureSelectionDialog(shell
, conversation
,
36 "Choose Feature", false, FeatureSelectionDialog
.class.getCanonicalName(), feature
);
37 return getSelectionFromDialog(dialog
);
48 protected FeatureSelectionDialog(Shell shell
,
49 ConversationHolder conversation
, String title
, boolean multi
,
50 String settings
, Feature cdmObject
) {
51 super(shell
, conversation
, title
, multi
, settings
, cdmObject
);
55 protected Feature
getPersistentObject(UUID uuid
) {
57 DefinedTermBase
<?
> term
= CdmStore
.getService(ITermService
.class).load(uuid
);
59 if(term
instanceof Feature
){
60 return (Feature
) term
;
67 protected void initModel() {
68 List
<Feature
> features
= CdmStore
.getService(ITermService
.class).list(Feature
.class, null, null, null, null);
70 List
<UuidAndTitleCache
<Feature
>> featureUuidAndTitleCache
= new ArrayList
<UuidAndTitleCache
<Feature
>>();
72 for(Feature feature
: features
){
73 UuidAndTitleCache
<Feature
> uuidAndTitleCache
= new UuidAndTitleCache
<Feature
>(Feature
.class, feature
.getUuid(), feature
.getId(), feature
.getTitleCache());
74 featureUuidAndTitleCache
.add(uuidAndTitleCache
);
77 model
= featureUuidAndTitleCache
;
81 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
84 protected String
getNewWizardLinkText() {
89 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard()
92 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {