// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) space 
// Source File Name:   StaticTreeNode.java

package lt.monarch.swing.tree;

import java.util.Enumeration;
import java.util.Vector;
import javax.swing.tree.TreeNode;

public abstract class StaticTreeNode
    implements TreeNode
{

    protected abstract Vector loadSubtree();

    public Vector nodes()
    {
        return nodes;
    }

    private void validateSubtree()
    {
        if (getAllowsChildren() && nodes == null)
            nodes = loadSubtree();
    }

    public TreeNode getChildAt(int i)
    {
        validateSubtree();
        return (TreeNode)nodes.elementAt(i);
    }

    public int getChildCount()
    {
        validateSubtree();
        return nodes.size();
    }

    public int getIndex(TreeNode treenode)
    {
        return nodes.indexOf(treenode);
    }

    public Enumeration children()
    {
        validateSubtree();
        return nodes.elements();
    }

    public boolean isLeaf()
    {
        validateSubtree();
        return nodes.size() == 0;
    }

    public TreeNode getParent()
    {
        return parent;
    }

    public boolean getAllowsChildren()
    {
        return true;
    }

    public StaticTreeNode(TreeNode treenode)
    {
        parent = treenode;
    }

    private TreeNode parent;
    private Vector nodes;
}
