Re: Problem updating image URL

2008-12-08 Thread jchimene

Hi,

I've had mixed success using seturl; in fact I don't think it works at
all w/ IE6.

Instead, I deleted the existing DOM node and recreated it with a new
image. I first noticed this in a simple Fisheye widget. The basic
structure is ulliimgspan/li/ul. To replace the img on a
mouseover  mouseout, I wound up deleting the img and span tags,
loading the new image, and re-attaching the img and span tags to
the parent li tag. The ul is an extension of Widget class, and the
li is an extension of the UIObject class.

I do notice that you're using setHTML. Have you tried setting the
src attribute of the image via DOM.setElementAttribute
(element,attribute,value), or the shorthand call DOM.setImgSrc?

On Dec 4, 8:46 am, David Hoffer [EMAIL PROTECTED] wrote:
 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);

This may or may not force a change to the image URL. Try
DOM.setElementAttribute() or DOM.setImgSrc().

     }

 Why doesn't this work?  

I can't say for sure. You may have to try another route to swap such
dynamic images.

 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

Re: Problem updating image URL

2008-12-04 Thread jchimene

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
-~--~~~~--~~--~--~---



Re: Problem updating image URL

2008-12-04 Thread David Hoffer

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
-~--~~~~--~~--~--~---



Re: Problem updating image URL

2008-12-03 Thread David Hoffer

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
-~--~~~~--~~--~--~---



Problem updating image URL

2008-12-02 Thread dhoffer

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
-~--~~~~--~~--~--~---



Re: Problem updating image URL

2008-12-02 Thread mon3y

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
-~--~~~~--~~--~--~---