Load feedback for ASync tree

Load feedback for ASync tree

I've got a Tree and I'm using a TreeLoader to load nodes asynchronously. The backend data takes a few seconds to generate, so I need to show some feedback to show that the child nodes are loading. In GXT 2.x there was a spinner icon to indicate this, however this doesn't seem to be supported in GXT 3.

method createStyle in IconHelper

method createStyle in IconHelper

The method createStyle in IconHelper has been removed in GXT 3, I am still trying to find a way to set an icon from a css style and not from a resource bundle.
If you find a way, please post your solution.

That's one way to solve this, but as with almost any problem there are several correct answers. They probably all follow the basic structure you used: monitor the beginning and the end of the RPC call, and use that notification to display a loading image over the screen. This is the main way to think through a problem like this, though perhaps I can suggest a slightly different way to do each of these two tasks.

To monitor the beginning and end of the loading process, consider listening to the events issues from the Loader (probably TreeLoader in your case): Listen for BeforeLoadEvent to add the notification, and LoadEvent/LoadExceptionEvent to hide it.

Another way to indicate that loading is occurring would be to use the mask(String) method, available on all components. You could call tree.mask("Loading...") to display the initial notification, and tree.unmask() to dismiss it. This can give you consistent loading notifications on each widget, though not for the entire page (that can be done with Mask.mask(Document.get().getBody().cast(), "Loading"), for example), which may or may not be what you are after. The visual appearance of the mask can be changed by implementing the MaskAppearance interface, and building a rebind rule to ask the app to always use that new mask instead.

There's nothing wrong with your approach, just wanted to spell our that your strategy makes sense, and how else the same strategy might be followed.