Hi,
I am building a wrapper around a javascript gauge component.
All is going well, but, in order to stream line processing in my paintContent I only ‘paint’ things I know have changed (see code below).
I have done this so that when I increment the gauge needle, it does not redraw the whole gauge (which causes flicker if someone is repeatedly pushing an increase button for example).
The problem is that on a page refresh, or when the user comes back to the page, the component thinks nothing has changed, therefore my GWT wrapper does not get the wrapped javascript to repaint, meaning that on first look at the page it looks great, on refreshing the page, the gauge disappears.
My question is how can I tell that the page has been refreshed? Is there an event I can hook into for this? I could then change all my fields to ‘dirty’ which will mean that the javascript code will get run and refresh the gauge.
Note that if I remove the ‘Dirty’ fields, it does work, but the gauge flashes when changing the needle value as the whole gauge is redrawn rather than just the needle.
Thanks for any help… a bit new to all this.
Regards
Colin
@Override
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
// Paint any component specific content by setting attributes
// These attributes can be read in updateFromUIDL in the widget.
if ((gaugeWidth != null) && gaugeWidthDirty) {
target.addAttribute("gaugeWidth", gaugeWidth);
gaugeWidthDirty = false;
}
if ((gaugeHeight != null) && gaugeHeightDirty) {
target.addAttribute("gaugeHeight", gaugeHeight);
gaugeHeightDirty = false;
}
if ((labelFormatPattern != null) && labelFormatPatternDirty) {
target.addAttribute("labelFormatPattern", labelFormatPattern);
labelFormatPatternDirty = false;
}
if ((xml != null) && xmlDirty) {
target.addAttribute("xml", xml);
xmlDirty = false;
}
if (valueDirty) {
target.addAttribute("value", value);
valueDirty = false;
}
}