Java源码示例:com.vaadin.flow.component.tabs.Tab
示例1
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.."));
}
示例2
private Tab dashBoard() {
final Span label = new Span("Dashboard");
final Icon icon = DASHBOARD.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new DashboardView(this.handlerRegistry, this.serviceRoutingSelector, this.rSocketBrokerManager));
return tab;
}
示例3
private Tab apps() {
final Span label = new Span("Apps");
final Icon icon = BULLETS.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new AppsView(this.handlerRegistry));
return tab;
}
示例4
private Tab dns() {
final Span label = new Span("DNS");
final Icon icon = RECORDS.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new DNSView(this.resolveService));
return tab;
}
示例5
private Tab appConfig() {
final Span label = new Span("AppConfig");
final Icon icon = DATABASE.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new AppConfigView(this.configurationService, this.rSocketBrokerManager));
return tab;
}
示例6
private Tab services() {
final Span label = new Span("Services");
final Icon icon = BULLETS.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new ServicesView(this.handlerRegistry, this.serviceRoutingSelector));
return tab;
}
示例7
private Tab serviceMesh() {
final Span label = new Span("ServiceMesh");
final Icon icon = CLUSTER.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new ServiceMeshView(this.handlerRegistry));
return tab;
}
示例8
private Tab brokers() {
final Span label = new Span("Brokers");
final Icon icon = CUBES.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new BrokersView(this.rSocketBrokerManager));
return tab;
}
示例9
private Tab system() {
final Span label = new Span("Server");
final Icon icon = SERVER.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new SystemView());
return tab;
}
示例10
private Tab serviceTesting() {
final Span label = new Span("Service Testing");
final Icon icon = TOOLS.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new ServiceTestingView(this.handlerRegistry, this.serviceRoutingSelector));
return tab;
}
示例11
private Tab faq() {
final Span label = new Span("FAQ");
final Icon icon = QUESTION.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new FAQView());
return tab;
}
示例12
private Tab jwt() {
final Span label = new Span("JWT");
final Icon icon = PASSWORD.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new JwtGeneratorView(this.authenticationService));
return tab;
}
示例13
private Tab filters() {
final Span label = new Span("RSocket Filters");
final Icon icon = FILTER.create();
final Tab tab = new Tab(new HorizontalLayout(icon, label));
tab2Workspace.put(tab, new RSocketFiltersView(this.filterChain, this.rSocketBrokerManager));
return tab;
}
示例14
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();
}
示例15
private void addTab(Class<? extends HasComponents> clazz) {
Tab tab = new Tab(DemoUtils.getViewName(clazz));
tabs.add(tab);
tabToView.put(tab, clazz);
viewToTab.put(clazz, tab);
}