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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---