1 package net.sf.panoptes.model.node;
2
3 import java.util.Enumeration;
4 import java.util.Vector;
5
6 import org.eclipse.swt.graphics.Image;
7 import org.eclipse.swt.widgets.Display;
8
9 /***
10 * Node.java
11 *
12 * Interface to be implemented by all objects to be displayed in the element tree.
13 *
14 * @author dag@liodden.no
15 * @version 0.1
16 */
17
18 public abstract class Node {
19
20 public static final Image ICON_SERVER = createImage("icons/server.gif");
21 public static final Image ICON_SERVICE = createImage("icons/service.gif");
22 public static final Image ICON_MBEAN = createImage("icons/mBean.gif");
23 public static final Image ICON_OPERATION = createImage("icons/operation.gif");
24
25 public static final Image ICON_LOG = createImage("icons/logfile.gif");
26 public static final Image ICON_LOG_FOLDER = createImage("icons/logfileviewer.gif");
27 public static final Image ICON_SESSION = createImage("icons/session.gif");
28 public static final Image ICON_DATASOURCE = createImage("icons/connection.gif");
29
30 public static final Image ICON_CONNECTION = createImage("icons/connection.gif");
31 public static final Image ICON_CONNECTIONS_FOLDER = createImage("icons/servernavigator.gif");
32
33 public static final Image ICON_FOLDER = createImage("icons/folder.gif");
34 public static final Image ICON_QUERY_FOLDER = createImage("icons/queryfolder.gif");
35 public static final Image ICON_USER = createImage("icons/user.gif");
36 public static final Image ICON_DOMAIN = createImage("icons/domain.gif");
37
38 public static final Image ICON_ERROR = createImage("icons/error.gif");
39 public static final Image ICON_WARNING = createImage("icons/warning.gif");
40 public static final Image ICON_INFO = createImage("icons/info.gif");
41
42 public static final Image ICON_BROKEN_LINK = createImage("icons/brokenlink.gif");
43
44 public static Image createImage(String iconName) {
45 return new Image(Display.getCurrent(), ClassLoader.getSystemResourceAsStream(iconName));
46 }
47
48 private Vector listeners = new Vector();
49 private NodeDescriptor configDescriptor = null;
50 private Image icon = null;
51
52 /***
53 * @param icon
54 */
55 public void setIcon(Image icon) {
56 this.icon = icon;
57 }
58
59 /***
60 * @param configDescriptor
61 */
62 public void setConfigDescriptor(NodeDescriptor configDescriptor) {
63 this.configDescriptor = configDescriptor;
64 }
65
66 public void addUpdateListener(NodeUpdateListener listener) {
67 listeners.add(listener);
68 }
69
70 public void removeUpdateListener(NodeUpdateListener listener) {
71 listeners.remove(listener);
72 }
73
74 public void notifyListeners(NodeUpdateEvent event) {
75 for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
76 ((NodeUpdateListener) e.nextElement()).nodeUpdated(event);
77 }
78 }
79
80
81 public NodeDescriptor getConfigDescriptor() {
82 return configDescriptor;
83 }
84
85 public abstract Node[] getChildren();
86 public abstract boolean acceptsChildren();
87
88 public abstract String[] getConfiguratorScripts();
89
90 /***
91 * @return
92 */
93 public abstract Image getIcon();
94
95 }
This page was automatically generated by Maven