Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.vaadin.flow.component.ClickEvent;
- import com.vaadin.flow.component.Component;
- import com.vaadin.flow.component.ComponentEventListener;
- import com.vaadin.flow.component.UI;
- import com.vaadin.flow.component.applayout.AppLayout;
- import com.vaadin.flow.component.applayout.DrawerToggle;
- import com.vaadin.flow.component.button.Button;
- import com.vaadin.flow.component.button.ButtonVariant;
- import com.vaadin.flow.component.html.Anchor;
- import com.vaadin.flow.component.html.Div;
- import com.vaadin.flow.component.html.Image;
- import com.vaadin.flow.component.icon.Icon;
- import com.vaadin.flow.component.icon.VaadinIcon;
- import com.vaadin.flow.component.orderedlayout.VerticalLayout;
- import com.vaadin.flow.server.InitialPageSettings;
- import com.vaadin.flow.server.PageConfigurator;
- public class BaseView extends AppLayout implements PageConfigurator {
- public BaseView() {
- Image logo = new Image(logoFilePath, "title");
- Anchor logogAnchor = new Anchor("/", logo);
- logogAnchor.setHeight("4em");
- logogAnchor.setHeight("4em");
- anchor.getStyle().set("display", "block");
- anchor.getStyle().set("margin-left", "auto");
- anchor.getStyle().set("margin-right", "auto");
- addToNavbar(new DrawerToggle(), logogAnchor);
- Component termsLink = //createLinkMethodCall;
- Component supportLink = //createLinkMethodCall;
- VerticalLayout drawerLayout = new VerticalLayout(termsLink, supportLink);
- addToDrawer(drawerLayout);
- setDrawerOpened(false);
- }
- }
- ==============================================================================================================
- import com.vaadin.flow.component.Component;
- import com.vaadin.flow.component.UI;
- import com.vaadin.flow.component.html.H4;
- import com.vaadin.flow.component.html.Label;
- import com.vaadin.flow.component.orderedlayout.FlexComponent;
- import com.vaadin.flow.component.orderedlayout.VerticalLayout;
- import com.vaadin.flow.component.page.Viewport;
- import com.vaadin.flow.router.Route;
- import com.vaadin.flow.theme.Theme;
- import com.vaadin.flow.theme.lumo.Lumo;
- import java.util.List;
- @Route
- @Theme(value = Lumo.class, variant = Lumo.DARK)
- @Viewport("width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes, viewport-fit=cover")
- public class MainView extends BaseView {
- public MainView() {
- UI.getCurrent().getPage().setTitle("MainPage");
- VerticalLayout layout = new VerticalLayout();
- Button button = new Button("Rules");
- Anchor anchor = new Anchor("/rules", button);
- layout.add(anchor);
- setContent(layout);
- }
- }
- ===========================================================================================================================
- import com.vaadin.flow.component.Html;
- import com.vaadin.flow.component.UI;
- import com.vaadin.flow.component.formlayout.FormLayout;
- import com.vaadin.flow.component.orderedlayout.FlexComponent;
- import com.vaadin.flow.component.orderedlayout.VerticalLayout;
- import com.vaadin.flow.component.page.Viewport;
- import com.vaadin.flow.router.Route;
- import com.vaadin.flow.theme.Theme;
- import com.vaadin.flow.theme.lumo.Lumo;
- @Route(value = "rules")
- @Theme(value = Lumo.class, variant = Lumo.DARK)
- @Viewport("width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes, viewport-fit=cover")
- public class RulesView extends BaseView {
- public RulesView() {
- UI.getCurrent().getPage().setTitle("Rules");
- VerticalLayout verticalLayout = new VerticalLayout();
- verticalLayout.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
- FormLayout formLayout = new FormLayout();
- //build page contents...
- verticalLayout.add(formLayout);
- setContent(verticalLayout);
- }
- }
- ========================================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement