Project

General

Profile

Download (2.06 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2016 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10
package eu.etaxonomy.taxeditor.ui.section.classification;
11

    
12
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
13
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
14
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
15
import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
16
import eu.etaxonomy.taxeditor.store.CdmStore;
17

    
18
/**
19
 * @author k.luther
20
 * @date 23.03.2016
21
 *
22
 */
23
public class EditTaxonNodeWizard extends AbstractEditWizard<ITaxonTreeNode> {
24

    
25
    private TaxonNodeWizardPage taxonNodePage;
26
    private IWizardPageListener wizardPageListener;
27

    
28
    /* (non-Javadoc)
29
     * @see eu.etaxonomy.taxeditor.ui.section.classification.AbstractEditWizard#getEntityName()
30
     */
31
    @Override
32
    protected String getEntityName() {
33
        return "taxon node";
34
    }
35

    
36
    /* (non-Javadoc)
37
     * @see eu.etaxonomy.taxeditor.ui.section.classification.AbstractEditWizard#saveEntity()
38
     */
39
    @Override
40
    protected void saveEntity() {
41
        getConversationHolder().bind();
42
        TaxonNode node = (TaxonNode)getEntity();
43

    
44
        CdmStore.getService(ITaxonNodeService.class).merge(node, true);
45
    }
46
    @Override
47
    public void addPages() {
48
        taxonNodePage = new TaxonNodeWizardPage(formFactory, getConversationHolder(), getEntity(), wizardPageListener, false);
49

    
50
        addPage(taxonNodePage);
51
    }
52

    
53
    public void addWizardPageListener(IWizardPageListener wizardPageListener){
54
        this.wizardPageListener = wizardPageListener;
55
    }
56

    
57
    /* (non-Javadoc)
58
     * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#setEntity(java.lang.Object)
59
     */
60
    @Override
61
    public void setEntity(ITaxonTreeNode entity) {
62
        setWindowTitle(String.format("Edit %s", getEntityName()));
63
        entity = CdmStore.getService(ITaxonNodeService.class).load(entity.getUuid());
64
        super.setEntity(entity);
65
    }
66

    
67
}
(7-7/12)