Thanks a ton Bryan!  That did it.

Bryan Dickey wrote:

The type attribute just refers to the class implementing IconProvider. In your case, it would be something like "package.MainController".

-Bryan



[EMAIL PROTECTED] 03/18/05 09:38PM >>>


Is that actually the syntax I am supposed to have in my jsp? I am not sure I understand what is supposed to go into the type="" attribute. Is

it not using EL? I can't seem to find any documentation on it in the JavaDocs or in the archives.

<x:iconProvider type="backing.TreeBean"/>



public class MainController implements IconProvider {
   private DefaultTreeModel treeModel;

public MainController() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new TreeItem(1, "XY", "9001", "XY 9001"));
DefaultMutableTreeNode a = new DefaultMutableTreeNode(new TreeItem(2, "A", "9001", "A 9001"));
root.insert(a);
DefaultMutableTreeNode b = new DefaultMutableTreeNode(new TreeItem(3, "B", "9001", "B 9001"));
root.insert(b);
DefaultMutableTreeNode c = new DefaultMutableTreeNode(new TreeItem(4, "C", "9001", "C 9001"));
root.insert(c);


DefaultMutableTreeNode node = new DefaultMutableTreeNode(new TreeItem(5, "a1", "9002", "a1 9002"));
a.insert(node);
node = new DefaultMutableTreeNode(new TreeItem(6, "a2", "9002",


"a2 9002"));
       a.insert(node);
       node = new DefaultMutableTreeNode(new TreeItem(7, "a3", "9002",

"a3 9002"));
       a.insert(node);
       node = new DefaultMutableTreeNode(new TreeItem(8, "b", "9002",

"b 9002"));
       b.insert(node);

       a = node;
       node = new DefaultMutableTreeNode(new TreeItem(9, "x1", "9003",

"x1 9003"));
       a.insert(node);
       node = new DefaultMutableTreeNode(new TreeItem(9, "x2", "9003",

"x2 9003"));
a.insert(node);
this.treeModel = new DefaultTreeModel(root);
}
public String getIconUrl(Object arg0, int arg1, boolean arg2) {
return "/images/tree/node.gif";
}
public DefaultTreeModel getTreeModel() {
return treeModel;
}


   public void setTreeModel(DefaultTreeModel treeModel) {
       this.treeModel = treeModel;
   }

}

Bryan Dickey wrote:



This should work (for the old tree table comp, which may be replaced
soon - see archived "tree2" messages):

*In JSP:
<x:tree ...>
....
<x:iconProvider type="backing.TreeBean"/>
</x:tree>


*In backing bean:

import org.apache.myfaces.custom.tree.IconProvider;

public class TreeBean implements IconProvider {
....
//interface IconProvider (path to node icon)
public String getIconUrl(Object arg0, int arg1, boolean arg2) {
return "images/tree/node.gif";
}
}

-Bryan



[EMAIL PROTECTED] 03/16/05 10:29PM >>>


Version: 1.0.8

I am making use of the <x:tree> component but am having trouble


getting


the folder.gif icon to show up in my app, though it shows up fine in
myfaces-examples. I am not seeing where I can specify a particular
image for this. The rest of the icon's show up just fine. Another
fella has this same problem in the forums, but nobody has replied to
him
yet.

Thoughts? Thanks in advance,
Aaron Bartell

Here is my code:
<x:tree id="tree"
value="#{MainCtl.treeModel}"
var="treeItem"
styleClass="tree"
nodeClass="treenode"
headerClass="treeHeader"
footerClass="treeFooter"
rowClasses="a, b"
columnClasses="col1, col2"
selectedNodeClass="treenodeSelected"
expandRoot="true"
iconChildFirst="/images/tree/line_first.gif"\
iconChildMiddle="/images/tree/line_middle.gif"
iconChildLast="/images/tree/line_last.gif"

iconLine="/images/tree/line.gif"
iconNoline="/images/tree/noline.gif"

iconNodeClose="/images/tree/node_close.gif"

iconNodeCloseFirst="/images/tree/node_close_first.gif"
iconNodeCloseLast="/images/tree/node_close_last.gif"

iconNodeCloseMiddle="/images/tree/node_close_middle.gif"

iconNodeOpen="/images/tree/node_open.gif"

iconNodeOpenFirst="/images/tree/node_open_first.gif"
iconNodeOpenLast="/images/tree/node_open_last.gif"
iconNodeOpenMiddle="/images/tree/node_open_middle.gif"


<h:column>
<f:facet name="header">
<h:outputText value="Header 1" />
</f:facet>
<h:outputText value="#{treeItem.isoCode}" />
</h:column>
<x:treeColumn>
<f:facet name="header">
<h:outputText value="Header 2" />
</f:facet>
<h:outputText value="#{treeItem.name}" />
</x:treeColumn>
<h:column>
<f:facet name="header">
<h:outputText value="Header 3" />
</f:facet>
<h:outputText value="#{treeItem.description}" />
</h:column>
<f:facet name="footer">
<h:outputText value="Footer" />
</f:facet>
</x:tree>






Reply via email to