Clover coverage report - baseCode - 0.2.5 Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT FRAMES NO FRAMES |
file stats: | LOC: | 81 |  | Methods: | 2
| NCLOC: | 44 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
TreePanel.java | 0% | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * Created on Jun 20, 2004
3 |  |
      */
4 |  |
     package baseCode.gui;
5 |  |
6 |  |
     import java.awt.Dimension;
7 |  |
8 |  |
     import javax.swing.JPanel;
9 |  |
     import javax.swing.JScrollPane;
10 |  |
     import javax.swing.JSplitPane;
11 |  |
     import javax.swing.JTextArea;
12 |  |
     import javax.swing.JTree;
13 |  |
     import javax.swing.event.TreeSelectionEvent;
14 |  |
     import javax.swing.event.TreeSelectionListener;
15 |  |
     import javax.swing.tree.DefaultMutableTreeNode;
16 |  |
     import javax.swing.tree.TreeSelectionModel;
17 |  |
18 |  |
     import baseCode.dataStructure.graph.DirectedGraphNode;
19 |  |
20 |  |
     /**
21 |  |
      * <p>
22 |  |
      * Copyright (c) Columbia University
23 |  |
      *
24 |  |
      * @author Paul Pavlidis
25 |  |
      * @version $Id: TreePanel.java,v 1.5 2004/07/27 03:18:58 pavlidis Exp $
26 |  |
      * @todo - this really doesn't do much.
27 |  |
      */
28 |  |
     public class TreePanel extends JPanel implements TreeSelectionListener {
29 |  |
30 |  |
        private JTree tree;
31 |  |
        private JTextArea detailPane;
32 |  |
33 | 0 |
        public TreePanel( JTree t ) {
34 | 0 |
           this.tree = t;
35 | 0 |
           tree.getSelectionModel().setSelectionMode(
36 |  |
                 TreeSelectionModel.SINGLE_TREE_SELECTION );
37 |  |
38 | 0 |
           tree.addTreeSelectionListener( this );
39 |  |
40 | 0 |
           JScrollPane treeView = new JScrollPane( tree );
41 |  |
           // Create the viewing pane that shows the contents of the node.
42 | 0 |
           detailPane = new JTextArea();
43 | 0 |
           detailPane.setEditable( false );
44 | 0 |
           detailPane.setLineWrap( true );
45 | 0 |
           detailPane.setWrapStyleWord( true );
46 |  |
47 | 0 |
           JScrollPane detailView = new JScrollPane( detailPane );
48 |  |
49 |  |
           //Add the scroll panes to a split pane.
50 | 0 |
           JSplitPane splitPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT );
51 | 0 |
           splitPane.setTopComponent( treeView );
52 | 0 |
           splitPane.setBottomComponent( detailPane );
53 | 0 |
           Dimension minimumSize = new Dimension( 200, 250 );
54 | 0 |
           detailView.setMinimumSize( minimumSize );
55 | 0 |
           treeView.setMinimumSize( minimumSize );
56 | 0 |
           splitPane.setDividerLocation( 100 );
57 | 0 |
           treeView.setPreferredSize( new Dimension( 500, 200 ) );
58 |  |
59 | 0 |
           splitPane.setPreferredSize( new Dimension( 500, 500 ) );
60 | 0 |
           add( splitPane );
61 |  |
        }
62 |  |
63 | 0 |
        public void valueChanged( TreeSelectionEvent e ) {
64 | 0 |
           DefaultMutableTreeNode node = ( DefaultMutableTreeNode ) tree
65 |  |
                 .getLastSelectedPathComponent();
66 |  |
67 | 0 |
           if ( node == null ) return;
68 |  |
69 | 0 |
           DirectedGraphNode nodeInfo = ( DirectedGraphNode ) node.getUserObject();
70 |  |
           //    if (node.isLeaf()) {
71 |  |
           //    System.out.println(nodeInfo); // debugging
72 |  |
73 | 0 |
           detailPane.setText( nodeInfo.toString() );
74 |  |
75 |  |
           //     }
76 |  |
77 |  |
           //   System.out.println(nodeInfo); // debugging
78 |  |
79 |  |
        }
80 |  |
81 |  |
     }