PDA

View Full Version : 2.0 M3: Tree icons disappear



polloelastico
16 Jun 2009, 7:40 PM
After upgrading from M2 to M3 and using TreePanel my tree icons (arrows, open/closed folder) are gone. Is it possible some images were not included in the release or is there something I need to add in code to use the default icons?

Thanks,

Padster
17 Jun 2009, 2:27 AM
I have also updated a project from M2 To M3 however the default folders were fine without modifcation. The leaf nodes however were not as the method
setLeafIconStyle has now it seems been replaced by setLeafIcon which means you have to use the
IconHelper.create("Css_style_name") to use css classes directly on the leaf nodes.

Otherwise you set up a interface of Imagebundle like the explorer example does


package com.extjs.gxt.samples.client.icons;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.ImageBundle;
public interface ExampleIcons extends ImageBundle {
@Resource("table.png")
AbstractImagePrototype table();

@Resource("music.png")
AbstractImagePrototype music();
}

polloelastico
17 Jun 2009, 8:08 AM
Shouldn't TreePanel be using the IconSupport interface?

sven
17 Jun 2009, 8:09 AM
No. That would say that the treepanel itself would have an icon, which is not the case.

polloelastico
17 Jun 2009, 9:07 AM
True, yet FormPanel, ContentPanel, CollapsePanel all implement that interface.

sven
17 Jun 2009, 9:15 AM
Yes, as all three you mentioned support an icon on the top left.

polloelastico
17 Jun 2009, 9:38 AM
Let me backup a bit, this is probably just a simple syntax question:

This was working with M2 and seemed to use the default icons


TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
tree.setIconProvider(new ModelIconProvider<ModelData>() {
public String getIcon(ModelData model) {
return null;
}
});


M3 changed the API and this satisfies the compiler but there are no icons.



TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
tree.setIconProvider(new ModelIconProvider<ModelData>() {
public AbstractImagePrototype getIcon(ModelData model) {
return null;
}
});


I assume something is wrong in code, could you maybe point me in the right direction?