Project

General

Profile

Revision ec462234

IDec4622343cb1abd673560ac0bed8cb000659095a
Parent c33e979b
Child ccba3ab6

Added by Andreas Kohlbecker over 2 years ago

ref #6169 initial list view on registrations

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/phycobank/RegistrationItemComponent.java
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.component.phycobank;
10

  
11
import com.vaadin.ui.Button;
12
import com.vaadin.ui.CustomComponent;
13
import com.vaadin.ui.HorizontalLayout;
14
import com.vaadin.ui.Label;
15

  
16
/**
17
 * @author a.kohlbecker
18
 * @since Mar 6, 2017
19
 *
20
 */
21
public class RegistrationItemComponent extends CustomComponent {
22

  
23
    private static final long serialVersionUID = -3585430974956346927L;
24

  
25
    private HorizontalLayout container;
26
    private Label statusIcon = new Label();
27
    private Label summary = new Label();
28
    private Button editButton = new Button("Edit");
29

  
30
    /**
31
     * @return the statusIcon
32
     */
33
    public Label getStatusIcon() {
34
        return statusIcon;
35
    }
36
    /**
37
     * @return the summary
38
     */
39
    public Label getSummary() {
40
        return summary;
41
    }
42
    /**
43
     * @return the editButton
44
     */
45
    public Button getEdit() {
46
        return editButton;
47
    }
48

  
49
    /**
50
     *
51
     */
52
    public RegistrationItemComponent() {
53
        container.setSpacing(true);
54
        container.setWidth(100, Unit.PERCENTAGE);
55
        container.addComponent(statusIcon);
56
        summary.setWidth(100, Unit.PERCENTAGE);
57
        container.addComponent(summary);
58
        container.addComponent(editButton);
59
    }
60

  
61
}
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/phycobank/ListPresenter.java
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.presenter.phycobank;
10

  
11
import java.util.ArrayList;
12
import java.util.Collection;
13
import java.util.UUID;
14

  
15
import org.joda.time.DateTime;
16

  
17
import com.vaadin.spring.annotation.SpringComponent;
18
import com.vaadin.spring.annotation.ViewScope;
19

  
20
import eu.etaxonomy.cdm.api.service.pager.Pager;
21
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
22
import eu.etaxonomy.cdm.vaadin.view.phycobank.ListView;
23
import eu.etaxonomy.vaadin.mvp.AbstractPresenter;
24

  
25
/**
26
 * @author a.kohlbecker
27
 * @since Mar 3, 2017
28
 *
29
 */
30
@SpringComponent
31
@ViewScope
32
public class ListPresenter extends AbstractPresenter<ListView> {
33

  
34
    private static final int PAGESIZE =20;
35

  
36
    @Override
37
    public void onViewEnter() {
38
        super.onViewEnter();
39
        getView().populateTable(listRegistrations());
40
    }
41

  
42
    /**
43
     * @return
44
     */
45
    private Collection<RegistrationDTO> listRegistrations() {
46
        Pager<TaxonNameBase> pager = getRepo().getNameService().page(TaxonNameBase.class, PAGESIZE, 0, null, null);
47
        Collection<RegistrationDTO> dtos = new ArrayList<>(pager.getRecords().size());
48
        pager.getRecords().forEach(i -> { dtos.add(new RegistrationDTO(i)); });
49
        return dtos;
50
    }
51

  
52
    private static int idAutoincrement = 100000;
53

  
54
    public class RegistrationDTO{
55

  
56
        private String summary;
57
        private UUID registeredEntityUuid;
58

  
59
        private RegistrationType registrationType;
60
        private RegistrationStatus status;
61
        private String registrationId;
62
        private String internalRegId;
63
        private DateTime registrationDate = null;
64
        private DateTime created = null;
65

  
66

  
67

  
68
        /**
69
         * @param name
70
         */
71
        public RegistrationDTO(TaxonNameBase name) {
72
            summary = name.getTitleCache();
73
            registeredEntityUuid = name.getUuid();
74

  
75
            registrationType = RegistrationType.name;
76
            status = RegistrationStatus.preparation;
77
            internalRegId = Integer.toString(ListPresenter.idAutoincrement++);
78
            registrationId = "http://pyhcobank.org/" + internalRegId;
79
            created = DateTime.now();
80

  
81
        }
82

  
83
        /**
84
         * @return the summary
85
         */
86
        public String getSummary() {
87
            return summary;
88
        }
89

  
90

  
91
        /**
92
         * @param summary the summary to set
93
         */
94
        public void setSummary(String summary) {
95
            this.summary = summary;
96
        }
97

  
98

  
99
        /**
100
         * @return the registrationType
101
         */
102
        public RegistrationType getRegistrationType() {
103
            return registrationType;
104
        }
105

  
106

  
107
        /**
108
         * @param registrationType the registrationType to set
109
         */
110
        public void setRegistrationType(RegistrationType registrationType) {
111
            this.registrationType = registrationType;
112
        }
113

  
114

  
115
        /**
116
         * @return the status
117
         */
118
        public RegistrationStatus getStatus() {
119
            return status;
120
        }
121

  
122

  
123
        /**
124
         * @param status the status to set
125
         */
126
        public void setStatus(RegistrationStatus status) {
127
            this.status = status;
128
        }
129

  
130

  
131
        /**
132
         * @return the registrationId
133
         */
134
        public String getRegistrationId() {
135
            return registrationId;
136
        }
137

  
138

  
139
        /**
140
         * @param registrationId the registrationId to set
141
         */
142
        public void setRegistrationId(String registrationId) {
143
            this.registrationId = registrationId;
144
        }
145

  
146

  
147
        /**
148
         * @return the internalRegId
149
         */
150
        public String getInternalRegId() {
151
            return internalRegId;
152
        }
153

  
154

  
155
        /**
156
         * @param internalRegId the internalRegId to set
157
         */
158
        public void setInternalRegId(String internalRegId) {
159
            this.internalRegId = internalRegId;
160
        }
161

  
162

  
163
        /**
164
         * @return the registeredEntityUuid
165
         */
166
        public UUID getRegisteredEntityUuid() {
167
            return registeredEntityUuid;
168
        }
169

  
170

  
171
        /**
172
         * @param registeredEntityUuid the registeredEntityUuid to set
173
         */
174
        public void setRegisteredEntityUuid(UUID registeredEntityUuid) {
175
            this.registeredEntityUuid = registeredEntityUuid;
176
        }
177

  
178
        /**
179
         * @return the registrationDate
180
         */
181
        public DateTime getRegistrationDate() {
182
            return registrationDate;
183
        }
184

  
185
        /**
186
         * @return the created
187
         */
188
        public DateTime getCreated() {
189
            return created;
190
        }
191

  
192
    }
193

  
194
    public enum RegistrationStatus {
195

  
196
        preparation,// A new record which is being edited by the Author
197
        curation, //A record ready for the curator to be validated.
198
        ready, //The record has passed the validation by the curator and is ready for publication.
199
        published, //The name or typification has finally been published.
200
        rejected //The registration has been rejected, the process is aborted and the record is preserved.
201
    }
202

  
203
}
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/phycobank/RegistrationWorkflowPresenter.java
38 38
    protected void onRegistrationStartEvent(RegistrationStartEvent e){
39 39
        this.registrationType = e.getType();
40 40
        getView().getTitle().setValue(getView().getTitle().getValue() + " " + registrationType.name());
41

  
41
        getView().openNameEditor(null);
42 42
    }
43 43

  
44 44
}
src/main/java/eu/etaxonomy/cdm/vaadin/ui/RegistrationUI.java
29 29
import com.vaadin.ui.themes.ValoTheme;
30 30

  
31 31
import eu.etaxonomy.cdm.vaadin.view.phycobank.DashBoardView;
32
import eu.etaxonomy.cdm.vaadin.view.phycobank.ListView;
32
import eu.etaxonomy.cdm.vaadin.view.phycobank.ListViewBean;
33 33
import eu.etaxonomy.cdm.vaadin.view.phycobank.StartRegistrationView;
34 34
import eu.etaxonomy.vaadin.ui.MainMenu;
35 35
import eu.etaxonomy.vaadin.ui.UIInitializedEvent;
......
82 82
        mainMenu.addMenuComponent(phycoBankLogo);
83 83

  
84 84
        mainMenu.addMenuItem("New", FontAwesome.EDIT, StartRegistrationView.NAME);
85
        mainMenu.addMenuItem("Continue", FontAwesome.ARROW_RIGHT, ListView.NAME);
86
        mainMenu.addMenuItem("List", FontAwesome.TASKS, ListView.NAME);
85
        mainMenu.addMenuItem("Continue", FontAwesome.ARROW_RIGHT, ListViewBean.NAME);
86
        mainMenu.addMenuItem("List", FontAwesome.TASKS, ListViewBean.NAME);
87 87

  
88 88
        eventBus.publishEvent(new UIInitializedEvent());
89 89

  
src/main/java/eu/etaxonomy/cdm/vaadin/util/JodaDateTimeConverter.java
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.util;
10

  
11
import java.util.Date;
12
import java.util.Locale;
13

  
14
import org.joda.time.DateTime;
15

  
16
import com.vaadin.data.util.converter.Converter;
17

  
18
/**
19
 * @author a.kohlbecker
20
 * @since Mar 7, 2017
21
 *
22
 */
23
public final class JodaDateTimeConverter implements Converter<Date, DateTime> {
24
    @Override
25
    public DateTime convertToModel(Date value, Class<? extends DateTime> targetType, Locale locale)
26
            throws com.vaadin.data.util.converter.Converter.ConversionException {
27
        DateTime dateTime = null;
28
        if(value != null) {
29
            try {
30
                dateTime = new DateTime(value);
31
            } catch (IllegalArgumentException e) {
32
                throw new ConversionException(e);
33
            }
34
        }
35
        return dateTime;
36
    }
37

  
38
    @Override
39
    public Date convertToPresentation(DateTime value, Class<? extends Date> targetType, Locale locale)
40
            throws com.vaadin.data.util.converter.Converter.ConversionException {
41
        Date date = null;
42
        if(value != null){
43
            date = value.toDate();
44
        }
45
        return date;
46
    }
47

  
48
    @Override
49
    public Class<DateTime> getModelType() {
50
        return DateTime.class;
51
    }
52

  
53
    @Override
54
    public Class<Date> getPresentationType() {
55
        return Date.class;
56
    }
57
}
src/main/java/eu/etaxonomy/cdm/vaadin/util/UrlStringConverter.java
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.util;
10

  
11
import java.util.Locale;
12

  
13
import com.vaadin.data.util.converter.Converter;
14

  
15
/**
16
 * @author a.kohlbecker
17
 * @since Mar 7, 2017
18
 *
19
 */
20
public final class UrlStringConverter implements Converter<String, String> {
21
    @Override
22
    public String convertToModel(String value, Class<? extends String> targetType, Locale locale)
23
            throws com.vaadin.data.util.converter.Converter.ConversionException {
24
        return null;
25
    }
26

  
27
    @Override
28
    public String convertToPresentation(String value, Class<? extends String> targetType, Locale locale)
29
            throws com.vaadin.data.util.converter.Converter.ConversionException {
30
        // TODO Auto-generated method stub
31
        return "<a href=\"" + value + "\" target=\"external\">" + value + "</a>";
32
    }
33

  
34
    @Override
35
    public Class<String> getModelType() {
36
        return String.class;
37
    }
38

  
39
    @Override
40
    public Class<String> getPresentationType() {
41
        return String.class;
42
    }
43
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/DashBoardView.java
37 37
    public DashBoardView() {
38 38
        Responsive.makeResponsive(dashboard);
39 39
        buttonNew.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(StartRegistrationView.NAME)));
40
        buttonContinue.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(RegistrationWorkflowViewBean.NAME)));
41
        buttonList.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(RegistrationWorkflowViewBean.NAME)));
40
        buttonContinue.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(ListViewBean.NAME)));
41
        buttonList.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(ListViewBean.NAME)));
42 42
    }
43 43

  
44 44
    /**
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/ListView.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.view.phycobank;
10 10

  
11
import com.vaadin.navigator.View;
12
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
13
import com.vaadin.spring.annotation.SpringView;
14
import com.vaadin.ui.Label;
15
import com.vaadin.ui.VerticalLayout;
11
import java.util.Collection;
12

  
13
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.ListPresenter;
14
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.ListPresenter.RegistrationDTO;
15
import eu.etaxonomy.vaadin.mvp.ApplicationView;
16 16

  
17 17
/**
18 18
 * @author a.kohlbecker
19
 * @since Mar 2, 2017
19
 * @since Mar 3, 2017
20 20
 *
21 21
 */
22
@SpringView(name=ListView.NAME)
23
public class ListView extends VerticalLayout implements View {
24

  
25
    private static final long serialVersionUID = 3543300933072824713L;
26

  
27
    public static final String NAME = "list";
28

  
29
    public ListView() {
30
        addComponent(new Label("List View"));
31
    }
22
public interface ListView extends ApplicationView<ListPresenter>{
32 23

  
33 24
    /**
34
     * {@inheritDoc}
25
     * @param page
35 26
     */
36
    @Override
37
    public void enter(ViewChangeEvent event) {
38

  
39
    }
27
    void populateTable(Collection<RegistrationDTO> registrations);
40 28

  
41 29
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/ListViewBean.java
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.Collection;
12
import java.util.Locale;
13

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

  
16
import com.vaadin.data.Item;
17
import com.vaadin.data.util.BeanContainer;
18
import com.vaadin.data.util.GeneratedPropertyContainer;
19
import com.vaadin.data.util.PropertyValueGenerator;
20
import com.vaadin.data.util.converter.Converter;
21
import com.vaadin.navigator.View;
22
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
23
import com.vaadin.server.FontAwesome;
24
import com.vaadin.spring.annotation.SpringView;
25
import com.vaadin.ui.Alignment;
26
import com.vaadin.ui.Grid;
27
import com.vaadin.ui.Grid.Column;
28
import com.vaadin.ui.Grid.SelectionMode;
29
import com.vaadin.ui.Label;
30
import com.vaadin.ui.VerticalLayout;
31
import com.vaadin.ui.renderers.ButtonRenderer;
32
import com.vaadin.ui.renderers.DateRenderer;
33
import com.vaadin.ui.renderers.HtmlRenderer;
34
import com.vaadin.ui.themes.ValoTheme;
35

  
36
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.ListPresenter;
37
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.ListPresenter.RegistrationDTO;
38
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.RegistrationType;
39
import eu.etaxonomy.cdm.vaadin.util.JodaDateTimeConverter;
40
import eu.etaxonomy.cdm.vaadin.util.UrlStringConverter;
41
import eu.etaxonomy.vaadin.mvp.AbstractView;
42
import eu.etaxonomy.vaadin.ui.navigation.NavigationEvent;
43

  
44
/**
45
 * @author a.kohlbecker
46
 * @since Mar 2, 2017
47
 *
48
 */
49
@SpringView(name=ListViewBean.NAME)
50
public class ListViewBean extends AbstractView<ListPresenter> implements ListView, View {
51

  
52
    /**
53
     * @author a.kohlbecker
54
     * @since Mar 7, 2017
55
     *
56
     */
57
    protected final class RegistrationTypeConverter implements Converter<String, RegistrationType> {
58
        @Override
59
        public RegistrationType convertToModel(String value, Class<? extends RegistrationType> targetType,
60
                Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
61
            // not implemented
62
            return null;
63
        }
64

  
65
        @Override
66
        public String convertToPresentation(RegistrationType value, Class<? extends String> targetType,
67
                Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
68
            if(value.equals(RegistrationType.name)) {
69
                return FontAwesome.TAG.getHtml();
70
            }
71
            if(value.equals(RegistrationType.name)) {
72
                return FontAwesome.TAGS.getHtml();
73
            }
74
            return FontAwesome.WARNING.getHtml();
75
        }
76

  
77
        @Override
78
        public Class<RegistrationType> getModelType() {
79
            return RegistrationType.class;
80
        }
81

  
82
        @Override
83
        public Class<String> getPresentationType() {
84
            return String.class;
85
        }
86
    }
87
    private static final long serialVersionUID = 3543300933072824713L;
88

  
89
    public static final String NAME = "list";
90

  
91
    private VerticalLayout layout;
92

  
93
    private Grid grid;
94

  
95
    public ListViewBean() {
96
        layout = new VerticalLayout();
97
        layout.setSpacing(true);
98

  
99
        Label title = new Label("Registrations");
100
        title.setStyleName(ValoTheme.LABEL_HUGE);
101
        layout.addComponent(title);
102
        layout.setComponentAlignment(title, Alignment.TOP_CENTER);
103

  
104
        Label hint = new Label("This is the list of all your registrations in progress.");
105
        layout.addComponent(hint);
106
        layout.setComponentAlignment(hint, Alignment.MIDDLE_CENTER);
107

  
108
        grid = buildGrid();
109
        layout.addComponent(grid);
110

  
111
        setCompositionRoot(layout);
112
    }
113

  
114
    private Grid buildGrid() {
115
        Grid grid = new Grid();
116
        grid.setSizeFull();
117
        grid.setEditorEnabled(false);
118
        grid.setId("registration-list");
119
        grid.setCellStyleGenerator(cellRef -> cellRef.getPropertyId().toString());
120
        grid.setSelectionMode(SelectionMode.NONE);
121
        // add status as class  attribute to the rows to allow styling with css
122
        grid.setRowStyleGenerator(rowRef -> {return "status-" + rowRef.getItem().getItemProperty("status").getValue().toString();});
123
        return grid;
124
    }
125

  
126
    /**
127
     * {@inheritDoc}
128
     */
129
    @Override
130
    public void enter(ViewChangeEvent event) {
131
        getPresenter().onViewEnter();
132

  
133
    }
134

  
135
    /**
136
     * {@inheritDoc}
137
     */
138
    @Override
139
    @Autowired
140
    protected void injectPresenter(ListPresenter presenter) {
141
        setPresenter(presenter);
142

  
143
    }
144

  
145
    static final String[] visiblCols = new String[]{"status, summary", "registrationId"};
146
    /**
147
     * {@inheritDoc}
148
     */
149
    @Override
150
    public void populateTable(Collection<RegistrationDTO> registrations) {
151

  
152
        BeanContainer<String, RegistrationDTO> registrationItems = new BeanContainer<String, RegistrationDTO>(RegistrationDTO.class);
153
        registrationItems.setBeanIdProperty("internalRegId");
154
        registrationItems.addAll(registrations);
155

  
156
        grid.setContainerDataSource(buildGeneratedProperties(registrationItems));
157

  
158
        grid.removeAllColumns();
159

  
160
        Column typeColumn = grid.addColumn("registrationType");
161
        typeColumn.setRenderer(new HtmlRenderer(), new RegistrationTypeConverter());
162
        typeColumn.setHeaderCaption("");
163
        typeColumn.setExpandRatio(0);
164

  
165
        Column statusColumn = grid.addColumn("status");
166
        statusColumn.setExpandRatio(0);
167

  
168
        Column summaryColumn = grid.addColumn("summary");
169
        summaryColumn.setExpandRatio(1);
170

  
171
        Column regidColumn = grid.addColumn("registrationId");
172
        regidColumn.setHeaderCaption("Id");
173
        regidColumn.setRenderer(new HtmlRenderer(), new UrlStringConverter());
174

  
175
        Column createdColumn = grid.addColumn("created");
176
        createdColumn.setRenderer(new DateRenderer(), new JodaDateTimeConverter());
177
        createdColumn.setHidable(true);
178
        createdColumn.setHidden(true);
179

  
180
        Column regDateColumn = grid.addColumn("registrationDate");
181
        // regDateColumn.setHeaderCaption("Date");
182
        regDateColumn.setRenderer(new DateRenderer(), new JodaDateTimeConverter());
183
        regDateColumn.setHidable(true);
184
        regDateColumn.setHidden(true);
185

  
186

  
187
        Column buttonColumn = grid.addColumn("operation");
188
        buttonColumn.setRenderer(new ButtonRenderer(e -> eventBus.publishEvent(new NavigationEvent(
189
                RegistrationWorkflowViewBean.NAME,
190
                RegistrationWorkflowViewBean.ACTION_EDIT,
191
                e.getItemId().toString()
192
                ))));
193
        buttonColumn.setSortable(false);
194

  
195
    }
196

  
197
    /**
198
     * @param registrationItems
199
     * @return
200
     */
201
    private GeneratedPropertyContainer buildGeneratedProperties(
202
            BeanContainer<String, RegistrationDTO> registrationItems) {
203
        GeneratedPropertyContainer gpContainer = new GeneratedPropertyContainer(registrationItems);
204

  
205
        gpContainer.addGeneratedProperty("operation", new PropertyValueGenerator<String>() {
206

  
207
            @Override
208
            public String getValue(Item item, Object itemId, Object propertyId) {
209
                return "Edit";
210
            }
211

  
212
            @Override
213
            public Class<String> getType() {
214
                return String.class;
215
            }
216
          });
217

  
218
        return gpContainer;
219
    }
220

  
221
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/RegistrationWorkflowViewBean.java
37 37

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

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

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

  
40 44
    public RegistrationType regType = null;
41 45

  
42 46
    RegistrationWorkflowComponent design;
......
53 57
    public void enter(ViewChangeEvent event) {
54 58
        if(event.getParameters() != null){
55 59
           String[] params = event.getParameters().split("/");
56
           if(params.length > 0){
57
               regType = RegistrationType.valueOf(params[0]);
60

  
61
           if(params[0].equals(ACTION_NEW)) {
62
               regType = RegistrationType.valueOf(params[1]);
58 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]);
59 66
           }
60 67
        }
61 68

  
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/StartRegistrationView.java
35 35
    ApplicationEventPublisher eventBus;
36 36

  
37 37
    public StartRegistrationView() {
38
        buttonName.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(RegistrationWorkflowViewBean.NAME+ "/" + RegistrationType.name)));
38
        buttonName.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(
39
                RegistrationWorkflowViewBean.NAME,
40
                RegistrationWorkflowViewBean.ACTION_NEW,
41
                RegistrationType.name.name()
42
                )));
39 43
    }
40 44

  
41 45
    /**
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPresenter.java
3 3
import java.util.logging.Logger;
4 4

  
5 5
import org.springframework.beans.factory.annotation.Autowired;
6
import org.springframework.beans.factory.annotation.Qualifier;
6 7

  
7 8
import com.vaadin.spring.annotation.SpringComponent;
9
import com.vaadin.spring.annotation.ViewScope;
8 10

  
9 11
import eu.etaxonomy.cdm.api.application.CdmRepository;
10 12

  
......
19 21
 *            type of the view this presenter governs
20 22
 */
21 23
@SpringComponent
24
@ViewScope
22 25
public abstract class AbstractPresenter<V extends ApplicationView> {
23 26

  
24 27
	private V view;
25 28

  
26
	@Autowired
27
	private CdmRepository repo;
28 29

  
29 30
	protected V getView() {
30 31
		return view;
31 32
	}
32 33

  
34
	@Autowired
35
	@Qualifier("cdmRepository")
36
	private CdmRepository repo;
37

  
38
	/**
39
	 * @return the repo
40
	 */
41
	public CdmRepository getRepo() {
42
	    return repo;
43
	}
44

  
33 45
	/**
34 46
	 * Notifies the presenter that its view is initialized so that presenter can
35 47
	 * start its own initialization if required.
......
61 73
	public void onViewExit() {
62 74

  
63 75
	}
76

  
64 77
}
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractView.java
30 30
	private ApplicationContext applicationContext;
31 31

  
32 32
    @Autowired
33
    ApplicationEventPublisher eventBus;
33
    protected ApplicationEventPublisher eventBus;
34 34

  
35 35
	@PostConstruct
36 36
	protected final void init() {
src/main/java/eu/etaxonomy/vaadin/ui/navigation/NavigationEvent.java
1 1
package eu.etaxonomy.vaadin.ui.navigation;
2 2

  
3
import com.vaadin.client.renderers.ClickableRenderer.RendererClickEvent;
4

  
3 5
public class NavigationEvent {
4 6

  
5
	private final String viewName;
7
	public static final char SEPARATOR = '/';
6 8

  
7
	public NavigationEvent(String viewName) {
9
    private final String viewName;
10

  
11
	public NavigationEvent(String viewName, RendererClickEvent event) {
8 12
		this.viewName = viewName;
9 13
	}
10 14

  
15
	public NavigationEvent(String viewName, String ... parameters) {
16
	    StringBuilder sb = new StringBuilder(viewName);
17
        for(String p : parameters){
18
            sb.append(SEPARATOR).append(p);
19
        }
20
        this.viewName = sb.toString();
21
    }
22

  
23
	public NavigationEvent(String viewName) {
24
        this.viewName = viewName;
25
    }
26

  
11 27
	public String getViewName() {
12 28
		return viewName;
13 29
	}
30

  
14 31
}
src/main/webapp/VAADIN/themes/edit-valo/edit-valo.scss
25 25
//$v-error-indicator-color: #ed473b;
26 26

  
27 27
// ================== DARK ================ //
28
/*
28

  
29 29
$v-app-loading-text: "Dark Valo";
30 30
$v-background-color: #444d50;
31 31
$v-focus-color: #07a9ca;
......
43 43
$v-unit-size: 40px;
44 44
$v-overlay-shadow: 0 0 0 3px (v-shade 8), 0 5px 10px (v-shade 4);
45 45
$v-component-group-spacing: 6px;
46
*/
46

  
47 47
// ========================================== //
48 48

  
49 49
// For more information, see: https://vaadin.com/book/-/page/themes.valo.html
......
146 146
            }
147 147
        }
148 148
    }
149
    
150
    #registration-list {
151
        .status-preparation td.status {
152
            color: green;
153
        }
154
    }
149 155

  
150 156
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)