|
@@ -23,6 +23,7 @@
|
23
|
23
|
package com.dmdirc.addons.ui_swing.components.addonpanel;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.addons.ui_swing.components.text.TextLabel;
|
|
26
|
+import com.dmdirc.ui.IconManager;
|
26
|
27
|
|
27
|
28
|
import java.awt.Color;
|
28
|
29
|
import java.awt.Font;
|
|
@@ -54,21 +55,26 @@ public class AddonCell extends JPanel implements AddonToggleListener {
|
54
|
55
|
private final TextLabel status;
|
55
|
56
|
/** Addon icon. */
|
56
|
57
|
private final JLabel icon;
|
|
58
|
+ /** Icon manager to retrieve icons from. */
|
|
59
|
+ private final IconManager iconManager;
|
57
|
60
|
|
58
|
61
|
/**
|
59
|
62
|
* Creates a new addon cell representing the specified addon info.
|
60
|
63
|
*
|
61
|
64
|
* @param info PluginInfoToggle or ThemeToggle
|
|
65
|
+ * @param iconManager Icon manager to retrieve icons from
|
62
|
66
|
*/
|
63
|
|
- public AddonCell(final AddonToggle info) {
|
|
67
|
+ public AddonCell(final AddonToggle info, final IconManager iconManager) {
|
64
|
68
|
super();
|
65
|
69
|
|
|
70
|
+ this.iconManager = iconManager;
|
|
71
|
+ this.info = info;
|
|
72
|
+
|
66
|
73
|
name = new TextLabel(false);
|
67
|
74
|
status = new TextLabel(false);
|
68
|
75
|
status.setAlignment(StyleConstants.ALIGN_RIGHT);
|
69
|
76
|
icon = new JLabel();
|
70
|
77
|
|
71
|
|
- this.info = info;
|
72
|
78
|
info.addListener(this);
|
73
|
79
|
init();
|
74
|
80
|
}
|
|
@@ -77,11 +83,12 @@ public class AddonCell extends JPanel implements AddonToggleListener {
|
77
|
83
|
* Initialises the addon cell.
|
78
|
84
|
*/
|
79
|
85
|
private void init() {
|
80
|
|
- setLayout(new MigLayout("fill, ins 0, debug"));
|
|
86
|
+ setLayout(new MigLayout("fill, ins 0"));
|
81
|
87
|
Color foreground = UIManager.getColor("Table.foreground");
|
82
|
88
|
if (!info.getState()) {
|
83
|
89
|
foreground = foreground.brighter().brighter().brighter();
|
84
|
90
|
}
|
|
91
|
+ icon.setIcon(iconManager.getIcon("addon"));
|
85
|
92
|
name.setText(info.getName());
|
86
|
93
|
status.setText(info.getState() ? "Enabled" : "Disabled");
|
87
|
94
|
name.setForeground(foreground);
|
|
@@ -95,7 +102,7 @@ public class AddonCell extends JPanel implements AddonToggleListener {
|
95
|
102
|
initialPadding = 30;
|
96
|
103
|
}
|
97
|
104
|
add(icon, "gaptop rel, gapbottom rel, gapleft rel, "
|
98
|
|
- + "wmin " + initialPadding + ", wmax " + initialPadding);
|
|
105
|
+ + ", wmax " + initialPadding + ", right");
|
99
|
106
|
add(name, "gaptop rel, gapbottom rel, " + "wmin 50% - "
|
100
|
107
|
+ initialPadding + ", wmax 50% - " + initialPadding);
|
101
|
108
|
add(status, "gaptop rel, gapbottom rel, gapright rel, " + "wmin 50% - "
|