forked from vaadin/framework-spring-tutorial
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example case for spring-projects/spring-boot#9457
- Loading branch information
Showing
8 changed files
with
16 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,29 @@ | ||
package org.vaadin.spring.tutorial; | ||
|
||
import com.vaadin.annotations.Theme; | ||
import com.vaadin.navigator.View; | ||
import com.vaadin.navigator.ViewDisplay; | ||
import com.vaadin.server.VaadinRequest; | ||
import com.vaadin.spring.annotation.SpringUI; | ||
import com.vaadin.spring.annotation.SpringViewDisplay; | ||
import com.vaadin.ui.Button; | ||
import com.vaadin.ui.Component; | ||
import com.vaadin.ui.CssLayout; | ||
import com.vaadin.ui.Panel; | ||
import com.vaadin.ui.Label; | ||
import com.vaadin.ui.UI; | ||
import com.vaadin.ui.VerticalLayout; | ||
import com.vaadin.ui.themes.ValoTheme; | ||
|
||
@Theme("valo") | ||
@SpringUI | ||
@SpringViewDisplay | ||
public class MyUI extends UI implements ViewDisplay { | ||
public class MyUI extends UI { | ||
|
||
private Panel springViewDisplay; | ||
public static class TestObject { | ||
|
||
} | ||
|
||
@Override | ||
protected void init(VaadinRequest request) { | ||
// Note that getSession() returns VaadinSession, not the underlying HTTP | ||
// session. Use getSession().getSession() to get the wrapped HTTP | ||
// session | ||
getSession().setAttribute("not.serializable", new TestObject()); | ||
final VerticalLayout root = new VerticalLayout(); | ||
root.setSizeFull(); | ||
setContent(root); | ||
|
||
final CssLayout navigationBar = new CssLayout(); | ||
navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); | ||
navigationBar.addComponent(createNavigationButton("UI Scoped View", | ||
UIScopedView.VIEW_NAME)); | ||
navigationBar.addComponent(createNavigationButton("View Scoped View", | ||
ViewScopedView.VIEW_NAME)); | ||
root.addComponent(navigationBar); | ||
|
||
springViewDisplay = new Panel(); | ||
springViewDisplay.setSizeFull(); | ||
root.addComponent(springViewDisplay); | ||
root.setExpandRatio(springViewDisplay, 1.0f); | ||
root.addComponent(new Label("Good, now reload the app")); | ||
} | ||
|
||
private Button createNavigationButton(String caption, | ||
final String viewName) { | ||
Button button = new Button(caption); | ||
button.addStyleName(ValoTheme.BUTTON_SMALL); | ||
// If you didn't choose Java 8 when creating the project, convert this | ||
// to an anonymous listener class | ||
button.addClickListener( | ||
event -> getUI().getNavigator().navigateTo(viewName)); | ||
return button; | ||
} | ||
|
||
@Override | ||
public void showView(View view) { | ||
springViewDisplay.setContent((Component) view); | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
src/main/java/org/vaadin/spring/tutorial/UIScopedView.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
src/main/java/org/vaadin/spring/tutorial/ViewScopedView.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
src/test/java/org/vaadin/spring/tutorial/TutorialApplicationTests.java
This file was deleted.
Oops, something went wrong.