|
@@ -24,11 +24,13 @@ package com.dmdirc.addons.ui_swing.components.expandingsettings;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.addons.ui_swing.PrefsComponentFactory;
|
26
|
26
|
import com.dmdirc.addons.ui_swing.UIUtilities;
|
|
27
|
+import com.dmdirc.addons.ui_swing.components.IconManager;
|
27
|
28
|
import com.dmdirc.addons.ui_swing.components.text.TextLabel;
|
28
|
29
|
import com.dmdirc.config.prefs.PreferencesCategory;
|
29
|
30
|
import com.dmdirc.config.prefs.PreferencesSetting;
|
30
|
|
-import com.dmdirc.addons.ui_swing.components.IconManager;
|
31
|
|
-import com.dmdirc.util.collections.DoubleMap;
|
|
31
|
+
|
|
32
|
+import com.google.common.collect.BiMap;
|
|
33
|
+import com.google.common.collect.HashBiMap;
|
32
|
34
|
|
33
|
35
|
import javax.swing.BorderFactory;
|
34
|
36
|
import javax.swing.JComponent;
|
|
@@ -50,7 +52,7 @@ public class SettingsPanel extends JPanel {
|
50
|
52
|
/** Use external padding. */
|
51
|
53
|
private final boolean padding;
|
52
|
54
|
/** Current Settings. */
|
53
|
|
- private final DoubleMap<PreferencesSetting, JComponent> settings;
|
|
55
|
+ private final BiMap<PreferencesSetting, JComponent> settings;
|
54
|
56
|
/** Info label. */
|
55
|
57
|
private TextLabel infoLabel;
|
56
|
58
|
/** Current options panel. */
|
|
@@ -87,7 +89,7 @@ public class SettingsPanel extends JPanel {
|
87
|
89
|
|
88
|
90
|
this.compFactory = compFactory;
|
89
|
91
|
|
90
|
|
- settings = new DoubleMap<>();
|
|
92
|
+ settings = HashBiMap.create();
|
91
|
93
|
|
92
|
94
|
setOpaque(UIUtilities.getTabbedPaneOpaque());
|
93
|
95
|
this.padding = padding;
|
|
@@ -205,7 +207,7 @@ public class SettingsPanel extends JPanel {
|
205
|
207
|
* @param setting Setting to add
|
206
|
208
|
*/
|
207
|
209
|
protected void addAddableOption(final JComponent setting) {
|
208
|
|
- settings.getKey(setting).setValue(null);
|
|
210
|
+ settings.inverse().get(setting).setValue(null);
|
209
|
211
|
addOptionPanel.addOption(setting);
|
210
|
212
|
}
|
211
|
213
|
|
|
@@ -217,7 +219,7 @@ public class SettingsPanel extends JPanel {
|
217
|
219
|
* @return Setting or null if not found
|
218
|
220
|
*/
|
219
|
221
|
public PreferencesSetting getSettingForComponent(final JComponent comp) {
|
220
|
|
- return settings.getKey(comp);
|
|
222
|
+ return settings.inverse().get(comp);
|
221
|
223
|
}
|
222
|
224
|
|
223
|
225
|
}
|