You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Todd Patrick <To...@dtn.com> on 2006/06/28 00:16:51 UTC

A note about the Tree2 Lazy Loading -- number of children not known blog...by Andrew Robinson

Andrew: First of all, thank you - this is greatly appreciated.
 
I only have one question at this point, the line:
 
return <Your business code class here>.loadChildren(this);
 
Means what?
 
Do you have an example of the inner class that could be used?
 
Thanks,
 
--Todd
 
 
 
public class ContentMgmtFolderNode
extends BaseTreeNode
{
ContentMgmtFolderNode(TreeModel model, BaseTreeNode parent, String name)
{
super(model, parent, "folder", name, name, false);
}

/**
* @see com.outlooksoft.cpm.faces.model.BaseTreeNode#loadChildren()
*/
@Override
protected List<BaseTreeNode> loadChildren()
{
return <Your business code class here>.loadChildren(this);
}
}

Re: A note about the Tree2 Lazy Loading -- number of children not known blog...by Andrew Robinson

Posted by Andrew Robinson <an...@gmail.com>.
public class BeanClass
{
  private TreeModel treeModel;

  public List<BaseTreeNode> loadChildren(FolderNode parent)
  {
    List<BaseTreeNode> children = new ArrayList<BaseTreeNode>();
    List<String> folders = ; // load from web service
    for (String folder : folders)
      children.add(new FolderNode(treeModel, parent, folder));
    List<String> files = ; // load from web service
    for (String file : files)
      children.add(new FileNode(treeModel, parent, file));
    return children;
  }

  public class FolderNode
    extends TreeNodeBase
  {
    ...
    protected List<BaseTreeNode> loadChildren()
    {
      return loadChildren(this);
    }
  }
}

On 6/27/06, Todd Patrick <To...@dtn.com> wrote:
>
>
> Andrew: First of all, thank you - this is greatly appreciated.
>
> I only have one question at this point, the line:
>
> return <Your business code class here>.loadChildren(this);
>
> Means what?
>
> Do you have an example of the inner class that could be used?
>
> Thanks,
>
> --Todd
>
>
>
> public class ContentMgmtFolderNode
> extends BaseTreeNode
> {
> ContentMgmtFolderNode(TreeModel model, BaseTreeNode parent, String name)
> {
> super(model, parent, "folder", name, name, false);
> }
>
> /**
> * @see
> com.outlooksoft.cpm.faces.model.BaseTreeNode#loadChildren()
> */
> @Override
> protected List<BaseTreeNode> loadChildren()
> {
> return <Your business code class here>.loadChildren(this);
> }
> }