Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |

file stats: | LOC: | 73 |  | Methods: | 4
| NCLOC: | 44 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL
EvaluationResultsPanel.java | 0% | 0% | 0% | 0% |

1 |  | package net.sourceforge.pmd.util.viewer.gui;
2 |  |
3 |  | import net.sourceforge.pmd.ast.SimpleNode;
4 |  | import net.sourceforge.pmd.util.viewer.model.ViewerModel;
5 |  | import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
6 |  | import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
7 |  |
8 |  | import javax.swing.*;
9 |  | import javax.swing.event.ListSelectionEvent;
10 |  | import javax.swing.event.ListSelectionListener;
11 |  | import java.awt.BorderLayout;
12 |  | import java.util.Vector;
13 |  |
14 |  | /**
15 |  | * A panel showing XPath expression evaluation results
16 |  | *
17 |  | * @author Boris Gruschko ( boris at gruschko.org )
18 |  | * @version $Id: EvaluationResultsPanel.java,v 1.11 2006/02/10 14:15:31 tomcopeland Exp $
19 |  | */
20 |  | public class EvaluationResultsPanel extends JPanel implements ViewerModelListener {
21 |  | private ViewerModel model;
22 |  | private JList list;
23 |  |
24 |  | /**
25 |  | * constructs the panel
26 |  | *
27 |  | * @param model model to refer to
28 |  | */
29 | 0 | public EvaluationResultsPanel(ViewerModel model) {
30 | 0 | super(new BorderLayout());
31 |  |
32 | 0 | this.model = model;
33 |  |
34 | 0 | init();
35 |  | }
36 |  |
37 | 0 | private void init() {
38 | 0 | model.addViewerModelListener(this);
39 |  |
40 | 0 | list = new JList();
41 | 0 | list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
42 |  |
43 | 0 | list.addListSelectionListener(new ListSelectionListener() {
44 | 0 | public void valueChanged(ListSelectionEvent e) {
45 | 0 | if (list.getSelectedValue() != null) {
46 | 0 | model.selectNode((SimpleNode) list.getSelectedValue(), EvaluationResultsPanel.this);
47 |  | }
48 |  | }
49 |  | });
50 |  |
51 | 0 | add(new JScrollPane(list), BorderLayout.CENTER);
52 |  | }
53 |  |
54 |  | /**
55 |  | * @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
56 |  | */
57 | 0 | public void viewerModelChanged(ViewerModelEvent e) {
58 | 0 | switch (e.getReason()) {
59 | 0 | case ViewerModelEvent.PATH_EXPRESSION_EVALUATED:
60 |  |
61 | 0 | if (e.getSource() != this) {
62 | 0 | list.setListData(new Vector(model.getLastEvaluationResults()));
63 |  | }
64 |  |
65 | 0 | break;
66 |  |
67 | 0 | case ViewerModelEvent.CODE_RECOMPILED:
68 | 0 | list.setListData(new Vector(0));
69 |  |
70 | 0 | break;
71 |  | }
72 |  | }
73 |  | }