mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Saving collection viewer format in preferences
This commit is contained in:
parent
1eba9096b0
commit
0e2481c0a9
1 changed files with 9 additions and 0 deletions
|
@ -29,6 +29,7 @@ package mage.client.deckeditor.collection.viewer;
|
|||
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.util.sets.ConstructedFormats;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -44,9 +45,16 @@ import java.awt.event.ActionListener;
|
|||
public final class CollectionViewerPanel extends JPanel {
|
||||
|
||||
protected static String LAYOYT_CONFIG_KEY = "collectionViewerLayoutConfig";
|
||||
protected static String FORMAT_CONFIG_KEY = "collectionViewerFormat";
|
||||
|
||||
public CollectionViewerPanel() {
|
||||
initComponents();
|
||||
try {
|
||||
String format = PreferencesDialog.getCachedValue(CollectionViewerPanel.FORMAT_CONFIG_KEY, ConstructedFormats.getDefault());
|
||||
formats.setSelectedItem(format);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void initComponents() {
|
||||
|
@ -133,6 +141,7 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
public void actionPerformed(ActionEvent e) {
|
||||
if (mageBook != null) {
|
||||
String format = (String)formats.getSelectedItem();
|
||||
MageFrame.getPreferences().put(CollectionViewerPanel.FORMAT_CONFIG_KEY, format);
|
||||
mageBook.updateDispayedSets(format);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue