From 8ca5a3ec2edbf6b7bf8aa2023a980ac7d5f5aed6 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 27 May 2019 18:17:34 +0400 Subject: [PATCH] UI: added filter button for oathbreaker format --- .../java/mage/client/table/TablesPanel.form | 26 ++++++++-- .../java/mage/client/table/TablesPanel.java | 51 ++++++++++--------- 2 files changed, 49 insertions(+), 28 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.form b/Mage.Client/src/main/java/mage/client/table/TablesPanel.form index 70f04d7ec3..41e7b06a4c 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.form +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.form @@ -47,7 +47,7 @@ - + @@ -290,7 +290,7 @@ - + @@ -307,7 +307,7 @@ - + @@ -396,7 +396,7 @@ - + @@ -412,7 +412,7 @@ - + @@ -433,6 +433,22 @@ + + + + + + + + + + + + + + + + diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 9544426506..5d01790591 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -329,11 +329,11 @@ public class TablesPanel extends javax.swing.JPanel { chatPanelMain.getUserChatPanel().setBorder(null); chatPanelMain.getUserChatPanel().setChatType(ChatPanelBasic.ChatType.TABLES); - // 4. BUTTONS + // 4. BUTTONS (add new buttons to the end of the list -- if not then users lost their filter settings) filterButtons = new JToggleButton[]{btnStateWaiting, btnStateActive, btnStateFinished, btnTypeMatch, btnTypeTourneyConstructed, btnTypeTourneyLimited, btnFormatBlock, btnFormatStandard, btnFormatModern, btnFormatLegacy, btnFormatVintage, btnFormatPremodern, btnFormatCommander, btnFormatTinyLeader, btnFormatLimited, btnFormatOther, - btnSkillBeginner, btnSkillCasual, btnSkillSerious, btnRated, btnUnrated, btnOpen, btnPassword}; + btnSkillBeginner, btnSkillCasual, btnSkillSerious, btnRated, btnUnrated, btnOpen, btnPassword, btnFormatOathbreaker}; JComponent[] components = new JComponent[]{chatPanelMain, jSplitPane1, jScrollPaneTablesActive, jScrollPaneTablesFinished, jPanelTop, jPanelTables}; for (JComponent component : components) { @@ -817,6 +817,9 @@ public class TablesPanel extends javax.swing.JPanel { if (btnFormatTinyLeader.isSelected()) { formatFilterList.add(RowFilter.regexFilter("^Tiny", TablesTableModel.COLUMN_DECK_TYPE)); } + if (btnFormatOathbreaker.isSelected()) { + formatFilterList.add(RowFilter.regexFilter("^Oathbreaker", TablesTableModel.COLUMN_DECK_TYPE)); + } if (btnFormatLimited.isSelected()) { formatFilterList.add(RowFilter.regexFilter("^Limited", TablesTableModel.COLUMN_DECK_TYPE)); } @@ -967,6 +970,7 @@ public class TablesPanel extends javax.swing.JPanel { btnFormatPremodern = new javax.swing.JToggleButton(); jSeparator3 = new javax.swing.JToolBar.Separator(); btnFormatCommander = new javax.swing.JToggleButton(); + btnFormatOathbreaker = new javax.swing.JToggleButton(); btnFormatTinyLeader = new javax.swing.JToggleButton(); jSeparator2 = new javax.swing.JToolBar.Separator(); btnFormatLimited = new javax.swing.JToggleButton(); @@ -1180,7 +1184,7 @@ public class TablesPanel extends javax.swing.JPanel { btnRated.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnRated.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - btnRatedbtnFilterActionPerformed(evt); + btnFilterActionPerformed(evt); } }); filterBar1.add(btnRated); @@ -1197,7 +1201,7 @@ public class TablesPanel extends javax.swing.JPanel { btnUnrated.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnUnrated.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - btnUnratedbtnFilterActionPerformed(evt); + btnFilterActionPerformed(evt); } }); filterBar1.add(btnUnrated); @@ -1279,7 +1283,7 @@ public class TablesPanel extends javax.swing.JPanel { btnFormatVintage.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnFormatVintage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - btnFormatVintageActionPerformed(evt); + btnFilterActionPerformed(evt); } }); filterBar2.add(btnFormatVintage); @@ -1295,7 +1299,7 @@ public class TablesPanel extends javax.swing.JPanel { btnFormatPremodern.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnFormatPremodern.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - btnFormatPremodernActionPerformed(evt); + btnFilterActionPerformed(evt); } }); filterBar2.add(btnFormatPremodern); @@ -1317,6 +1321,22 @@ public class TablesPanel extends javax.swing.JPanel { }); filterBar2.add(btnFormatCommander); + btnFormatOathbreaker.setSelected(true); + btnFormatOathbreaker.setText("Oathbreaker"); + btnFormatOathbreaker.setToolTipText("Oathbreaker format."); + btnFormatOathbreaker.setFocusPainted(false); + btnFormatOathbreaker.setFocusable(false); + btnFormatOathbreaker.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + btnFormatOathbreaker.setRequestFocusEnabled(false); + btnFormatOathbreaker.setVerifyInputWhenFocusTarget(false); + btnFormatOathbreaker.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + btnFormatOathbreaker.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnFilterActionPerformed(evt); + } + }); + filterBar2.add(btnFormatOathbreaker); + btnFormatTinyLeader.setSelected(true); btnFormatTinyLeader.setText("Tiny Leader"); btnFormatTinyLeader.setToolTipText("Tiny Leader format."); @@ -1432,7 +1452,7 @@ public class TablesPanel extends javax.swing.JPanel { .addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnQuickStartDuel) .addComponent(btnQuickStartCommander)) - .addContainerGap(734, Short.MAX_VALUE)) + .addContainerGap(667, Short.MAX_VALUE)) ); jPanelTopLayout.setVerticalGroup( jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1631,22 +1651,6 @@ public class TablesPanel extends javax.swing.JPanel { this.startUpdateTasks(true); }//GEN-LAST:event_btnStateFinishedActionPerformed - private void btnRatedbtnFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRatedbtnFilterActionPerformed - setTableFilter(); - }//GEN-LAST:event_btnRatedbtnFilterActionPerformed - - private void btnUnratedbtnFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUnratedbtnFilterActionPerformed - setTableFilter(); - }//GEN-LAST:event_btnUnratedbtnFilterActionPerformed - - private void btnFormatPremodernActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFormatPremodernActionPerformed - setTableFilter(); - }//GEN-LAST:event_btnFormatPremodernActionPerformed - - private void btnFormatVintageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFormatVintageActionPerformed - setTableFilter(); - }//GEN-LAST:event_btnFormatVintageActionPerformed - private void buttonWhatsNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonWhatsNewActionPerformed MageFrame.getInstance().showWhatsNewDialog(true); }//GEN-LAST:event_buttonWhatsNewActionPerformed @@ -1666,6 +1670,7 @@ public class TablesPanel extends javax.swing.JPanel { private javax.swing.JToggleButton btnFormatLegacy; private javax.swing.JToggleButton btnFormatLimited; private javax.swing.JToggleButton btnFormatModern; + private javax.swing.JToggleButton btnFormatOathbreaker; private javax.swing.JToggleButton btnFormatOther; private javax.swing.JToggleButton btnFormatPremodern; private javax.swing.JToggleButton btnFormatStandard;