Infinite loop at updateFromUIDL

Hi folks,

I’m trying to create a new Itmill widget extending the existing GWT Panel.

I copied the ColorPicker example and the IGridLayout code to create my own container for other widgets, but can’t get it right…

The application hangs in infinite loop at the first lines of updateFromUIDL function. The code is:

public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
		if (client.updateComponent(this, uidl, false)) {
			return;
		}
//...
}

I can’t get this to work like in the ColorPicker example or IGridLayout. What’s wrong here? What is this code supposed to do anyway?

The
updateComponent()
does a few things. One is updating default parameters for widgets, such as “invisible” or “disabled”. For example, if the component is invisible, the function returns with true and (because of the return; above) the component will not be displayed. One of the default parameters is the caption: if the third parameter is “true”, the containing layout will manage the caption, usually displaying it above the actual component. Some widgets, such as
IButton
, like to manage the caption itself; in
IButton
the caption is inside the widget.

The
updateComponent()
also checks that the current client-side widget is a correct counterpart (“implementation”) of a server-side component. A server-side component can be mapped to different client-side widgets depending on its parameters. For example,
OrderedLayout
is mapped to either
IHorizontalLayout
or
IVerticalLayout
depending on its orientation. If the orientation parameter changes, the
updateComponent()
can actually replace the client-side widget with the correct one.

So, if you have loop in the
updateComponent()
call, my first suspicion is that you have done something wrong in your widget set definition class that inherits the
DefaultWidgetSet
. That’s the place where your widgets are instantiated and a mistake might cause something weird when the
updateComponent()
uses
resolveWidgetTypeName(UIDL uidl)
to check the correct implementation. Check that it’s correct in every way, especially for the class names in strings, as they are not checked compile-time and you can easily make mistakes in them.

See
http://www.itmill.com/documentation/itmill-toolkit-5-reference-manual/ch08s04.html
.

The purpose of client.updateComponent(…) is to do common “maintenance” tasks related to widget rendering. These include:

  • Switching to another implementation in the client-peer (another widget) when needed
  • When requested managing component caption, icon, description and error messages
  • Disabling and hiding the widget
  • Ignoring component redraws if no changes are expected from server (component sub-tree caching)

There are documented here:

Heh, Marko you were faster - again :wink:

Hi!

It really was a misspelled class name in resolveWidgetTypeName function.

Thanks a lot for help!!!