1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.gui.plugin;
21
22 import javax.swing.tree.DefaultMutableTreeNode;
23
24 import org.xnap.pkg.PackageInfo;
25 import org.xnap.plugin.PluginInfo;
26 import org.xnap.plugin.PluginManager;
27
28 public class PluginNode extends DefaultMutableTreeNode {
29
30
31
32 public static final int STATE_KEEP = 0;
33 public static final int STATE_INSTALL = 1;
34 public static final int STATE_REMOVE = 2;
35
36
37
38 private PackageInfo packageInfo/package-summary.html">> PackageInfo packageInfo;
39 private PluginInfo pluginInfo;
40 private String action;
41 private boolean marked;
42
43
44
45 public PluginNode(PackageInfo packageInfo)/package-summary.html">ong> PluginNode(PackageInfo packageInfo)
46 {
47 setPackageInfo(packageInfo);
48 }
49
50
51
52 /***
53 * The selected action.
54 */
55 public String getAction()
56 {
57 return action;
58 }
59
60 /***
61 * Returns the plugin info that corresponds to the package.
62 */
63 public PluginInfo getPluginInfo()
64 {
65 return pluginInfo;
66 }
67
68 /***
69 * Returns the package that is to be changed.
70 */
71 public PackageInfo getPackageInfo()
72 {
73 return packageInfo/package-summary.html">g> packageInfo;
74 }
75
76 public boolean isActionChanged()
77 {
78 return (action != null) && !action.equals(packageInfo.getAction());
79 }
80
81 public boolean isMarked()
82 {
83 return marked;
84 }
85
86 public boolean isUpdateAvailable()
87 {
88 return (pluginInfo != null)
89 ? packageInfo.compareToVersion(pluginInfo) > 0
90 : false;
91 }
92
93 public void setAction(String action)
94 {
95 this.action = action;
96 }
97
98 public void setMarked(boolean marked)
99 {
100 this.marked = marked;
101 }
102
103 public void setPackageInfo(PackageInfo packageInfo)/package-summary.html">> void setPackageInfo(PackageInfo packageInfo)
104 {
105 this.packageInfo = packageInfo;
106 setAction(packageInfo.getAction());
107 setPluginInfo
108 (PluginManager.getInstance().getInfoByName(packageInfo.getName()));
109 }
110
111 public void setPluginInfo(PluginInfo pluginInfo)
112 {
113 this.pluginInfo = pluginInfo;
114 }
115
116 }