mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
UI: added set search button in viewer
This commit is contained in:
parent
a9ef352ef1
commit
6b52f2efc3
1 changed files with 50 additions and 22 deletions
|
@ -44,6 +44,7 @@ import mage.client.MageFrame;
|
|||
import mage.client.cards.BigCard;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.gui.FastSearchUtil;
|
||||
import mage.client.util.sets.ConstructedFormats;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
@ -76,31 +77,56 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
}
|
||||
|
||||
public void initComponents() {
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jPanel1.setOpaque(false);
|
||||
buttonsPanel = new javax.swing.JPanel();
|
||||
buttonsPanel.setOpaque(false);
|
||||
bigCard = new BigCard();
|
||||
BoxLayout boxlayout = new BoxLayout(jPanel1, BoxLayout.PAGE_AXIS);
|
||||
jPanel1.setLayout(boxlayout);
|
||||
BoxLayout boxlayout = new BoxLayout(buttonsPanel, BoxLayout.PAGE_AXIS);
|
||||
buttonsPanel.setLayout(boxlayout);
|
||||
btnExit = new javax.swing.JButton();
|
||||
btnExit.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
jPanel1.add(btnExit);
|
||||
buttonsPanel.add(btnExit);
|
||||
|
||||
JLabel label1 = new JLabel("Choose format:");
|
||||
label1.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
label1.setForeground(Color.white);
|
||||
jPanel1.add(label1);
|
||||
buttonsPanel.add(label1);
|
||||
|
||||
// SELECT SET
|
||||
// panel
|
||||
setPanel = new JPanel();
|
||||
setPanel.setLayout(new javax.swing.BoxLayout(setPanel, javax.swing.BoxLayout.LINE_AXIS));
|
||||
setPanel.setOpaque(false);
|
||||
setPanel.setPreferredSize(new Dimension(200, 25));
|
||||
setPanel.setMaximumSize(new Dimension(200, 25));
|
||||
setPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
buttonsPanel.add(setPanel);
|
||||
// combo set
|
||||
formats = new JComboBox<>(ConstructedFormats.getTypes());
|
||||
formats.setSelectedItem(ConstructedFormats.getDefault());
|
||||
formats.setPreferredSize(new Dimension(250, 25));
|
||||
formats.setMaximumSize(new Dimension(250, 25));
|
||||
formats.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
jPanel1.add(formats);
|
||||
formats.setAlignmentX(0.0F);
|
||||
formats.setMinimumSize(new Dimension(50, 25));
|
||||
formats.setPreferredSize(new Dimension(50, 25));
|
||||
formats.setMaximumSize(new Dimension(Integer.MAX_VALUE, 25));
|
||||
setPanel.add(formats);
|
||||
// search button
|
||||
btnSetFastSearch = new JButton();
|
||||
btnSetFastSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/search_24.png")));
|
||||
btnSetFastSearch.setToolTipText(FastSearchUtil.DEFAULT_EXPANSION_TOOLTIP_MESSAGE);
|
||||
btnSetFastSearch.setAlignmentX(1.0F);
|
||||
btnSetFastSearch.setMinimumSize(new java.awt.Dimension(24, 24));
|
||||
btnSetFastSearch.setPreferredSize(new java.awt.Dimension(32, 32));
|
||||
btnSetFastSearch.setMaximumSize(new java.awt.Dimension(32, 32));
|
||||
btnSetFastSearch.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
FastSearchUtil.showFastSearchForStringComboBox(formats, FastSearchUtil.DEFAULT_EXPANSION_SEARCH_MESSAGE);
|
||||
}
|
||||
});
|
||||
setPanel.add(btnSetFastSearch);
|
||||
|
||||
JLabel label2 = new JLabel("Choose size:");
|
||||
label2.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
label2.setForeground(Color.white);
|
||||
jPanel1.add(label2);
|
||||
buttonsPanel.add(label2);
|
||||
|
||||
small3x3 = new JRadioButton("3x3");
|
||||
small3x3.setForeground(Color.white);
|
||||
|
@ -111,7 +137,7 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
mageBook.updateSize(MageBook.LAYOUT_3x3);
|
||||
MageFrame.getPreferences().put(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_3x3);
|
||||
});
|
||||
jPanel1.add(small3x3);
|
||||
buttonsPanel.add(small3x3);
|
||||
|
||||
big4x4 = new JRadioButton("4x4");
|
||||
big4x4.setForeground(Color.white);
|
||||
|
@ -121,19 +147,19 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
mageBook.updateSize(MageBook.LAYOUT_4x4);
|
||||
MageFrame.getPreferences().put(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_4x4);
|
||||
});
|
||||
jPanel1.add(big4x4);
|
||||
buttonsPanel.add(big4x4);
|
||||
|
||||
JLabel label3 = new JLabel("Switch tabs:");
|
||||
label3.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
label3.setForeground(Color.white);
|
||||
jPanel1.add(label3);
|
||||
buttonsPanel.add(label3);
|
||||
|
||||
JPanel buttonPanel = new JPanel();
|
||||
buttonPanel.setPreferredSize(new Dimension(200, 100));
|
||||
buttonPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 100));
|
||||
buttonPanel.setOpaque(false);
|
||||
buttonPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
jPanel1.add(buttonPanel);
|
||||
buttonsPanel.add(buttonPanel);
|
||||
|
||||
JButton prev = new JButton("Prev");
|
||||
prev.addActionListener(e -> mageBook.prev());
|
||||
|
@ -146,13 +172,13 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
JLabel label4 = new JLabel("Show cards or tokens:");
|
||||
label3.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
label3.setForeground(Color.white);
|
||||
jPanel1.add(label4);
|
||||
buttonsPanel.add(label4);
|
||||
|
||||
JCheckBox cardsOrTokens = new JCheckBox("Display Cards");
|
||||
cardsOrTokens.setSelected(true);
|
||||
cardsOrTokens.setToolTipText("Select to show Cards or Tokens(and emblems) for the chosen set");
|
||||
cardsOrTokens.addActionListener(e -> mageBook.cardsOrTokens(cardsOrTokens.isSelected()));
|
||||
jPanel1.add(cardsOrTokens);
|
||||
buttonsPanel.add(cardsOrTokens);
|
||||
|
||||
formats.addActionListener(e -> {
|
||||
if (mageBook != null) {
|
||||
|
@ -162,12 +188,12 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
jPanel1.add(Box.createVerticalGlue());
|
||||
buttonsPanel.add(Box.createVerticalGlue());
|
||||
|
||||
bigCard.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||
bigCard.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
bigCard.setAlignmentY(Component.BOTTOM_ALIGNMENT);
|
||||
jPanel1.add(bigCard);
|
||||
buttonsPanel.add(bigCard);
|
||||
|
||||
jPanel2 = new MageBookContainer();
|
||||
jPanel2.setOpaque(false);
|
||||
|
@ -177,13 +203,13 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 604, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
|
@ -241,8 +267,10 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel buttonsPanel;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel setPanel;
|
||||
private javax.swing.JButton btnSetFastSearch;
|
||||
private mage.client.cards.BigCard bigCard;
|
||||
private javax.swing.JButton btnExit;
|
||||
private JComboBox formats;
|
||||
|
|
Loading…
Reference in a new issue