Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Icon rendering in Label
I have following problem. Label icon is not displayed when component is added into more complex component tree.
I know - it seems weird, however, for test I`ve created two identical labels with icons.
The first one has been added direct onto VerticalLayout, that is Window content. The second is child component in complex tree:
VerticalLayout --> AbsoluteLayout --> VerticalLayout --> Label
And in this case problem is that Icon is not rendered. I mean that there is no <img> in v-caption tag for that label.
This is HTML that is generated for working first label:
<div class="v-widget v-has-caption v-caption-on-top v-has-width" style="width: 100%;"> <div class="v-caption" id="gwt-uid-4" for="gwt-uid-5"> <img alt="" class="v-icon" src="<correct_application_address>/APP/connector/0/2/icon/126.jpg"> </div> <div class="v-label v-widget v-has-width" id="gwt-uid-5" aria-labelledby="gwt-uid-4" style="width: 100%;">TEST</div></div>
And this is in case of not working label icon:
<div class="v-panel v-widget v-has-width" style="overflow: hidden; width: 100%; padding-top: 0px; padding-bottom: 0px;"> <div class="v-panel-captionwrap" style="margin-top: 0px;"> <div class="v-panel-nocaption"><span></span></div> </div> <div class="v-panel-content v-scrollable" tabindex="-1" style="position: relative;"> <div class="v-label v-widget LabelVarrOut_94 v-label-LabelVarrOut_94 v-has-width v-has-height" style="height: 94px; width: 196px;">Test</div> </div> </div>
As we can see Vaadin includes v-panel-nocaption DIV insted of correct v-caption.
Both labes are result of same very simple Java code:
FileResource fileResource = new FileResource(new File("C:\\images\\126.jpg")); Label label = new Label(); label.setIcon(fileResource);
I am using Vaadin 7.1.2.
I would appreciate any help.
is it still broken in Vaadin 7.5.8 ?
It would be nice if you could use your code that reproduces the problem, and if it is still there in 7.5.8
please report this bug in our Trac at https://dev.vaadin.com/ .
Your help is much appreciated!
Thank you for your response Enver,
in fact problem has desappeared after upgrading project to Vaadin 7.5.8.
I am not sure what was wrong, but as now all is ok, I don`t suppose problem is worth investigating.
We can close ticket.