Advertisement
Guest User

Untitled

a guest
Nov 4th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.91 KB | None | 0 0
  1. import com.vaadin.flow.component.ClickEvent;
  2. import com.vaadin.flow.component.Component;
  3. import com.vaadin.flow.component.ComponentEventListener;
  4. import com.vaadin.flow.component.UI;
  5. import com.vaadin.flow.component.applayout.AppLayout;
  6. import com.vaadin.flow.component.applayout.DrawerToggle;
  7. import com.vaadin.flow.component.button.Button;
  8. import com.vaadin.flow.component.button.ButtonVariant;
  9. import com.vaadin.flow.component.html.Anchor;
  10. import com.vaadin.flow.component.html.Div;
  11. import com.vaadin.flow.component.html.Image;
  12. import com.vaadin.flow.component.icon.Icon;
  13. import com.vaadin.flow.component.icon.VaadinIcon;
  14. import com.vaadin.flow.component.orderedlayout.VerticalLayout;
  15. import com.vaadin.flow.server.InitialPageSettings;
  16. import com.vaadin.flow.server.PageConfigurator;
  17.  
  18. public class BaseView extends AppLayout implements PageConfigurator {
  19.  
  20.     public BaseView() {
  21.         Image logo = new Image(logoFilePath, "title");
  22.         Anchor logogAnchor = new Anchor("/", logo);
  23.         logogAnchor.setHeight("4em");
  24.         logogAnchor.setHeight("4em");
  25.         anchor.getStyle().set("display", "block");
  26.         anchor.getStyle().set("margin-left", "auto");
  27.         anchor.getStyle().set("margin-right", "auto");
  28.         addToNavbar(new DrawerToggle(), logogAnchor);
  29.  
  30.         Component termsLink = //createLinkMethodCall;
  31.         Component supportLink = //createLinkMethodCall;
  32.         VerticalLayout drawerLayout = new VerticalLayout(termsLink, supportLink);
  33.         addToDrawer(drawerLayout);
  34.         setDrawerOpened(false);
  35.     }
  36. }
  37. ==============================================================================================================
  38.  
  39. import com.vaadin.flow.component.Component;
  40. import com.vaadin.flow.component.UI;
  41. import com.vaadin.flow.component.html.H4;
  42. import com.vaadin.flow.component.html.Label;
  43. import com.vaadin.flow.component.orderedlayout.FlexComponent;
  44. import com.vaadin.flow.component.orderedlayout.VerticalLayout;
  45. import com.vaadin.flow.component.page.Viewport;
  46. import com.vaadin.flow.router.Route;
  47. import com.vaadin.flow.theme.Theme;
  48. import com.vaadin.flow.theme.lumo.Lumo;
  49.  
  50. import java.util.List;
  51.  
  52. @Route
  53. @Theme(value = Lumo.class, variant = Lumo.DARK)
  54. @Viewport("width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes, viewport-fit=cover")
  55. public class MainView extends BaseView {
  56.  
  57.     public MainView() {
  58.         UI.getCurrent().getPage().setTitle("MainPage");
  59.         VerticalLayout layout = new VerticalLayout();
  60.         Button button = new Button("Rules");
  61.         Anchor anchor = new Anchor("/rules", button);
  62.         layout.add(anchor);
  63.         setContent(layout);
  64.     }
  65. }
  66.  
  67. ===========================================================================================================================
  68.  
  69. import com.vaadin.flow.component.Html;
  70. import com.vaadin.flow.component.UI;
  71. import com.vaadin.flow.component.formlayout.FormLayout;
  72. import com.vaadin.flow.component.orderedlayout.FlexComponent;
  73. import com.vaadin.flow.component.orderedlayout.VerticalLayout;
  74. import com.vaadin.flow.component.page.Viewport;
  75. import com.vaadin.flow.router.Route;
  76. import com.vaadin.flow.theme.Theme;
  77. import com.vaadin.flow.theme.lumo.Lumo;
  78.  
  79. @Route(value = "rules")
  80. @Theme(value = Lumo.class, variant = Lumo.DARK)
  81. @Viewport("width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes, viewport-fit=cover")
  82. public class RulesView extends BaseView {
  83.  
  84.     public RulesView() {
  85.         UI.getCurrent().getPage().setTitle("Rules");
  86.         VerticalLayout verticalLayout = new VerticalLayout();
  87.         verticalLayout.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
  88.         FormLayout formLayout = new FormLayout();
  89.         //build page contents...
  90.         verticalLayout.add(formLayout);
  91.         setContent(verticalLayout);
  92.     }
  93. }
  94.  
  95. ========================================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement