Here is a summary of the solution in case it helps anyone. Because I had
chosen to implement the image code within a second pseudo-widget (...extends
Composite) that shared my UiBinder template with the main pseudo-widget
that implements most of my app's UI, I got into trouble. I neglected to add
this second pseudo-widget to the RootPanel as is normally done in the class
that implements EntryPoint. This left my Image widget unattached to the
widget chain, because its parent, the second pseudo-widget, was unattached.
And an Image widget must be attached to work.
What I ended up doing is moving the Image code back into my main app/GUI
class, i.e., into the first and now only pseudo-widget and abandoning the
special class for the Image code. I did that because it's simpler and the
Image code turns out not to be as long as I had originally thought -- not
deserving a separate class and .java file.
I still don't understand the purpose of the widget attachment chain/tree.
It seems not related to the DOM element/layout tree, as non-widget DOM
elements are not part the chain. Why, for instance, must an Image be
attached in order for it to be loaded with content?
On Tuesday, April 30, 2013 3:02:03 AM UTC-7, brec wrote:
>
> UiBinder template extract:
>
>> <div ui:field='myView' style='position:absolute; top:0; bot:0;
>> left:0; right:0;' class='{style.hidden}'>
>> <g:Image ui:field="myImage"/>
>> <g:Button ui:field='closeButton'
>> addStyleNames='{style.close-button}'>
>> <ui:text from='{strings.close}'/>
>> </g:Button>
>> </div>
>>
>
> The div's container is the HTMLPanel at the root of the template.
>
> @UiField Image myImage;
>> ...
>> myImage.setUrlAndVisibleRect(url, 0, 0, width, height);
>>
>
> By debugger inspection I see that at the point at which setUrl... is to be
> called, the Image has attached: false. What am I overlooking? (This is my
> first use of gwt-Image.)
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.