Package syn3d.nodes

Source Code of syn3d.nodes.TransformGroupNode

/* ========================
* 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-2004, by :
*     Corporate:
*         EADS Corporate Research Center
*     Individual:
*         Nicolas Brodu
*
* $Id: TransformGroupNode.java,v 1.12 2005/11/02 18:03:08 ogor Exp $
*
* Changes
* -------
* 19-Mar-2004 : Creation date (NB);
*
*/
package syn3d.nodes;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.swing.Icon;
import javax.swing.JDialog;

import syn3d.base.ActiveNode;
import syn3d.data.TransformData;
import syn3d.ui.TransformDataUI;

/**
*
*/
public class TransformGroupNode extends GroupNode implements DirtyNode , Serializable{

    protected static int anonymousNodeNumber = 0;
    protected TransformData data;
    protected transient SceneNode universe;

    static final long serialVersionUID = 4172794600187934111L;
   
    public TransformGroupNode(ActiveNode parent) {
        super(parent);
        anonymousNodeNumber++;
        name = NodeResourcesManager.getNodeName("TransformGroup") + ((anonymousNodeNumber == 1) ? "" : String.valueOf(anonymousNodeNumber));
        // subclasses shall instanciate data, then call initData();
    }
   
    protected void initData() {
        // Add the universe this node belongs to as the unique end notification listener
        // See notes in the UniverseNode class
        universe = SceneNode.getScene(parent);
        data.setDelegateListener(universe);
    }
   


    /* (non-Javadoc)
     * @see syn3d.builtin.DirtyNode#cleanup()
     */
    public void cleanup() {
        data.updateTransform();
    }

    // Subclasses API
    public void setDirty() {
      // ref count takes care of duplicate calls
      if (universe!=null)
        universe.addDirtyNode(this);
    }
   
    protected static List actions = new ArrayList();
    static {
        actions.addAll(Arrays.asList(new String[] {
                NodeResourcesManager.resources.getString("Properties"),
        }));
    }
    public List getActions() {
        return actions;
    }

    public void doAction(Object action) {
        if (action==null) return;
        if (action.equals(NodeResourcesManager.resources.getString("Properties"))) {
            TransformDataUI dui = new TransformDataUI(this,data, true);
            JDialog dialog = dui.createDialog(null, NodeResourcesManager.resources.getString("Properties"));
          
            dialog.show();
          
         
        }
    }

   
    public void remove() {
      super.remove();
      data.removeSceneGraphData();
    }
   
    protected static Icon icon = NodeResourcesManager.resources.getIcon("transformIcon");
    public Icon getIcon() {
        return icon;
    }

    public void restoreReferences(ActiveNode parent) {
        super.restoreReferences(parent);
        initData();
    }

    public boolean saveChildren() {
        // TODO Auto-generated method stub
        return super.saveChildren();
    }
   
}
TOP

Related Classes of syn3d.nodes.TransformGroupNode

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.