com.vaadin.flow.component.tabs.Tabs Java Examples

The following examples show how to use com.vaadin.flow.component.tabs.Tabs. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainLayout.java    From alibaba-rsocket-broker with Apache License 2.0 5 votes vote down vote up
public MainLayout(@Autowired RSocketBrokerHandlerRegistry handlerRegistry,
                  @Autowired ServiceRoutingSelector serviceRoutingSelector,
                  @Autowired RSocketBrokerManager rSocketBrokerManager,
                  @Autowired DnsResolveService resolveService,
                  @Autowired ConfigurationService configurationService,
                  @Autowired AuthenticationService authenticationService,
                  @Autowired RSocketFilterChain filterChain,
                  @Autowired @Qualifier("notificationProcessor") TopicProcessor<String> notificationProcessor) {
    this.handlerRegistry = handlerRegistry;
    this.serviceRoutingSelector = serviceRoutingSelector;
    this.rSocketBrokerManager = rSocketBrokerManager;
    this.resolveService = resolveService;
    this.configurationService = configurationService;
    this.authenticationService = authenticationService;
    this.filterChain = filterChain;
    this.notificationProcessor = notificationProcessor;
    //init the Layout
    Image logo = new Image("/rsocket-logo.svg", "RSocket Logo");
    logo.setHeight("44px");
    logo.setAlt("RSocket Cluster");
    addToNavbar(new DrawerToggle(), logo);

    final Tabs tabs = new Tabs(dashBoard(), apps(), dns(), appConfig(), services(), serviceTesting(), serviceMesh(), brokers(), filters(), jwt(), system(), faq());
    tabs.setOrientation(Tabs.Orientation.VERTICAL);
    tabs.addSelectedChangeListener(event -> {
        final Tab selectedTab = event.getSelectedTab();
        final Component component = tab2Workspace.get(selectedTab);
        setContent(component);
    });
    addToDrawer(tabs);
    setContent(new Span("click in the menu ;-) , you will see me never again.."));
}
 
Example #2
Source File: View1.java    From vaadin-app-layout with Apache License 2.0 4 votes vote down vote up
public View1() {
    VerticalLayout horizontalLayout = new VerticalLayout();
    horizontalLayout.getStyle().set("border", "1px black solid").set("padding", "10px").set("margin", "0px");
    add(horizontalLayout);

    Tab tab1 = new Tab("Tab one");
    Div page1 = new Div();
    page1.setText("Page#1");

    Tab tab2 = new Tab("Tab two");
    Div page2 = new Div();
    page2.setText("Page#2");
    page2.setVisible(false);

    Tab tab3 = new Tab("Tab three");
    Div page3 = new Div();
    page3.setText("Page#3");
    page3.setVisible(false);

    Map<Tab, Component> tabsToPages = new HashMap<>();
    tabsToPages.put(tab1, page1);
    tabsToPages.put(tab2, page2);
    tabsToPages.put(tab3, page3);
    Tabs tabs = new Tabs(tab1, tab2, tab3);
    Div pages = new Div(page1, page2, page3);

    Set<Component> pagesShown = Stream.of(page1)
            .collect(Collectors.toSet());

    tabs.addSelectedChangeListener(event -> {
        pagesShown.forEach(page -> page.setVisible(false));
        pagesShown.clear();
        Component selectedPage = tabsToPages.get(tabs.getSelectedTab());
        selectedPage.setVisible(true);
        pagesShown.add(selectedPage);
    });

    horizontalLayout.add(tabs, pages);

    horizontalLayout.add(new Button("Test", buttonClickEvent -> {
        Checkbox l = null;
        l.getLabel();
    }), new Checkbox("My Checkbox"));
    setMargin(false);
    setPadding(false);
    setSpacing(false);
    setAlignItems(Alignment.STRETCH);
    setFlexGrow(1, horizontalLayout);
    setSizeFull();
}
 
Example #3
Source File: MainLayout.java    From crudui with Apache License 2.0 4 votes vote down vote up
private void tabsSelectionChanged(Tabs.SelectedChangeEvent event) {
    if (event.isFromClient()) {
        UI.getCurrent().navigate((Class<? extends Component>) tabToView.get(event.getSelectedTab()));
    }
}