Search in sources :

Example 1 with RuneLiteConfig

use of net.runelite.client.config.RuneLiteConfig in project runelite by runelite.

the class ConfigPanel method rebuildPluginList.

final void rebuildPluginList() {
    scrollBarPosition = getScrollPane().getVerticalScrollBar().getValue();
    Map<String, JPanel> newChildren = new TreeMap<>();
    pluginManager.getPlugins().stream().filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden()).sorted(Comparator.comparing(left -> left.getClass().getAnnotation(PluginDescriptor.class).name())).forEach(plugin -> {
        final Config pluginConfigProxy = pluginManager.getPluginConfigProxy(plugin);
        final String pluginName = plugin.getClass().getAnnotation(PluginDescriptor.class).name();
        final JPanel groupPanel = buildGroupPanel();
        groupPanel.add(new JLabel(pluginName), BorderLayout.CENTER);
        final JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new GridLayout(1, 2, 3, 0));
        groupPanel.add(buttonPanel, BorderLayout.LINE_END);
        final JButton editConfigButton = buildConfigButton(pluginConfigProxy);
        buttonPanel.add(editConfigButton);
        final JButton toggleButton = buildToggleButton(plugin);
        buttonPanel.add(toggleButton);
        newChildren.put(pluginName, groupPanel);
    });
    final JPanel groupPanel = buildGroupPanel();
    groupPanel.add(new JLabel("RuneLite"), BorderLayout.CENTER);
    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(1, 2, 3, 0));
    groupPanel.add(buttonPanel, BorderLayout.LINE_END);
    final JButton editConfigButton = buildConfigButton(runeLiteConfig);
    buttonPanel.add(editConfigButton);
    final JButton toggleButton = buildToggleButton(null);
    buttonPanel.add(toggleButton);
    newChildren.put("RuneLite", groupPanel);
    children = newChildren;
    openConfigList();
}
Also used : JPanel(javax.swing.JPanel) PluginDescriptor(net.runelite.client.plugins.PluginDescriptor) GridLayout(java.awt.GridLayout) RuneLiteConfig(net.runelite.client.config.RuneLiteConfig) Config(net.runelite.client.config.Config) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) TreeMap(java.util.TreeMap)

Aggregations

GridLayout (java.awt.GridLayout)1 TreeMap (java.util.TreeMap)1 JButton (javax.swing.JButton)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 Config (net.runelite.client.config.Config)1 RuneLiteConfig (net.runelite.client.config.RuneLiteConfig)1 PluginDescriptor (net.runelite.client.plugins.PluginDescriptor)1