Package clips.directory.editors.serviceGroup

Source Code of clips.directory.editors.serviceGroup.TreeModelDirectoryActions

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package clips.directory.editors.serviceGroup;

import clips.delegate.directory.complex.DirectoryDoctorAction;
import clips.delegate.directory.complex.DirectoryDoctorActionItem;
import cli_fmw.main.ClipsException;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;

/**
*
* @author vip
*/
public class TreeModelDirectoryActions extends DefaultTreeModel {
    DirectoryDoctorAction directory;
   
    public TreeModelDirectoryActions(DirectoryDoctorAction directory) {
        super(new DefaultMutableTreeNode(directory.getDirectoryTitle()));
        this.directory = directory;
    }

    @Override
    public int getChildCount(Object parent) {
       // try {
            if(parent instanceof DefaultMutableTreeNode) {
                return directory.getItems().size();
            } else {
                DirectoryDoctorActionItem item = (DirectoryDoctorActionItem) parent;
                return item.getItems().size();
            }
      /*  } catch (ClipsException ex) {
            ex.printStackTrace();
        }
        return 0;*/
    }

    @Override
    public Object getChild(Object parent, int index) {
       // try {
            if(parent instanceof DefaultMutableTreeNode) {
              return directory.getItems().get(index);
            } else {
                DirectoryDoctorActionItem item = (DirectoryDoctorActionItem) parent;
                return item.getItems().get(index);
            }
      /*  } catch (ClipsException ex) {
            ex.printStackTrace();
        }
        return null;*/
    }

    @Override
    public boolean isLeaf(Object node) {
        return getChildCount(node) == 0;
    }
   
}
TOP

Related Classes of clips.directory.editors.serviceGroup.TreeModelDirectoryActions

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.