com.vaadin.flow.component.html.Span Java Examples
The following examples show how to use
com.vaadin.flow.component.html.Span.
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: DnDCustomComponentView.java From flow with Apache License 2.0 | 7 votes |
public DraggableItem(EffectAllowed effectAllowed) { dragHandle = new Div(); dragHandle.setHeight("50px"); dragHandle.setWidth("80px"); dragHandle.getStyle().set("background", "#000 "); dragHandle.getStyle().set("margin", "5 10px"); dragHandle.getStyle().set("display", "inline-block"); setDraggable(true); setDragData(effectAllowed); addDragStartListener(DnDCustomComponentView.this::onDragStart); addDragEndListener(DnDCustomComponentView.this::onDragEnd); setHeight("50px"); setWidth("200px"); getStyle().set("border", "1px solid black"); getStyle().set("display", "inline-block"); add(dragHandle, new Span(effectAllowed.toString())); }
Example #2
Source File: ResynchronizationView.java From flow with Apache License 2.0 | 6 votes |
public ResynchronizationView() { setId(ID); add(createButton("Desync and add", ADD_BUTTON, e -> { final Span added = new Span("added"); added.addClassName(ADDED_CLASS); add(added); triggerResync(); })); add(createButton("Desync and call function", CALL_BUTTON, e -> { // add a span to <body> for the test (not to view, since the DOM // will be rebuilt on resync) final String js = String.format( "document.getElementById(\"%s\").$server.clientCallable()" + ".then(_ => {})" + ".catch(_ => { document.body.innerHTML += '<span class=\"%s\">rejected</span>';});", ID, REJECTED_CLASS); getUI().get().getPage().executeJs(js); })); }
Example #3
Source File: CustomScrollCallbacksView.java From flow with Apache License 2.0 | 6 votes |
public CustomScrollCallbacksView() { viewName.setId("view"); log.setId("log"); log.getStyle().set("white-space", "pre"); UI.getCurrent().getPage().executeJs( "window.Vaadin.Flow.setScrollPosition = function(xAndY) { $0.textContent += JSON.stringify(xAndY) + '\\n' }", log); UI.getCurrent().getPage().executeJs( "window.Vaadin.Flow.getScrollPosition = function() { return [42, -window.pageYOffset] }"); RouterLink navigate = new RouterLink("Navigate", CustomScrollCallbacksView.class, "navigated"); navigate.setId("navigate"); Anchor back = new Anchor("javascript:history.go(-1)", "Back"); back.setId("back"); add(viewName, log, new Span("Scroll down to see navigation actions"), ScrollView.createSpacerDiv(2000), navigate, back); }
Example #4
Source File: MissingDependenciesView.java From flow with Apache License 2.0 | 6 votes |
public MissingDependenciesView() { try { Component unreferenced = (Component) Class .forName( "com.vaadin.flow.mixedtest.ui.MissingDependenciesView$Unreferenced") .newInstance(); // Uncomment to test behavior when the component is referenced // new Unreferenced(); add(unreferenced); } catch (Exception e) { e.printStackTrace(); add(new Span("Could not create unreferenced component instance: " + e.getMessage())); } }
Example #5
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #6
Source File: RemoveAddVisibilityView.java From flow with Apache License 2.0 | 5 votes |
public RemoveAddVisibilityView() { Span hidden = new Span("Initially hidden"); hidden.setVisible(false); NativeButton toggle = new NativeButton("Make Element visible", event -> { remove(hidden); add(hidden); hidden.setVisible(true); }); toggle.setId("make-visible"); add(toggle, hidden); }
Example #7
Source File: LongPollingPushView.java From flow with Apache License 2.0 | 5 votes |
public LongPollingPushView() { Div parent = new Div(); Span child = new Span("Some text"); child.setId("child"); parent.add(child); add(parent); parent.setVisible(false); add(createButton("Toggle visibility", "visibility", e -> parent.setVisible(!parent.isVisible()))); }
Example #8
Source File: DnDCustomComponentView.java From flow with Apache License 2.0 | 5 votes |
public DnDCustomComponentView() { Stream.of(EffectAllowed.values()).map(DraggableItem::new) .forEach(this::add); dropTarget = new Div(); dropTarget.add(new Text("Drop Here")); dropTarget.setWidth("200px"); dropTarget.setHeight("200px"); dropTarget.getStyle().set("border", "solid 1px pink"); add(dropTarget); DropTarget.create(dropTarget).addDropListener(event -> event.getSource() .add(new Span(event.getDragData().get().toString()))); }
Example #9
Source File: AttachListenerView.java From flow with Apache License 2.0 | 5 votes |
private void configureAttachPermutation(Span host, Span child, Span listener) { listener.addAttachListener(event -> { /* * The isInitialAttach check is needed to prevent stackoverflow * errors when the child listens to attach events from itself. */ if (event.isInitialAttach()) { host.add(child); } }); }
Example #10
Source File: AttachListenerView.java From flow with Apache License 2.0 | 5 votes |
private Span getListenerComponent(Span first, Span middle, Span last) { Span listener; if (isChecked("attachListenerToFirst")) { listener = first; } else if (isChecked("attachListenerToMiddle")) { listener = middle; } else { listener = last; } return listener; }
Example #11
Source File: AttachListenerView.java From flow with Apache License 2.0 | 5 votes |
private Span getChildComponent(Span first, Span middle, Span last) { Span child; if (isChecked("firstAsChild")) { child = first; } else if (isChecked("middleAsChild")) { child = middle; } else { child = last; } return child; }
Example #12
Source File: AttachListenerView.java From flow with Apache License 2.0 | 5 votes |
private Span getHostComponent(Span first, Span middle, Span last) { Span host; if (isChecked("firstAsHost")) { host = first; } else if (isChecked("middleAsHost")) { host = middle; } else { host = last; } return host; }
Example #13
Source File: ExportedJSFunctionView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onShow() { Div version = new Div(); version.setId("version"); add(version); String client = "window.Vaadin.Flow.clients[Object.keys(Vaadin.Flow.clients).filter(k => k !== 'TypeScript')]"; String versionJs = "var msg = '';" + "var versionInfoMethod = " + client + ".getVersionInfo;" + "if (versionInfoMethod) {" + " msg += 'version: '+versionInfoMethod().flow;" + "} else {" // + " msg += 'versionInfoMethod not published';" // + "}" // + "$0.innerHTML = msg;"; getPage().executeJs(versionJs, version); Div productionMode = new Div(); productionMode.setId("productionMode"); add(productionMode); String productionModeJs = "var productionMode = " + client + ".productionMode;" + "$0.innerText = 'Production mode: '+productionMode;"; getPage().executeJs(productionModeJs, productionMode); Div div = new Div(); div.setId("poll"); div.setText("Click to poll using JS API"); getPage().executeJs("$0.addEventListener('click', function() {" + client + ".poll();" // + "});", div); add(div); Span pollCounter = new Span("No polls"); pollCounter.setId("pollCounter"); add(pollCounter); UI.getCurrent().addPollListener(e -> { pollCount++; pollCounter.setText("Poll called " + pollCount + " times"); }); }
Example #14
Source File: AppLayoutBuilder.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
/** * Sets a title {@link Component} in the app-bar of the {@link AppLayout} * * @param title title as string */ public void setTitle(String title) { Span span = new Span(title); span.setWidth("100%"); span.getStyle() .set("margin-left", "var(--app-layout-menu-toggle-button-padding)") .set("white-space", "nowrap") .set("overflow", "hidden") .set("text-overflow", "ellipsis"); setTitleComponent(span); }
Example #15
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #16
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #17
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #18
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #19
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #20
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #21
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #22
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #23
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #24
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #25
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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; }
Example #26
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
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 #27
Source File: MenuTemplate.java From radman with MIT License | 5 votes |
private void addCategoryName(String name) { Element li = ElementFactory.createListItem(); Element span = new Span(name).getElement(); span.getClassList().add("category"); li.appendChild(span); linksContainer.appendChild(li); }
Example #28
Source File: InitialExtendedClientDetailsView.java From flow with Apache License 2.0 | 4 votes |
private void addSpan(String name, Object value) { Span span = new Span(value.toString()); span.setId(name); add(span); }
Example #29
Source File: VerifyBrowserVersionView.java From flow with Apache License 2.0 | 4 votes |
public VerifyBrowserVersionView() { WebBrowser browser = VaadinSession.getCurrent().getBrowser(); Span userAgent = new Span(browser.getBrowserApplication()); userAgent.setId("userAgent"); add(userAgent); }
Example #30
Source File: IFrameView.java From flow with Apache License 2.0 | 4 votes |
public IFrameContentView() { Span span = new Span(content); span.setId("Friday"); add(span); }