ref #6658: add calendar widget to dateElement
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / classification / EditTaxonNodeWizard.java
1 /**
2 * Copyright (C) 2016 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9 package eu.etaxonomy.taxeditor.ui.section.classification;
10
11 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
12 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
13 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
14 import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
15 import eu.etaxonomy.taxeditor.store.CdmStore;
16
17 /**
18 * @author k.luther
19 * @date 23.03.2016
20 *
21 */
22 public class EditTaxonNodeWizard extends AbstractEditWizard<ITaxonTreeNode> {
23
24 private TaxonNodeWizardPage taxonNodePage;
25 private IWizardPageListener wizardPageListener;
26
27 /* (non-Javadoc)
28 * @see eu.etaxonomy.taxeditor.ui.section.classification.AbstractEditWizard#getEntityName()
29 */
30 @Override
31 protected String getEntityName() {
32 return "taxon node";
33 }
34
35 /* (non-Javadoc)
36 * @see eu.etaxonomy.taxeditor.ui.section.classification.AbstractEditWizard#saveEntity()
37 */
38 @Override
39 protected void saveEntity() {
40 getConversationHolder().bind();
41 TaxonNode node = (TaxonNode)getEntity();
42
43 CdmStore.getService(ITaxonNodeService.class).merge(node, true);
44 }
45 @Override
46 public void addPages() {
47 taxonNodePage = new TaxonNodeWizardPage(formFactory, getConversationHolder(), getEntity(), wizardPageListener, false);
48
49 addPage(taxonNodePage);
50 }
51
52 public void addWizardPageListener(IWizardPageListener wizardPageListener){
53 this.wizardPageListener = wizardPageListener;
54 }
55
56 /* (non-Javadoc)
57 * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#setEntity(java.lang.Object)
58 */
59 @Override
60 public void setEntity(ITaxonTreeNode entity) {
61 setWindowTitle(String.format("Edit %s", getEntityName()));
62 entity = CdmStore.getService(ITaxonNodeService.class).load(entity.getUuid());
63 super.setEntity(entity);
64 }
65
66 }