So far, I am running this in hosted mode only.  We are new to GWT and
are trying to learn how to get something working and are having some
trouble such as this issue.

Setting the image via URL seems to be problematic.  In summary this is
what I observe:

1. If I get a static image from ImageBundle it always works.
2. If I have a stand-alone Image control and call setURL with a valid
URL it will sometimes work.  Updates do not always get seen in the UI.
3. If the Image control is part of a larger panel and I need to render
the overall panel's HTML on a widget, using a valid URL never works.
That is, if I set an Image's URL then do something like the following,
the image is not displayed in the UI.

private HorizontalPanel theTreeItem = new HorizontalPanel();
private Image rightImage;

constructor()
{
theTreeItem.add(this.rightImage);
}

// Note I have also tried to just set the URL of the existing Image
instead of replacing it, neither is rendered in the UI.
public void setRightImageURL(Image rightImage)
    {
        this.rightImage = rightImage;
        setHTML();
    }

private void setHTML()
    {
        SimplePanel simplePanel = new SimplePanel();
        simplePanel.add(theTreeItem);
        String test = DOM.getInnerHTML(simplePanel.getElement());
        this.setHTML(test);
    }

Why doesn't this work?  In my case I have dynamic images so I cannot
always use ImageBundles as that only works for static images.

-Dave

On Thu, Dec 4, 2008 at 8:32 AM, jchimene <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Does this fail in a browser agnostic way?
>
> On Dec 3, 5:57 am, "David Hoffer" <[EMAIL PROTECTED]> wrote:
>> Why do you think final may be a problem?  I don't change the image
>> instance only set the URL on the already existing image.
>>
>> Does GWT not like final?
>>
>> -Dave
>>
>> On Tue, Dec 2, 2008 at 11:23 PM, mon3y <[EMAIL PROTECTED]> wrote:
>>
>> > Might it have something to do with the word "final" when declaring
>> > image?
>>
>> > On Dec 2, 9:23 pm, dhoffer <[EMAIL PROTECTED]> wrote:
>> >> I have a custom button that has a couple of images as well as text.
>> >> My code is like this:
>>
>> >> public class SplitButton extends Button
>> >> {
>> >>     private IGWTImageBundle gwtImageBundle;
>> >>     private final DockPanel dockPanel = new DockPanel();
>> >>     private MenuBar menuBar;
>> >>     private final Image image = new Image();
>> >>     private final Label textLabel = new Label();
>> >>     private PopupPanel popupPanel;
>>
>> >>     public SplitButton(IGWTImageBundle gwtImageBundle)
>> >>     {
>> >>         this(null, null, gwtImageBundle);
>> >>     }
>>
>> >>     public SplitButton(String imageURL, String text, IGWTImageBundle
>> >> gwtImageBundle)
>> >>     {
>> >>         super();
>>
>> >>         this.gwtImageBundle = gwtImageBundle;
>>
>> >>         if (imageURL != null)
>> >>         {
>> >>             setImage(imageURL);
>> >>         }
>> >>         if (text != null)
>> >>         {
>> >>             setText(text);
>> >>         }
>>
>> >>         initDockPanel();
>> >>     }
>>
>> >>     private void initDockPanel()
>> >>     {
>> >>         dockPanel.add(image, DockPanel.WEST);
>> >>         dockPanel.add(textLabel, DockPanel.CENTER);
>> >>         dockPanel.add(gwtImageBundle.smallDownArrowIcon().createImage
>> >> (), DockPanel.EAST);
>>
>> >>         setHTML();
>> >>     }
>>
>> >>     @Override
>> >>     public void setText(String text)
>> >>     {
>> >>         textLabel.setText(text);
>>
>> >>         setHTML();
>> >>     }
>>
>> >>     public void setImage(String imageURL)
>> >>     {
>> >>         image.setUrl(imageURL);
>>
>> >>         setHTML();
>> >>     }
>>
>> >>     private void setHTML()
>> >>     {
>> >>         SimplePanel sp = new SimplePanel();
>> >>         sp.add(dockPanel);
>> >>         String test = DOM.getInnerHTML(sp.getElement());
>> >>         this.setHTML(test);
>> >>     }
>>
>> >> }
>>
>> >> The problem is calls to setImage(String imageURL) do not get updated
>> >> in the UI.  That is, although the URL set is valid the image is not
>> >> shown in the button.  The static image is shown in the UI however.
>>
>> >> What am I doing wrong to set the image?
>>
>> >> -Dave
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to