I shall be goofing at something, but I am unable to do a very simple thing: create chunk of HTML with a minimum text in it, something like “hello world” something that in V8 I made with a HTML formatted label and in with any other framework I make in a snap.
First of all notice the documentation fail: if I look at [Components in Vaadin 10]
(https://vaadin.com/docs/v10/flow/migration/5-components.html) I see that Label has been replaced by Text or Span, but there is no example link (like other components). So let’s take a look at [Components page]
(https://vaadin.com/components/browse) and again neither Text, not Span.
So let’s look at [javadoc for Text]
(https://vaadin.com/api/platform/10.0.4/com/vaadin/flow/component/Text.html), again no method to specify that the text is HTML instead of plain text. So after 20 minutes I’m still unable to insert a chunk of preformatted HTML.
After investing few extra minutes googling, I find [Dynamic Styling]
(https://vaadin.com/docs/v10/flow/element-api/tutorial-dynamic-styling.html). Finally I’m done! I type “text.getClassList()” and surprise again: no such method. I try text.getStyle(), some result.
Maybe those methods are applicable only to buttons. Let’s check, just cut and paste the code from the web page and … Same results! The methods no not exist. Maybe the page is dated strange for a version fresh as V10. At this point 40 minutes were gone and still not formatted label.
But I need the formatted label, let’s find another way. Let’s disassemble some code. Aha there is a Component.getElement() to which both getClassList() and getStyle() apply. So probably the getElement() in between, is missing from the guide. Finally the compiler stays quiet, I shall be done but NO! I get the following exception:
java.lang.UnsupportedOperationException: This instance is immutable
Now more than 1 hour is gone and I am still unable to write the dam formatted label.
So I invest 15 more minutes in writing this post hoping somebody will tell me how to do with an example that works.