KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > pmd > util > viewer > gui > menu > XPathFragmentAddingItem


1 package net.sourceforge.pmd.util.viewer.gui.menu;
2
3 import net.sourceforge.pmd.util.viewer.model.ViewerModel;
4
5 import javax.swing.*;
6 import java.awt.event.ActionEvent JavaDoc;
7 import java.awt.event.ActionListener JavaDoc;
8
9
10 /**
11  * adds the given path fragment to the XPath expression upon action
12  *
13  * @author Boris Gruschko ( boris at gruschko.org )
14  * @version $Id: XPathFragmentAddingItem.java,v 1.9 2006/02/10 14:15:31 tomcopeland Exp $
15  */

16 public class XPathFragmentAddingItem
17         extends JMenuItem
18         implements ActionListener JavaDoc {
19     private ViewerModel model;
20     private String JavaDoc fragment;
21
22     /**
23      * constructs the item
24      *
25      * @param caption menu item's caption
26      * @param model model to refer to
27      * @param fragment XPath expression fragment to be added upon action
28      */

29     public XPathFragmentAddingItem(String JavaDoc caption, ViewerModel model, String JavaDoc fragment) {
30         super(caption);
31         this.model = model;
32         this.fragment = fragment;
33         addActionListener(this);
34     }
35
36     /**
37      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
38      */

39     public void actionPerformed(ActionEvent JavaDoc e) {
40         model.appendToXPathExpression(fragment, this);
41     }
42 }
43
Popular Tags