on a CellTable. I'm trying to toggle the Image in an event that's
added as a MouseDownHandler on the Image itself. I got the
MouseDownHandler to run and the toggling logic is working (the
System.out.println is showing that the if statement is working
properly). The image displayed is not actually changing though and
neither is the tool tip title. When I run this the getUrl prints out
that the URL is correctly changing, but the displayed Image doesn't.
When I move this object off the CellTable and put it directly on the
page it works fine. I tried putting the if block in a
ScheduledCommand and that didn't make a difference. Does anybody know
why this might not be working when the image is placed on a
CellTable? Or have any ideas of things I can try?
final Image toggle = new Image(MainImageBundle.INSTANCE.collapse());
toggle.setTitle("Hide contents");
toggle.addMouseDownHandler(new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
final boolean visible = toggle.getTitle().equals("Hide contents");
if (visible) {
toggle.setResource(MainImageBundle.INSTANCE.expand());
toggle.addStyleName("pointer");
System.out.println("+ " + toggle.getUrl());
toggle.setTitle("Show contents");
} else {
toggle.setResource(MainImageBundle.INSTANCE.collapse());
toggle.addStyleName("pointer");
System.out.println("- " + toggle.getUrl());
toggle.setTitle("Hide contents");
}
}
});
toggle.addStyleName("pointer");
--
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 google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment