Search in sources :

Example 1 with BoosterPicturesProvider

use of org.magic.services.extra.BoosterPicturesProvider in project MtgDesktopCompanion by nicho92.

the class BoosterProviderTests method test.

@Test
public void test() {
    MTGLogger.changeLevel(Level.OFF);
    BoosterPicturesProvider prov = new BoosterPicturesProvider();
    for (String id : prov.listEditionsID()) {
        System.out.println(id + ";" + (prov.getBoosterFor(id) != null));
    }
}
Also used : BoosterPicturesProvider(org.magic.services.extra.BoosterPicturesProvider) Test(org.junit.Test)

Example 2 with BoosterPicturesProvider

use of org.magic.services.extra.BoosterPicturesProvider in project MtgDesktopCompanion by nicho92.

the class MagicEditionDetailPanel method initGUI.

public void initGUI() {
    JSplitPane splitPane;
    JPanel panneauBooster;
    JButton btnOpenBooster;
    JLabel lblOnlineSet;
    JPanel panneauHaut;
    JScrollPane scrollPane;
    JLabel lblBlock;
    JLabel lblId;
    JTable table;
    boosterProvider = new BoosterPicturesProvider();
    setLayout(new BorderLayout(0, 0));
    splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    panneauHaut = new JPanel();
    this.add(splitPane);
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 104, 333, 0, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0, 1.0E-4 };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0E-4 };
    panneauHaut.setLayout(gridBagLayout);
    JLabel setLabel = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("EDITION") + " :");
    GridBagConstraints labelgbc8 = new GridBagConstraints();
    labelgbc8.insets = new Insets(5, 5, 5, 5);
    labelgbc8.gridx = 0;
    labelgbc8.gridy = 0;
    panneauHaut.add(setLabel, labelgbc8);
    setJTextField = new JTextField();
    GridBagConstraints componentGbc8 = new GridBagConstraints();
    componentGbc8.insets = new Insets(5, 0, 5, 5);
    componentGbc8.fill = GridBagConstraints.HORIZONTAL;
    componentGbc8.gridx = 1;
    componentGbc8.gridy = 0;
    panneauHaut.add(setJTextField, componentGbc8);
    JLabel typeLabel = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("EDITION_TYPE") + " :");
    GridBagConstraints labelgbc11 = new GridBagConstraints();
    labelgbc11.insets = new Insets(5, 5, 5, 5);
    labelgbc11.gridx = 0;
    labelgbc11.gridy = 1;
    panneauHaut.add(typeLabel, labelgbc11);
    typeJTextField = new JTextField();
    GridBagConstraints componentGbc11 = new GridBagConstraints();
    componentGbc11.insets = new Insets(5, 0, 5, 5);
    componentGbc11.fill = GridBagConstraints.HORIZONTAL;
    componentGbc11.gridx = 1;
    componentGbc11.gridy = 1;
    panneauHaut.add(typeJTextField, componentGbc11);
    JLabel releaseDateLabel = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("DATE_RELEASE") + " :");
    GridBagConstraints labelgbc7 = new GridBagConstraints();
    labelgbc7.insets = new Insets(5, 5, 5, 5);
    labelgbc7.gridx = 0;
    labelgbc7.gridy = 2;
    panneauHaut.add(releaseDateLabel, labelgbc7);
    releaseDateJTextField = new JTextField();
    GridBagConstraints componentGbc7 = new GridBagConstraints();
    componentGbc7.insets = new Insets(5, 0, 5, 5);
    componentGbc7.fill = GridBagConstraints.HORIZONTAL;
    componentGbc7.gridx = 1;
    componentGbc7.gridy = 2;
    panneauHaut.add(releaseDateJTextField, componentGbc7);
    JLabel borderLabel = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("EDITION_BORDER") + " :");
    GridBagConstraints labelgbc2 = new GridBagConstraints();
    labelgbc2.insets = new Insets(5, 5, 5, 5);
    labelgbc2.gridx = 0;
    labelgbc2.gridy = 3;
    panneauHaut.add(borderLabel, labelgbc2);
    borderJTextField = new JTextField();
    GridBagConstraints componentGbc2 = new GridBagConstraints();
    componentGbc2.fill = GridBagConstraints.HORIZONTAL;
    componentGbc2.insets = new Insets(5, 0, 5, 5);
    componentGbc2.gridx = 1;
    componentGbc2.gridy = 3;
    panneauHaut.add(borderJTextField, componentGbc2);
    JLabel cardCountLabel = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("EDITION_CARD_COUNT") + " :");
    GridBagConstraints labelgbc3 = new GridBagConstraints();
    labelgbc3.insets = new Insets(5, 5, 5, 5);
    labelgbc3.gridx = 0;
    labelgbc3.gridy = 4;
    panneauHaut.add(cardCountLabel, labelgbc3);
    cardCountTextField = new JTextField();
    GridBagConstraints componentGbc3 = new GridBagConstraints();
    componentGbc3.insets = new Insets(5, 0, 5, 5);
    componentGbc3.fill = GridBagConstraints.HORIZONTAL;
    componentGbc3.gridx = 1;
    componentGbc3.gridy = 4;
    panneauHaut.add(cardCountTextField, componentGbc3);
    lblBlock = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("EDITION_BLOCK") + " :");
    GridBagConstraints gbclblBlock = new GridBagConstraints();
    gbclblBlock.insets = new Insets(0, 0, 5, 5);
    gbclblBlock.gridx = 0;
    gbclblBlock.gridy = 5;
    panneauHaut.add(lblBlock, gbclblBlock);
    blockJTextField = new JTextField();
    GridBagConstraints gbcblockJTextField = new GridBagConstraints();
    gbcblockJTextField.insets = new Insets(0, 0, 5, 5);
    gbcblockJTextField.fill = GridBagConstraints.HORIZONTAL;
    gbcblockJTextField.gridx = 1;
    gbcblockJTextField.gridy = 5;
    panneauHaut.add(blockJTextField, gbcblockJTextField);
    blockJTextField.setColumns(10);
    lblId = new JLabel("ID :");
    GridBagConstraints gbclblId = new GridBagConstraints();
    gbclblId.insets = new Insets(0, 0, 5, 5);
    gbclblId.gridx = 0;
    gbclblId.gridy = 6;
    panneauHaut.add(lblId, gbclblId);
    idJtextField = new JTextField();
    GridBagConstraints gbctxtID = new GridBagConstraints();
    gbctxtID.insets = new Insets(0, 0, 5, 5);
    gbctxtID.fill = GridBagConstraints.HORIZONTAL;
    gbctxtID.gridx = 1;
    gbctxtID.gridy = 6;
    panneauHaut.add(idJtextField, gbctxtID);
    idJtextField.setColumns(10);
    splitPane.setLeftComponent(panneauHaut);
    lblOnlineSet = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("EDITION_ONLINE") + " :");
    GridBagConstraints gbclblOnlineSet = new GridBagConstraints();
    gbclblOnlineSet.insets = new Insets(0, 0, 5, 5);
    gbclblOnlineSet.gridx = 0;
    gbclblOnlineSet.gridy = 7;
    panneauHaut.add(lblOnlineSet, gbclblOnlineSet);
    chkOnline = new JCheckBox("");
    GridBagConstraints gbcchkOnline = new GridBagConstraints();
    gbcchkOnline.anchor = GridBagConstraints.WEST;
    gbcchkOnline.insets = new Insets(0, 0, 5, 5);
    gbcchkOnline.gridx = 1;
    gbcchkOnline.gridy = 7;
    panneauHaut.add(chkOnline, gbcchkOnline);
    panneauBooster = new JPanel();
    add(panneauBooster, BorderLayout.EAST);
    panneauBooster.setLayout(new BorderLayout(0, 0));
    if (openBooster) {
        btnOpenBooster = new JButton(MTGControler.getInstance().getLangService().getCapitalize("OPEN_BOOSTER") + " :");
        panneauBooster.add(btnOpenBooster, BorderLayout.NORTH);
        btnOpenBooster.addActionListener(ae -> {
            try {
                CardSearchPanel.getInstance().thumbnail(MTGControler.getInstance().getEnabledProviders().generateBooster(magicEdition).getCards());
            } catch (Exception e) {
                logger.error("Error loading booster for " + magicEdition, e);
            }
        });
    }
    lblBoosterPic = new JLabel();
    panneauBooster.add(lblBoosterPic);
    if (showPrices) {
        scrollPane = new JScrollPane();
        mod = new EditionsShakerTableModel();
        table = new JTable(mod);
        table.setRowSorter(new TableRowSorter(mod));
        scrollPane.setViewportView(table);
        splitPane.setRightComponent(scrollPane);
    } else {
        splitPane.setRightComponent(null);
    }
    if (magicEdition != null) {
        mBindingGroup = initDataBindings();
    }
    setEditable(false);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) JSplitPane(javax.swing.JSplitPane) BoosterPicturesProvider(org.magic.services.extra.BoosterPicturesProvider) EditionsShakerTableModel(org.magic.gui.models.EditionsShakerTableModel) TableRowSorter(javax.swing.table.TableRowSorter)

Aggregations

BoosterPicturesProvider (org.magic.services.extra.BoosterPicturesProvider)2 BorderLayout (java.awt.BorderLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 JButton (javax.swing.JButton)1 JCheckBox (javax.swing.JCheckBox)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JSplitPane (javax.swing.JSplitPane)1 JTable (javax.swing.JTable)1 JTextField (javax.swing.JTextField)1 TableRowSorter (javax.swing.table.TableRowSorter)1 Test (org.junit.Test)1 EditionsShakerTableModel (org.magic.gui.models.EditionsShakerTableModel)1