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.Icon;
26 import javax.swing.ImageIcon;
27 import javax.swing.JFrame;
28 import javax.swing.JPopupMenu;
29
30 import org.bounce.RunnableAction;
31 import org.bounce.MenuUtilities;
32 import org.bounce.image.ImageLoader;
33 import org.bounce.util.URIUtils;
34
35 /***
36 * A Directory Node.
37 *
38 * @version $Revision$, $Date$
39 * @author Edwin Dankert <edankert@gmail.com>
40 */
41 public class DirectoryNode extends URINode {
42 private static final long serialVersionUID = -8085361000356059123L;
43
44 private static final ImageIcon ICON = ImageLoader.get().getImage( "/org/xmlhammer/gui/icons/etool16/dir.gif");
45
46 public DirectoryNode(URI uri) {
47 super(uri);
48 }
49
50 public String getName() {
51 return URIUtils.getDirectoryName(getURI());
52 }
53
54 public String getValue() {
55 return getName();
56 }
57
58 public String getDescription() {
59 return URIUtils.toString(getURI());
60 }
61
62 public Icon getIcon() {
63 return ICON;
64 }
65
66 @Override
67 public JPopupMenu getPopupMenu(JFrame parent) {
68 JPopupMenu popup = new JPopupMenu();
69 popup.add(getOpenURIAction(null, 0, 0));
70 popup.add(getEditURIAction(null, 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 @Override
82 public RunnableAction getDefaultAction(JFrame parent) {
83 return null;
84 }
85 }