Project

General

Profile

Download (3.1 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 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.cdm.vaadin.view.phycobank;
10

    
11
import java.util.UUID;
12

    
13
import org.springframework.beans.factory.annotation.Autowired;
14

    
15
import com.vaadin.navigator.View;
16
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
17
import com.vaadin.spring.annotation.SpringView;
18
import com.vaadin.ui.Button;
19
import com.vaadin.ui.CssLayout;
20
import com.vaadin.ui.Label;
21

    
22
import eu.etaxonomy.cdm.vaadin.component.phycobank.RegistrationWorkflowComponent;
23
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.RegistrationType;
24
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.RegistrationWorkflowPresenter;
25
import eu.etaxonomy.vaadin.mvp.AbstractView;
26

    
27
/**
28
 * @author a.kohlbecker
29
 * @since Mar 2, 2017
30
 *
31
 */
32
@SpringView(name=RegistrationWorkflowViewBean.NAME)
33
public class RegistrationWorkflowViewBean extends AbstractView<RegistrationWorkflowPresenter>
34
    implements RegistrationWorkflowView, View {
35

    
36
    private static final long serialVersionUID = -213040114015958970L;
37

    
38
    public static final String NAME = "workflow";
39

    
40
    public static final String ACTION_NEW = "new";
41

    
42
    public static final String ACTION_EDIT = "edit";
43

    
44
    public RegistrationType regType = null;
45

    
46
    RegistrationWorkflowComponent design;
47

    
48
    public RegistrationWorkflowViewBean() {
49
        design = new RegistrationWorkflowComponent();
50
        setCompositionRoot(design);
51
    }
52

    
53
    /**
54
     * {@inheritDoc}
55
     */
56
    @Override
57
    public void enter(ViewChangeEvent event) {
58
        if(event.getParameters() != null){
59
           String[] params = event.getParameters().split("/");
60

    
61
           if(params[0].equals(ACTION_NEW)) {
62
               regType = RegistrationType.valueOf(params[1]);
63
               design.getTitle().setValue(design.getTitle().getValue() + "  " + regType.name() + " ...");
64
           } else if( params[0].equals(ACTION_EDIT)) {
65
               design.getTitle().setValue(design.getTitle().getValue() + "  " + params[1]);
66
           }
67
        }
68

    
69
    }
70

    
71
    /**
72
     * {@inheritDoc}
73
     */
74
    @Autowired
75
    @Override
76
    protected void injectPresenter(RegistrationWorkflowPresenter presenter) {
77
        setPresenter(presenter);
78
    }
79

    
80
    /* ------- RegistrationWorkflowView implementation ------- */
81

    
82
    /**
83
     * @return the title
84
     */
85
    @Override
86
    public Label getTitle() {
87
        return design.getTitle();
88
    }
89

    
90
    /**
91
     * @return the workflow
92
     */
93
    @Override
94
    public CssLayout getWorkflow() {
95
        return design.getWorkflow();
96
    }
97

    
98
    /**
99
     * @return the stepIndex
100
     */
101
    @Override
102
    public Button getStepIndex() {
103
        return design.getStepIndex();
104
    }
105

    
106
    /**
107
     * @return the caption
108
     */
109

    
110
    @Override
111
    public Label getCaptionLabel() {
112
        return design.getCaptionLabel();
113
    }
114

    
115
    /**
116
     * {@inheritDoc}
117
     */
118
    @Override
119
    public void openNameEditor(UUID nameUuid) {
120
        // TODO Auto-generated method stub
121

    
122
    }
123
}
(5-5/8)