Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |
file stats: | LOC: | 64 |  | Methods: | 4
| NCLOC: | 39 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
XPathPanel.java | 0% | 0% | 0% | 0% |

1 |  | package net.sourceforge.pmd.util.viewer.gui;
2 |  |
3 |  |
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 |  | import net.sourceforge.pmd.util.viewer.util.NLS;
8 |  |
9 |  | import javax.swing.*;
10 |  | import java.awt.Dimension;
11 |  |
12 |  |
13 |  | /**
14 |  | * Panel for the XPath entry and editing
15 |  | *
16 |  | * @author Boris Gruschko ( boris at gruschko.org )
17 |  | * @version $Id: XPathPanel.java,v 1.11 2006/02/10 14:15:31 tomcopeland Exp $
18 |  | */
19 |  |
20 |  | public class XPathPanel extends JTabbedPane implements ViewerModelListener {
21 |  | private ViewerModel model;
22 |  | private JTextArea xPathArea;
23 |  |
24 |  | /**
25 |  | * Constructs the panel
26 |  | *
27 |  | * @param model model to refer to
28 |  | */
29 | 0 | public XPathPanel(ViewerModel model) {
30 | 0 | super(JTabbedPane.BOTTOM);
31 | 0 | this.model = model;
32 | 0 | init();
33 |  | }
34 |  |
35 | 0 | private void init() {
36 | 0 | model.addViewerModelListener(this);
37 | 0 | xPathArea = new JTextArea();
38 | 0 | setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("XPATH.PANEL.TITLE")));
39 | 0 | add(new JScrollPane(xPathArea), NLS.nls("XPATH.PANEL.EXPRESSION"));
40 | 0 | add(new EvaluationResultsPanel(model), NLS.nls("XPATH.PANEL.RESULTS"));
41 | 0 | setPreferredSize(new Dimension(-1, 200));
42 |  | }
43 |  |
44 | 0 | public String getXPathExpression() {
45 | 0 | return xPathArea.getText();
46 |  | }
47 |  |
48 |  | /**
49 |  | * @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
50 |  | */
51 | 0 | public void viewerModelChanged(ViewerModelEvent e) {
52 | 0 | switch (e.getReason()) {
53 | 0 | case ViewerModelEvent.PATH_EXPRESSION_APPENDED:
54 | 0 | if (e.getSource() != this) {
55 | 0 | xPathArea.append((String) e.getParameter());
56 |  | }
57 | 0 | setSelectedIndex(0);
58 | 0 | break;
59 | 0 | case ViewerModelEvent.CODE_RECOMPILED:
60 | 0 | setSelectedIndex(0);
61 | 0 | break;
62 |  | }
63 |  | }
64 |  | }