Przeglądaj źródła

Add support for identifying sub plugins to plugin prefs panel.

The sub plugins are now listed, indented, underneath their parent plugin
in the plugins prefs dialog.

Issue CLIENT-33

Change-Id: I71ab1c874ed1359fbce6f2da2e0a46ec5cf899e1
Reviewed-on: http://gerrit.dmdirc.com/2152
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.7rc1
Greg Holmes 13 lat temu
rodzic
commit
8f1cf33ed3

+ 11
- 5
src/com/dmdirc/addons/ui_swing/components/addonpanel/AddonCell.java Wyświetl plik

@@ -88,12 +88,18 @@ public class AddonCell extends JPanel implements AddonToggleListener {
88 88
         name.setFont(name.getFont().deriveFont(Font.BOLD));
89 89
         status.setForeground(foreground);
90 90
 
91
+        final int initialPadding;
92
+        if (info.getPluginInfo().getMetaData().getParent() == null) {
93
+            initialPadding = 20;
94
+        } else {
95
+            initialPadding = 30;
96
+        }
91 97
         add(icon, "gaptop rel, gapbottom rel, gapleft rel, "
92
-                + "wmin 20, wmax 20");
93
-        add(name, "gaptop rel, gapbottom rel, "
94
-                + "wmin 50% - 20, wmax 50% - 20");
95
-        add(status, "gaptop rel, gapbottom rel, gapright rel, "
96
-                + "wmin 50% - 20, wmax 50% - 20");
98
+                    + "wmin " + initialPadding + ", wmax " + initialPadding);
99
+        add(name, "gaptop rel, gapbottom rel, " + "wmin 50% - "
100
+                + initialPadding + ", wmax 50% - " + initialPadding);
101
+        add(status, "gaptop rel, gapbottom rel, gapright rel, " + "wmin 50% - "
102
+                + initialPadding + ", wmax 50% - " + initialPadding);
97 103
         add(new JSeparator(), "newline, spanx, growx, pushx");
98 104
     }
99 105
 

+ 14
- 1
src/com/dmdirc/addons/ui_swing/components/addonpanel/PluginPanel.java Wyświetl plik

@@ -71,8 +71,21 @@ public class PluginPanel extends AddonPanel implements ActionListener {
71 71
     @Override
72 72
     protected JTable populateList(final JTable table) {
73 73
         final List<PluginInfo> list = new ArrayList<PluginInfo>();
74
+        final List<PluginInfo> sortedList = new ArrayList<PluginInfo>();
74 75
         list.addAll(PluginManager.getPluginManager().getPluginInfos());
75 76
         Collections.sort(list);
77
+        for (PluginInfo plugin : list) {
78
+            if (plugin.getMetaData().getParent() == null) {
79
+                final List<PluginInfo> childList = new ArrayList<PluginInfo>();
80
+                sortedList.add(plugin);
81
+                for (PluginInfo child : plugin.getChildren()) {
82
+                    childList.add(child);
83
+                }
84
+                Collections.sort(childList);
85
+                sortedList.addAll(childList);
86
+            }
87
+        }
88
+
76 89
 
77 90
         UIUtilities.invokeLater(new Runnable() {
78 91
 
@@ -80,7 +93,7 @@ public class PluginPanel extends AddonPanel implements ActionListener {
80 93
             @Override
81 94
             public void run() {
82 95
                 ((DefaultTableModel) table.getModel()).setNumRows(0);
83
-                for (PluginInfo plugin : list) {
96
+                for (PluginInfo plugin : sortedList) {
84 97
                     ((DefaultTableModel) table.getModel()).addRow(
85 98
                             new AddonCell[]{
86 99
                         new AddonCell(new AddonToggle(plugin, null)), });

Ładowanie…
Anuluj
Zapisz