Skip to content

Commit

Permalink
updates deck dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nicol authored and nicol committed Dec 1, 2024
1 parent e55b809 commit 826ec7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.magic.api.interfaces.abstracts;

import java.io.IOException;
import java.util.AbstractMap;

import org.magic.api.interfaces.MTGDeckSniffer;
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/magic/gui/components/deck/DeckSnifferDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class DeckSnifferDialog extends JDialog {
public DeckSnifferDialog() {

importedDeck = new MTGDeck();
setSize(new Dimension(500, 300));
setSize(new Dimension(600, 500));
setTitle(capitalize("DECKS_IMPORTER"));
setLocationRelativeTo(null);
setIconImage(MTGConstants.ICON_DECK.getImage());
Expand All @@ -67,14 +67,14 @@ public DeckSnifferDialog() {
selectedSniffer = listEnabledPlugins(MTGDeckSniffer.class).get(0);
var panelButton = new JPanel();
cboSniffers =UITools.createComboboxPlugins(MTGDeckSniffer.class,false);
btnConnect = new JButton(capitalize("CONNECT"));
btnConnect = new JButton(capitalize("OPEN"));
cboFormats = new JComboBox<>();
var labCardFilter = new JLabel("With this card : ");
var btnCardImport = UITools.createBindableJButton("", MTGConstants.ICON_TAB_IMPORT, KeyEvent.VK_I, "WithCard");
var lblCard = new JLabel();
var btnRemoveCard = new JButton(MTGConstants.ICON_SMALL_DELETE);
cardFilterPanel = UITools.createFlowPanel(labCardFilter,btnCardImport,lblCard,btnRemoveCard);
var panelNorth = UITools.createFlowPanel(cboSniffers,cardFilterPanel,cboFormats,btnConnect,lblLoad);
var panelNorth = UITools.createFlowPanel(cboSniffers,cboFormats,cardFilterPanel,btnConnect,lblLoad);
var btnClose = new JButton(MTGConstants.ICON_CANCEL);
btnImport = new JButton(MTGConstants.ICON_CHECK);

Expand All @@ -98,6 +98,9 @@ public DeckSnifferDialog() {
panelButton.add(btnImport);


pack();



btnClose.addActionListener(e -> dispose());

Expand All @@ -123,13 +126,15 @@ public DeckSnifferDialog() {

cboSniffers.addActionListener(e -> {
cboFormats.removeAllItems();
model.clear();
selectedSniffer = (MTGDeckSniffer) cboSniffers.getSelectedItem();


for (String s : selectedSniffer.listFilter())
cboFormats.addItem(s);

cardFilterPanel.setVisible(selectedSniffer.hasCardFilter());
pack();

});


Expand All @@ -139,7 +144,7 @@ public DeckSnifferDialog() {

@Override
protected List <RetrievableDeck> doInBackground() throws Exception {
if(plug.hasCardFilter())
if(plug.hasCardFilter() && filteredCard!=null)
return plug.getDeckList(cboFormats.getSelectedItem().toString(),filteredCard);
else
return plug.getDeckList(cboFormats.getSelectedItem().toString(),null);
Expand Down Expand Up @@ -187,11 +192,6 @@ protected void error(Exception e) {
};

ThreadManager.getInstance().runInEdt(sw, "Import deck");


pack();


});


Expand Down

0 comments on commit 826ec7b

Please sign in to comment.