// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
-import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
import eu.etaxonomy.taxeditor.newWizard.NewGrantedAuthorityWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityLabelTextProvider;
/**
* @author a.kohlbecker
public class GrantedAuthoritySelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<GrantedAuthorityImpl> {
public static GrantedAuthority select(Shell shell, ConversationHolder conversation, GrantedAuthorityImpl authority){
-
+
GrantedAuthoritySelectionDialog dialog = new GrantedAuthoritySelectionDialog(shell, conversation,
"Choose Granted Authority", false, GrantedAuthoritySelectionDialog.class.getCanonicalName(), authority);
-
+
return getSelectionFromDialog(dialog);
}
-
+
/**
* @param shell
* @param conversation
@Override
protected void initModel() {
List<GrantedAuthorityImpl> authorities = CdmStore.getService(IGrantedAuthorityService.class).list(GrantedAuthorityImpl.class, null, null, null, null);
-
+
model = new ArrayList<UuidAndTitleCache<GrantedAuthorityImpl>>();
-
+
for(GrantedAuthorityImpl authority : authorities){
- model.add(new UuidAndTitleCache<GrantedAuthorityImpl>(GrantedAuthorityImpl.class, authority.getUuid(),String.format("%s", authority.getAuthority())));
- }
+
+ model.add(new UuidAndTitleCache<GrantedAuthorityImpl>(GrantedAuthorityImpl.class, authority.getUuid(), authority.getId(), String.format("%s", GrantedAuthorityLabelTextProvider.getText(authority))));
+ }
}
/* (non-Javadoc)
*/
@Override
protected String getNewWizardLinkText() {
- return "Create a new <A>GrantedAuthority</A>.";
+ return String.format("Create a new <a>%1s</a>", "GrantedAuthority ");
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
- */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return new NewGrantedAuthorityWizard();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
- */
@Override
protected GrantedAuthorityImpl getPersistentObject(UUID uuid) {
return CdmStore.getService(IGrantedAuthorityService.class).load(uuid);
}
-
+
@Override
protected String getTitle(GrantedAuthorityImpl authority) {
- return authority != null ? authority.getAuthority() : "";
+ return authority != null ? GrantedAuthorityLabelTextProvider.getText(authority) : "";
}
}