Package jsynoptic.plugins.java3d.tree

Source Code of jsynoptic.plugins.java3d.tree.BranchGroupNode

/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info:  http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2007, by :
*     Corporate:
*         EADS Astrium
*     Individual:
*         Claude Cazenave
*
* $Id: BranchGroupNode.java,v 1.3 2008/01/21 18:23:27 cazenave Exp $
*
* Changes
* -------
* 11 janv. 08  : Initial public release
*
*/
package jsynoptic.plugins.java3d.tree;

import javax.media.j3d.BranchGroup;
import javax.swing.tree.TreeNode;

import jsynoptic.plugins.java3d.Universe;

/**
* Hold a BranchGroup
*/
public class BranchGroupNode extends GroupNode {
    static void loadResources(){
        addResources("javax.media.j3d.BranchGroup", "BranchGroup");
       
        // TODO add compile action !
    }
   
    // required for dynamic node creation
    public BranchGroupNode(Tree tree, Object graphObject, boolean getChildren) {
        super(tree, graphObject, getChildren);
    }
   
   
    BranchGroup getRootGroup(){
        TreeNode n=this;
        while(n!=null){
            if((n instanceof BranchGroupNode)&&(n.getParent() instanceof UniverseNode)){
                return (BranchGroup)((BranchGroupNode)n).getGraphObject();
            }
            n=n.getParent();
        }
        return null;
    }
   
    Universe getUniverse(){
        TreeNode n=getParent();
        while(n!=null){
            if(n instanceof UniverseNode){
                return (Universe)((AbstractNode)n).getGraphObject();
            }
            n=n.getParent();
        }
        return null;
    }
}
TOP

Related Classes of jsynoptic.plugins.java3d.tree.BranchGroupNode

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.