use of org.magic.gui.models.EditionsShakerTableModel in project MtgDesktopCompanion by nicho92.
the class EditionsDashlet method initGUI.
public void initGUI() {
JPanel panel = new JPanel();
getContentPane().add(panel, BorderLayout.NORTH);
modEdition = new EditionsShakerTableModel();
List<MagicEdition> eds = new ArrayList<>();
try {
eds.addAll(MTGControler.getInstance().getEnabledProviders().loadEditions());
Collections.sort(eds);
eds.add(0, null);
} catch (Exception e) {
MTGLogger.printStackTrace(e);
}
cboEditions = new JComboBox(new DefaultComboBoxModel<MagicEdition>(eds.toArray(new MagicEdition[eds.size()])));
cboEditions.setRenderer(new MagicEditionListRenderer());
panel.add(cboEditions);
lblLoading = new JLabel("");
lblLoading.setIcon(MTGConstants.ICON_LOADING);
lblLoading.setVisible(false);
panel.add(lblLoading);
JScrollPane scrollPane = new JScrollPane();
getContentPane().add(scrollPane, BorderLayout.CENTER);
table = new JXTable(modEdition);
initToolTip(table, 0, 1);
table.getColumnModel().getColumn(3).setCellRenderer(new CardShakeRenderer());
table.getColumnModel().getColumn(5).setCellRenderer(new CardShakeRenderer());
scrollPane.setViewportView(table);
setVisible(true);
cboEditions.addActionListener(ae -> init());
if (getProperties().size() > 0) {
Rectangle r = new Rectangle((int) Double.parseDouble(getProperty("x")), (int) Double.parseDouble(getProperty("y")), (int) Double.parseDouble(getProperty("w")), (int) Double.parseDouble(getProperty("h")));
MagicEdition ed;
try {
ed = MTGControler.getInstance().getEnabledProviders().getSetById(getProperty("EDITION"));
cboEditions.setSelectedItem(ed);
} catch (Exception e) {
logger.error("Error retrieve editions", e);
}
setBounds(r);
}
try {
table.packAll();
} catch (Exception e) {
MTGLogger.printStackTrace(e);
}
new TableFilterHeader(table, AutoChoices.ENABLED);
}
use of org.magic.gui.models.EditionsShakerTableModel 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);
}
Aggregations