lib/browser/GraphBrowser/TreeNode.java
changeset 11873 38dc46b55d7e
parent 9407 e8f6d918fde9
child 13973 9170772bf420
equal deleted inserted replaced
11872:4f24fd4dbcf5 11873:38dc46b55d7e
     1 /***************************************************************************
     1 /***************************************************************************
     2   Title:      GraphBrowser/TreeNode.java
     2   Title:      GraphBrowser/TreeNode.java
     3   ID:         $Id$
     3   ID:         $Id$
     4   Author:     Stefan Berghofer, TU Muenchen
     4   Author:     Stefan Berghofer, TU Muenchen
     5   Copyright   1997  TU Muenchen
     5   License:    GPL (GNU GENERAL PUBLIC LICENSE)
     6 
     6 
     7   This class contains methods for storing and manipulating directory
     7   This class contains methods for storing and manipulating directory
     8   trees (e.g. collapsing / uncollapsing directory branches).
     8   trees (e.g. collapsing / uncollapsing directory branches).
     9 ***************************************************************************/
     9 ***************************************************************************/
    10 
    10 
    31 	public Vector getCollapsed() { return collapsed; }
    31 	public Vector getCollapsed() { return collapsed; }
    32 }
    32 }
    33 
    33 
    34 public class TreeNode
    34 public class TreeNode
    35 {
    35 {
    36 	static Font f=new Font("Helvetica", Font.PLAIN, 14);
       
    37 	int starty,endy,number;
    36 	int starty,endy,number;
    38 	String name,path;
    37 	String name,path;
    39 
    38 
    40 	Vector leaves=new Vector(10,10);
    39 	Vector leaves=new Vector(10,10);
    41 	boolean unfold=false;
    40 	boolean unfold=false;
   138 		}
   137 		}
   139 	}
   138 	}
   140 
   139 
   141 	public Dimension draw(Graphics g,int x,int y,TreeNode t)
   140 	public Dimension draw(Graphics g,int x,int y,TreeNode t)
   142 	{
   141 	{
   143 		FontMetrics fm=g.getFontMetrics(f);
   142 		FontMetrics fm=g.getFontMetrics(g.getFont());
   144 		g.setFont(f);
       
   145 		int h=fm.getHeight();
   143 		int h=fm.getHeight();
   146 		int e=(int) (h / 10) + 1;
   144 		int e=(int) (h / 10) + 1;
   147 		int down_x[]={x + e, x + h - e, x + (int)(h / 2)};
   145 		int down_x[]={x + e, x + h - e, x + (int)(h / 2)};
   148 		int down_y[]={y + e, y + e, y + (int)(3 * h / 4) - e};
   146 		int down_y[]={y + e, y + e, y + (int)(3 * h / 4) - e};
   149 		int right_x[]={x + e, x + (int)(3 * h / 4) - e, x + e};
   147 		int right_x[]={x + e, x + (int)(3 * h / 4) - e, x + e};