You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ps...@apache.org on 2004/05/19 08:11:03 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j/chainsaw/vfs FileSystemTreePanel.java

psmith      2004/05/18 23:11:03

  Modified:    src/java/org/apache/log4j/chainsaw/vfs
                        FileSystemTreePanel.java
  Log:
  changed the way the tree is rendered, but it will change more over time.
  
  addFileObject now returns the newly created node.
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.3       +26 -7     logging-log4j/src/java/org/apache/log4j/chainsaw/vfs/FileSystemTreePanel.java
  
  Index: FileSystemTreePanel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/vfs/FileSystemTreePanel.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileSystemTreePanel.java	19 May 2004 00:11:08 -0000	1.2
  +++ FileSystemTreePanel.java	19 May 2004 06:11:03 -0000	1.3
  @@ -36,17 +36,27 @@
   	 * 
   	 */
   	private void initGUI() {
  -		tree.setModel(treeModel);
  -        tree.expandPath(new TreePath(rootNode.getPath()));
  -        
  -		tree.setRootVisible(false);
   		setLayout(new BorderLayout());
   		setPreferredSize(new Dimension(150,400));
   		add(new JScrollPane(tree), BorderLayout.CENTER);
  +
  +        tree.setModel(treeModel);
  +        tree.expandPath(new TreePath(rootNode.getPath()));
  +        
  +		tree.setRootVisible(false);
  +        tree.putClientProperty("JTree.lineStyle", "Angled");
  +        tree.setShowsRootHandles(true);
  +        
   		
  -        // We make the Leaf Icons a nice Server-style icon to represent the repository.
  +        // TODO need a custom Cell renderer so that the root VFSNodes ALWAYS have the appropriate icons, and
  +        // child folders don't get them, but get the normal folder style icon, but for now
  +        // we make it easy on ourselves
  +        
  +        // We make the non-Leaf Icons a nice Server-style icon to represent the repository.
           DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer();
  -        renderer.setLeafIcon(ChainsawIcons.ICON_SERVER);
  +        renderer.setClosedIcon(ChainsawIcons.ICON_SERVER);
  +        renderer.setOpenIcon(ChainsawIcons.ICON_SERVER);
  +        renderer.setLeafIcon(null);
           
   		setToolTipText(TOOLTIP);
   		tree.setToolTipText(TOOLTIP);
  @@ -57,7 +67,7 @@
        * Tree gets updated.
   	 * @param fileObject
   	 */
  -	public void addFileObject(String name, FileObject fileObject) {
  +	public DefaultMutableTreeNode addFileObject(String name, FileObject fileObject) {
   		VFSNode vfsNode = new VFSNode(name, fileObject);
   		final DefaultMutableTreeNode node = new DefaultMutableTreeNode(vfsNode);
   		SwingUtilities.invokeLater(new Runnable() {
  @@ -66,6 +76,15 @@
   				rootNode.add(node);
                   tree.makeVisible(new TreePath(node.getPath()));
   			}});
  +        
  +        return node;
  +	}
  +
  +	/**
  +	 * @return
  +	 */
  +	JTree getTree() {
  +		return this.tree;
   	}
   	
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org