Revision 3f1ceae0
Added by Andreas Kohlbecker about 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/design/phycobank/DashBoardDesign.java | ||
---|---|---|
21 | 21 |
public class DashBoardDesign extends VerticalLayout { |
22 | 22 |
protected CssLayout dashboard; |
23 | 23 |
protected Button buttonNew; |
24 |
protected Button buttonConinue; |
|
24 |
protected Button buttonContinue;
|
|
25 | 25 |
protected Button buttonList; |
26 | 26 |
|
27 | 27 |
public DashBoardDesign() { |
src/main/java/eu/etaxonomy/cdm/vaadin/design/phycobank/StartRegistrationDesign.java | ||
---|---|---|
1 |
package eu.etaxonomy.cdm.vaadin.design.phycobank; |
|
2 |
|
|
3 |
import com.vaadin.annotations.AutoGenerated; |
|
4 |
import com.vaadin.annotations.DesignRoot; |
|
5 |
import com.vaadin.ui.Button; |
|
6 |
import com.vaadin.ui.CssLayout; |
|
7 |
import com.vaadin.ui.VerticalLayout; |
|
8 |
import com.vaadin.ui.declarative.Design; |
|
9 |
|
|
10 |
/** |
|
11 |
* !! DO NOT EDIT THIS FILE !! |
|
12 |
* |
|
13 |
* This class is generated by Vaadin Designer and will be overwritten. |
|
14 |
* |
|
15 |
* Please make a subclass with logic and additional interfaces as needed, |
|
16 |
* e.g class LoginView extends LoginDesign implements View { } |
|
17 |
*/ |
|
18 |
@DesignRoot |
|
19 |
@AutoGenerated |
|
20 |
@SuppressWarnings("serial") |
|
21 |
public class StartRegistrationDesign extends VerticalLayout { |
|
22 |
protected CssLayout dashboard; |
|
23 |
protected Button buttonName; |
|
24 |
protected Button buttonTypification; |
|
25 |
|
|
26 |
public StartRegistrationDesign() { |
|
27 |
Design.read(this); |
|
28 |
} |
|
29 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/RegistrationUI.java | ||
---|---|---|
16 | 16 |
import com.vaadin.annotations.Viewport; |
17 | 17 |
import com.vaadin.annotations.Widgetset; |
18 | 18 |
import com.vaadin.navigator.ViewDisplay; |
19 |
import com.vaadin.server.ExternalResource; |
|
19 | 20 |
import com.vaadin.server.FontAwesome; |
21 |
import com.vaadin.server.Page; |
|
22 |
import com.vaadin.server.Resource; |
|
20 | 23 |
import com.vaadin.server.Responsive; |
21 | 24 |
import com.vaadin.server.VaadinRequest; |
22 | 25 |
import com.vaadin.spring.annotation.SpringUI; |
23 | 26 |
import com.vaadin.ui.Component; |
27 |
import com.vaadin.ui.Label; |
|
24 | 28 |
import com.vaadin.ui.UI; |
25 | 29 |
import com.vaadin.ui.themes.ValoTheme; |
26 | 30 |
|
27 | 31 |
import eu.etaxonomy.cdm.vaadin.view.phycobank.DashBoardView; |
28 |
import eu.etaxonomy.cdm.vaadin.view.phycobank.TestView1;
|
|
29 |
import eu.etaxonomy.cdm.vaadin.view.phycobank.TestView2;
|
|
32 |
import eu.etaxonomy.cdm.vaadin.view.phycobank.ListView;
|
|
33 |
import eu.etaxonomy.cdm.vaadin.view.phycobank.StartRegistrationView;
|
|
30 | 34 |
import eu.etaxonomy.vaadin.ui.MainMenu; |
31 | 35 |
import eu.etaxonomy.vaadin.ui.UIInitializedEvent; |
32 | 36 |
import eu.etaxonomy.vaadin.ui.navigation.NavigationEvent; |
... | ... | |
72 | 76 |
Responsive.makeResponsive(this); |
73 | 77 |
|
74 | 78 |
setContent((Component) viewDisplay); |
79 |
Label phycoBankLogo = new Label("PhycoBank"); |
|
80 |
phycoBankLogo.addStyleName("phycobank-green"); |
|
81 |
phycoBankLogo.addStyleName(ValoTheme.LABEL_HUGE); |
|
82 |
mainMenu.addMenuComponent(phycoBankLogo); |
|
75 | 83 |
|
76 |
mainMenu.addMenuItem(TestView1.NAME, FontAwesome.AMBULANCE, TestView1.NAME); |
|
77 |
mainMenu.addMenuItem(TestView2.NAME, FontAwesome.APPLE, TestView2.NAME); |
|
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); |
|
78 | 87 |
|
79 | 88 |
eventBus.publishEvent(new UIInitializedEvent()); |
80 | 89 |
|
81 | 90 |
//navigate to initial view |
82 | 91 |
eventBus.publishEvent(new NavigationEvent(DashBoardView.NAME)); |
92 |
|
|
93 |
//TODO the branding should be read from a properties file in .cdmLibrary/{instance-name}/cdm-vaadin.properties |
|
94 |
// See CdmUtils for appropriate methods to access this folder |
|
95 |
String brand = "phycobank"; |
|
96 |
|
|
97 |
// the 'vaadin://' protocol refers to the VAADIN folder |
|
98 |
Resource registryCssFile = new ExternalResource("vaadin://branding/" + brand + "/css/branding.css"); |
|
99 |
Page.getCurrent().getStyles().add(registryCssFile); |
|
83 | 100 |
} |
84 | 101 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/DashBoardView.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view.phycobank; |
10 | 10 |
|
11 |
import org.springframework.beans.factory.annotation.Autowired; |
|
12 |
import org.springframework.context.ApplicationEventPublisher; |
|
13 |
|
|
11 | 14 |
import com.vaadin.navigator.View; |
12 | 15 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
13 | 16 |
import com.vaadin.server.Responsive; |
14 | 17 |
import com.vaadin.spring.annotation.SpringView; |
15 | 18 |
|
16 | 19 |
import eu.etaxonomy.cdm.vaadin.design.phycobank.DashBoardDesign; |
20 |
import eu.etaxonomy.vaadin.ui.navigation.NavigationEvent; |
|
17 | 21 |
|
18 | 22 |
/** |
19 | 23 |
* @author a.kohlbecker |
... | ... | |
27 | 31 |
|
28 | 32 |
private static final long serialVersionUID = -6172448806905158782L; |
29 | 33 |
|
34 |
@Autowired |
|
35 |
ApplicationEventPublisher eventBus; |
|
36 |
|
|
30 | 37 |
public DashBoardView() { |
31 | 38 |
Responsive.makeResponsive(dashboard); |
39 |
buttonNew.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(StartRegistrationView.NAME))); |
|
40 |
buttonContinue.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(RegistrationWorkflowView.NAME))); |
|
41 |
buttonList.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(RegistrationWorkflowView.NAME))); |
|
32 | 42 |
} |
33 | 43 |
|
34 | 44 |
/** |
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/ListView.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 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; |
|
16 |
|
|
17 |
/** |
|
18 |
* @author a.kohlbecker |
|
19 |
* @since Mar 2, 2017 |
|
20 |
* |
|
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 |
} |
|
32 |
|
|
33 |
/** |
|
34 |
* {@inheritDoc} |
|
35 |
*/ |
|
36 |
@Override |
|
37 |
public void enter(ViewChangeEvent event) { |
|
38 |
|
|
39 |
} |
|
40 |
|
|
41 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/RegistrationWorkflowView.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 com.vaadin.navigator.View; |
|
12 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
|
13 |
import com.vaadin.spring.annotation.SpringView; |
|
14 |
|
|
15 |
/** |
|
16 |
* @author a.kohlbecker |
|
17 |
* @since Mar 2, 2017 |
|
18 |
* |
|
19 |
*/ |
|
20 |
@SpringView(name=RegistrationWorkflowView.NAME) |
|
21 |
public class RegistrationWorkflowView implements View { |
|
22 |
|
|
23 |
private static final long serialVersionUID = -213040114015958970L; |
|
24 |
|
|
25 |
public static final String NAME = "workflow"; |
|
26 |
|
|
27 |
/** |
|
28 |
* {@inheritDoc} |
|
29 |
*/ |
|
30 |
@Override |
|
31 |
public void enter(ViewChangeEvent event) { |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/StartRegistrationView.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 org.springframework.beans.factory.annotation.Autowired; |
|
12 |
import org.springframework.context.ApplicationEventPublisher; |
|
13 |
|
|
14 |
import com.vaadin.navigator.View; |
|
15 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
|
16 |
import com.vaadin.spring.annotation.SpringView; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.vaadin.design.phycobank.StartRegistrationDesign; |
|
19 |
import eu.etaxonomy.vaadin.ui.navigation.NavigationEvent; |
|
20 |
|
|
21 |
/** |
|
22 |
* @author a.kohlbecker |
|
23 |
* @since Mar 2, 2017 |
|
24 |
* |
|
25 |
*/ |
|
26 |
@SpringView(name=StartRegistrationView.NAME) |
|
27 |
public class StartRegistrationView extends StartRegistrationDesign implements View { |
|
28 |
|
|
29 |
private static final long serialVersionUID = -213040114015958970L; |
|
30 |
|
|
31 |
public static final String NAME = "regStart"; |
|
32 |
|
|
33 |
@Autowired |
|
34 |
ApplicationEventPublisher eventBus; |
|
35 |
|
|
36 |
public StartRegistrationView() { |
|
37 |
buttonName.addClickListener(e -> new NavigationEvent(RegistrationWorkflowView.NAME)); |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* {@inheritDoc} |
|
42 |
*/ |
|
43 |
@Override |
|
44 |
public void enter(ViewChangeEvent event) { |
|
45 |
|
|
46 |
} |
|
47 |
|
|
48 |
} |
src/main/java/eu/etaxonomy/vaadin/ui/MainMenu.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.vaadin.ui; |
2 | 2 |
|
3 | 3 |
import com.vaadin.server.Resource; |
4 |
import com.vaadin.ui.Component; |
|
4 | 5 |
|
5 | 6 |
/** |
6 | 7 |
* MainMenu acts as bean interface for components that appear as application |
7 | 8 |
* main menu. Which main menu implementation will be shown is decided on runtime |
8 | 9 |
* by dependency injection. |
9 |
*
|
|
10 |
* |
|
10 | 11 |
* @author Peter / Vaadin |
11 | 12 |
* |
12 | 13 |
*/ |
... | ... | |
14 | 15 |
|
15 | 16 |
/** |
16 | 17 |
* Adds new menu item with given caption and icon to the menu. |
17 |
*
|
|
18 |
* |
|
18 | 19 |
* @param caption |
19 | 20 |
* @param icon |
20 | 21 |
* @param navigationResource |
... | ... | |
22 | 23 |
*/ |
23 | 24 |
MainMenuItem addMenuItem(String caption, Resource icon, String navigationResource); |
24 | 25 |
|
26 |
public void addMenuComponent(Component component); |
|
27 |
|
|
25 | 28 |
public interface MainMenuItem { |
26 | 29 |
String getCaption(); |
27 | 30 |
|
src/main/java/eu/etaxonomy/vaadin/ui/mainmenu/ValoMainMenuBean.java | ||
---|---|---|
14 | 14 |
import com.vaadin.spring.annotation.SpringComponent; |
15 | 15 |
import com.vaadin.spring.annotation.UIScope; |
16 | 16 |
import com.vaadin.ui.Button; |
17 |
import com.vaadin.ui.Component; |
|
17 | 18 |
import com.vaadin.ui.CssLayout; |
18 | 19 |
import com.vaadin.ui.themes.ValoTheme; |
19 | 20 |
|
... | ... | |
102 | 103 |
protected void afterViewChange(AfterViewChangeEvent event) { |
103 | 104 |
removeStyleName(MENU_VISIBLE); |
104 | 105 |
} |
106 |
|
|
107 |
/** |
|
108 |
* {@inheritDoc} |
|
109 |
*/ |
|
110 |
@Override |
|
111 |
public void addMenuComponent(Component component) { |
|
112 |
menuArea.addComponent(component); |
|
113 |
} |
|
105 | 114 |
} |
src/main/resources/eu/etaxonomy/cdm/vaadin/design/phycobank/DashBoardDesign.html | ||
---|---|---|
7 | 7 |
</head> |
8 | 8 |
<body> |
9 | 9 |
<vaadin-vertical-layout> |
10 |
<vaadin-label style-name="logo_giant" size-auto plain-text :center> |
|
10 |
<vaadin-label style-name="logo_giant phycobank-green" size-auto plain-text :center>
|
|
11 | 11 |
PhycoBank |
12 | 12 |
</vaadin-label> |
13 | 13 |
<vaadin-label size-auto plain-text :center> |
... | ... | |
23 | 23 |
</vaadin-label> |
24 | 24 |
</vaadin-vertical-layout> |
25 | 25 |
<vaadin-vertical-layout style-name="dashboard-action-3" spacing size-auto margin> |
26 |
<vaadin-button icon="fonticon://FontAwesome/f061" style-name="borderless icon-align-top giant" plain-text _id="buttonConinue" :middle :center> |
|
26 |
<vaadin-button icon="fonticon://FontAwesome/f061" style-name="borderless icon-align-top giant" plain-text _id="buttonContinue" :middle :center>
|
|
27 | 27 |
Continue |
28 | 28 |
</vaadin-button> |
29 | 29 |
<vaadin-label size-auto plain-text :center> |
src/main/resources/eu/etaxonomy/cdm/vaadin/design/phycobank/RegistrationWorkflowDesign.html | ||
---|---|---|
1 |
<!doctype html> |
|
2 |
<html> |
|
3 |
<head> |
|
4 |
<meta charset="UTF-8"> |
|
5 |
<meta name="design-properties" content="{"RULERS_VISIBLE":true,"GUIDELINES_VISIBLE":false,"SNAP_TO_OBJECTS":true,"SNAP_TO_GRID":true,"SNAPPING_DISTANCE":10,"JAVA_SOURCES_ROOT":"src/main/java","THEME":"edit-valo"}"> |
|
6 |
<meta name="vaadin-version" content="7.7.0"> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
<vaadin-vertical-layout> |
|
10 |
<vaadin-label style-name="huge" size-auto plain-text :center> |
|
11 |
New Registration |
|
12 |
</vaadin-label> |
|
13 |
<vaadin-label size-auto plain-text :middle :center> |
|
14 |
What are you about to register, a scientific name or a typification for a name? |
|
15 |
</vaadin-label> |
|
16 |
<vaadin-css-layout style-name="dashboard-actions" responsive _id="dashboard" :center> |
|
17 |
<vaadin-vertical-layout style-name="dashboard-action-2" spacing size-auto margin> |
|
18 |
<vaadin-button icon="fonticon://FontAwesome/f02b" style-name="borderless icon-align-top giant" plain-text _id="buttonNew" :middle :center> |
|
19 |
Name |
|
20 |
</vaadin-button> |
|
21 |
<vaadin-label size-auto plain-text :center> |
|
22 |
Start a new registration of a name scientific name. |
|
23 |
</vaadin-label> |
|
24 |
</vaadin-vertical-layout> |
|
25 |
<vaadin-vertical-layout style-name="dashboard-action-2" spacing size-auto margin> |
|
26 |
<vaadin-button icon="fonticon://FontAwesome/f02c" style-name="borderless icon-align-top giant" plain-text _id="buttonContinue" :middle :center> |
|
27 |
Typification |
|
28 |
</vaadin-button> |
|
29 |
<vaadin-label size-auto plain-text :center> |
|
30 |
Start a new registration of a typification. |
|
31 |
</vaadin-label> |
|
32 |
</vaadin-vertical-layout> |
|
33 |
</vaadin-css-layout> |
|
34 |
</vaadin-vertical-layout> |
|
35 |
</body> |
|
36 |
</html> |
src/main/resources/eu/etaxonomy/cdm/vaadin/design/phycobank/StartRegistrationDesign.html | ||
---|---|---|
1 |
<!doctype html> |
|
2 |
<html> |
|
3 |
<head> |
|
4 |
<meta charset="UTF-8"> |
|
5 |
<meta name="design-properties" content="{"RULERS_VISIBLE":true,"GUIDELINES_VISIBLE":false,"SNAP_TO_OBJECTS":true,"SNAP_TO_GRID":true,"SNAPPING_DISTANCE":10,"JAVA_SOURCES_ROOT":"src/main/java","THEME":"edit-valo"}"> |
|
6 |
<meta name="vaadin-version" content="7.7.0"> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
<vaadin-vertical-layout spacing> |
|
10 |
<vaadin-label style-name="huge" size-auto plain-text :center> |
|
11 |
New Registration |
|
12 |
</vaadin-label> |
|
13 |
<vaadin-label size-auto plain-text :middle :center> |
|
14 |
What are you about to register, a scientific name or a typification for a name? |
|
15 |
</vaadin-label> |
|
16 |
<vaadin-css-layout style-name="dashboard-actions" responsive _id="dashboard" :center> |
|
17 |
<vaadin-vertical-layout style-name="dashboard-action-2" spacing size-auto margin> |
|
18 |
<vaadin-button icon="fonticon://FontAwesome/f02b" style-name="borderless icon-align-top giant" plain-text _id="buttonName" :middle :center> |
|
19 |
Name |
|
20 |
</vaadin-button> |
|
21 |
<vaadin-label size-auto plain-text :center> |
|
22 |
Start the registration process for a scientific name. |
|
23 |
</vaadin-label> |
|
24 |
</vaadin-vertical-layout> |
|
25 |
<vaadin-vertical-layout style-name="dashboard-action-2" spacing size-auto margin> |
|
26 |
<vaadin-button icon="fonticon://FontAwesome/f02c" enabled="false" style-name="borderless icon-align-top giant" plain-text _id="buttonTypification" :middle :center> |
|
27 |
Typification |
|
28 |
</vaadin-button> |
|
29 |
<vaadin-label size-auto plain-text :center> |
|
30 |
Start the registration process for a typification. |
|
31 |
</vaadin-label> |
|
32 |
</vaadin-vertical-layout> |
|
33 |
</vaadin-css-layout> |
|
34 |
</vaadin-vertical-layout> |
|
35 |
</body> |
|
36 |
</html> |
src/main/webapp/VAADIN/branding/phycobank/css/branding.css | ||
---|---|---|
1 |
.phycobank-green { |
|
2 |
color: #2C9208; |
|
3 |
} |
src/main/webapp/VAADIN/themes/edit-valo/edit-valo.scss | ||
---|---|---|
71 | 71 |
.dashboard-actions { |
72 | 72 |
margin: 0 10%; |
73 | 73 |
|
74 |
.dashboard-action-2 { |
|
75 |
width: 50%; |
|
76 |
.v-label { |
|
77 |
white-space: normal; |
|
78 |
} |
|
79 |
} |
|
74 | 80 |
.dashboard-action-3 { |
75 | 81 |
width: 33%; |
76 | 82 |
.v-label { |
... | ... | |
78 | 84 |
} |
79 | 85 |
} |
80 | 86 |
&[width-range~="-650px"] { |
81 |
.dashboard-action-3 { |
|
87 |
.dashboard-action-2, .dashboard-action-3 {
|
|
82 | 88 |
width: 100%; |
83 | 89 |
} |
84 | 90 |
} |
Also available in: Unified diff
ref #6169 more views for starting registrations and basic branding