Package syn3d.ui

Source Code of syn3d.ui.SceneGraphTreeRenderer

/* ========================
* 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:
*         Astrium SAS
*     Individual:
*         Claude Cazenave
*
* $Id: SceneGraphTreeRenderer.java,v 1.2 2004/03/19 16:37:12 brodu Exp $
*
* Changes
* -------
* 24-Dec-2003 : Creation date (CC);
*
*/
package syn3d.ui;

import java.awt.Color;
import java.awt.Component;

import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;

import syn3d.base.ActiveNode;

/**
* Class description ...
*
* @author Claude CAZENAVE
*
*/
public class SceneGraphTreeRenderer extends DefaultTreeCellRenderer {

  protected Object currentValue;
 
  public Icon getSceneGraphIcon(){
      if (currentValue instanceof ActiveNode) return ((ActiveNode)currentValue).getIcon();
    return null;
  }
 
  public Icon getLeafIcon(){
    Icon i=getSceneGraphIcon();
    if(i==null){
      return super.getLeafIcon();
    }
    else{
      return i;
    }
  }
 
  public Icon getOpenIcon(){
    Icon i=getSceneGraphIcon();
    if(i==null){
      return super.getOpenIcon();
    }
    else{
      return i;
    }
  }
 
  public Icon getClosedIcon(){
    Icon i=getSceneGraphIcon();
    if(i==null){
      return super.getClosedIcon();
    }
    else{
      return i;
    }
  }
 
  public Color getTextSelectionColor(){
    // TODO: change color for dynamic objects? property of ActiveNode?
    return super.getTextSelectionColor();
  }
 
  public Color getTextNonSelectionColor(){
    // TODO: change color for dynamic objects? property of ActiveNode?
    return super.getTextNonSelectionColor();
  }
 
  /* (non-Javadoc)
   * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean)
   */
  public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    currentValue=value;
    return super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
  }

}
TOP

Related Classes of syn3d.ui.SceneGraphTreeRenderer

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.