PDA

View Full Version : Own Tree Icons cause slow rendering?



msauter
15 Oct 2009, 12:27 AM
I am using the Fast-Tree example but i want to use own icons for the Items, so i use the IconHelper.createStyle to add them.



tree.setIconProvider(new ModelIconProvider<MyModelData>() {

public AbstractImagePrototype getIcon(MyModelData model) {
if (model.get("icon") != null) {
// get Stylesheet-class from Model as String and load it
return IconHelper.createStyle((String) model.get("icon"));
} else {
return null;
}
}

});


This works perfectly. But when i have 300 Entrys in the Tree and i want to scroll down in the IE8, the performance is very bad (it is unusable).

When i set all Items.setChildren(true) only to see if it works better when showing the GXT-open-folder-icon, it runs perfectly in IE8.

Are there any magic hints to add Icons? I am loading them from the Stylesheet like this:



.icon_user {
background-image: url(my_resources/images/user.png);
}

sven
15 Oct 2009, 3:12 AM
Each node is parsing the CSS again. This is slow. We can probably implement some cache here inside the IconHelper.

msauter
15 Oct 2009, 4:31 AM
Is there a solution to show icons without CSS/IconHelper ?

sven
15 Oct 2009, 4:35 AM
You can directly return the abstractimageprototype, for exampel from an imagebundle.

sven
15 Oct 2009, 4:40 AM
I just commited the cache for this to SVN. Parsing is now only done once per stylename

msauter
15 Oct 2009, 10:27 PM
You can directly return the abstractimageprototype, for exampel from an imagebundle.
I will try it, thanks for your help! :)