1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.xmlhammer.gui.output;
22
23 import java.net.URI;
24
25 import javax.swing.ImageIcon;
26 import javax.swing.JFrame;
27 import javax.swing.JPopupMenu;
28
29 import org.bounce.RunnableAction;
30 import org.bounce.MenuUtilities;
31 import org.xmlhammer.model.project.ValueType;
32
33 /***
34 * The node for the XML tree, containing an XML element.
35 *
36 * @version $Revision: 1.7 $, $Date: 2007/07/04 19:42:48 $
37 * @author Edwin Dankert <edankert@gmail.com>
38 */
39 public class ValueNode extends ResultNode {
40 private static final long serialVersionUID = -6314127203480034911L;
41
42 private ValueType value = null;
43 private URI uri = null;
44
45 public ValueNode(URI uri, ValueType value) {
46 this.value = value;
47 this.uri = uri;
48 }
49
50 public String getName() {
51 return "";
52 }
53
54 public String getValue() {
55 return value.getValue();
56 }
57
58 public String getDescription() {
59 return value.getValue();
60 }
61
62 public ImageIcon getIcon() {
63 return null;
64 }
65
66 @Override
67 public JPopupMenu getPopupMenu(JFrame parent) {
68 JPopupMenu popup = new JPopupMenu();
69 popup.add(getOpenURIAction(uri, 0, 0));
70 popup.add(getEditURIAction(uri, 0, 0));
71 popup.addSeparator();
72 popup.add(getCopyAction());
73 popup.addSeparator();
74 popup.add(getPropertiesAction(null));
75
76 MenuUtilities.alignMenu(popup);
77
78 return popup;
79 }
80
81 public String getCopyValue() {
82 return value.getValue();
83 }
84
85 @Override
86 public RunnableAction getDefaultAction(JFrame parent) {
87 return getPropertiesAction(null);
88 }
89 }