blob: adff241c36e8773b0e3d9b495545b2fd50b7d278 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
package com.c2kernel.gui.data;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import com.c2kernel.entity.proxy.EntityProxy;
import com.c2kernel.gui.EntityTabManager;
import com.c2kernel.lookup.Path;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Language;
import com.c2kernel.utils.Logger;
/**
* Structure for Item presence on the tree and ItemDetails boxes. Created by NodeFactory.
* @author $Author: abranson $
* @version $Version$
*/
public abstract class NodeEntity extends Node {
protected EntityProxy myEntity = null;
public NodeEntity(Path path, EntityTabManager desktop) {
super(path, desktop);
Logger.msg(2,"NodeEntity.<init> - Creating item for '"+path.toString()+"'.");
try {
// if an item - resolve the item and get its properties
myEntity = Gateway.getProxyManager().getProxy(path);
this.sysKey = path.getSysKey();
Logger.msg(2,"NodeEntity.<init> - System key is "+this.sysKey);
// Name should be the alias if present
String alias = myEntity.getName();
if (alias != null) this.name = alias;
this.type = myEntity.getProperty("Type");
String iconString = this.type;
if (type.equals("ActivityDesc")) iconString = myEntity.getProperty("Complexity")+iconString;
iconString = iconString.toLowerCase();
this.setIcon(iconString);
createTreeNode();
} catch (Exception e) {
Logger.msg(2, "NodeEntity.<init> - "+sysKey+" failed to resolve:");
Logger.error(e);
}
}
public EntityProxy getEntity() {
return myEntity;
}
/**
*
*/
public JPopupMenu getPopupMenu() {
JPopupMenu popup = super.getPopupMenu();
JMenuItem openItem = new JMenuItem(Language.translate("Open"));
openItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
openItem();
}
});
popup.addSeparator();
popup.add(openItem);
return popup;
}
public void openItem() {
desktop.add(this);
}
public ArrayList getTabs() {
ArrayList requiredTabs = new ArrayList();
return requiredTabs;
}
}
|