mirror of
https://github.com/correl/mage.git
synced 2025-04-07 13:01:06 -09:00
fix some bugs from Sonar 06032019
This commit is contained in:
parent
e68b79336a
commit
ee3f592186
6 changed files with 20 additions and 31 deletions
Mage.Client/src/main/java/mage/client
|
@ -77,6 +77,12 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
for (MouseListener ml : cardArea.getMouseListeners()) {
|
for (MouseListener ml : cardArea.getMouseListeners()) {
|
||||||
cardArea.removeMouseListener(ml);
|
cardArea.removeMouseListener(ml);
|
||||||
}
|
}
|
||||||
|
for (Component comp : cardArea.getComponents()) {
|
||||||
|
if (comp instanceof CardPanel) {
|
||||||
|
((CardPanel) comp).cleanUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cardArea.removeAll();
|
||||||
}
|
}
|
||||||
if (mainTable != null) {
|
if (mainTable != null) {
|
||||||
for (MouseListener ml : mainTable.getMouseListeners()) {
|
for (MouseListener ml : mainTable.getMouseListeners()) {
|
||||||
|
@ -86,13 +92,8 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
if (currentView != null) {
|
if (currentView != null) {
|
||||||
currentView.clearCardEventListeners();
|
currentView.clearCardEventListeners();
|
||||||
}
|
}
|
||||||
for (Component comp : cardArea.getComponents()) {
|
|
||||||
if (comp instanceof CardPanel) {
|
|
||||||
((CardPanel) comp).cleanUp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mageCards.clear();
|
mageCards.clear();
|
||||||
cardArea.removeAll();
|
|
||||||
this.bigCard = null;
|
this.bigCard = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,13 @@ import java.awt.Dimension;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
class Slice {
|
class Slice implements Serializable {
|
||||||
|
|
||||||
double value;
|
double value;
|
||||||
Color color;
|
Color color;
|
||||||
|
@ -22,7 +24,7 @@ class Slice {
|
||||||
|
|
||||||
public class ManaPieChart extends JComponent {
|
public class ManaPieChart extends JComponent {
|
||||||
|
|
||||||
ArrayList<Slice> slices = new ArrayList<Slice>();
|
private List<Slice> slices = new ArrayList<>();
|
||||||
|
|
||||||
ManaPieChart() {
|
ManaPieChart() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,6 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
if (time != null) {
|
if (time != null) {
|
||||||
text.append(getColoredText(TIMESTAMP_COLOR, timeFormatter.format(time) + ": "));
|
text.append(getColoredText(TIMESTAMP_COLOR, timeFormatter.format(time) + ": "));
|
||||||
//this.txtConversation.append(TIMESTAMP_COLOR, time + " ");
|
|
||||||
}
|
}
|
||||||
String userColor;
|
String userColor;
|
||||||
String textColor;
|
String textColor;
|
||||||
|
@ -239,11 +238,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
||||||
userColor = USER_INFO_COLOR;
|
userColor = USER_INFO_COLOR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (parentChatRef != null) {
|
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
|
||||||
} else {
|
|
||||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
|
||||||
}
|
|
||||||
textColor = MESSAGE_COLOR;
|
textColor = MESSAGE_COLOR;
|
||||||
userSeparator = ": ";
|
userSeparator = ": ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,11 +55,7 @@ public class ChatPanelSeparated extends ChatPanelBasic {
|
||||||
userColor = USER_INFO_COLOR;
|
userColor = USER_INFO_COLOR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (parentChatRef != null) {
|
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
|
||||||
} else {
|
|
||||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
|
||||||
}
|
|
||||||
textColor = MESSAGE_COLOR;
|
textColor = MESSAGE_COLOR;
|
||||||
userSeparator = ": ";
|
userSeparator = ": ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,15 +22,9 @@ public class MageJDesktop extends JDesktopPane {
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
if ("Nimbus".equals(UIManager.getLookAndFeel().getName())) {
|
if ("Nimbus".equals(UIManager.getLookAndFeel().getName())) {
|
||||||
UIDefaults map = new UIDefaults();
|
UIDefaults map = new UIDefaults();
|
||||||
Painter painter = new Painter() {
|
Painter painter = (g, c, w, h) -> {
|
||||||
|
g.setColor( UIManager.getDefaults().getColor("desktop") );
|
||||||
final Color color = null;
|
g.fillRect(0,0,w,h);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paint(Graphics2D g, Object c, int w, int h) {
|
|
||||||
g.setColor(color == null ? UIManager.getDefaults().getColor("desktop") : color);
|
|
||||||
g.fillRect(0,0,w,h);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
map.put("DesktopPane[Enabled].backgroundPainter", painter);
|
map.put("DesktopPane[Enabled].backgroundPainter", painter);
|
||||||
putClientProperty("Nimbus.Overrides", map);
|
putClientProperty("Nimbus.Overrides", map);
|
||||||
|
|
|
@ -907,7 +907,6 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
packPanels.add(setPanel); // for later access
|
packPanels.add(setPanel); // for later access
|
||||||
// combo set
|
// combo set
|
||||||
JComboBox pack = new JComboBox();
|
JComboBox pack = new JComboBox();
|
||||||
pack = new JComboBox();
|
|
||||||
pack.setModel(new DefaultComboBoxModel(ExpansionRepository.instance.getWithBoostersSortedByReleaseDate()));
|
pack.setModel(new DefaultComboBoxModel(ExpansionRepository.instance.getWithBoostersSortedByReleaseDate()));
|
||||||
pack.addActionListener(evt -> packActionPerformed(evt));
|
pack.addActionListener(evt -> packActionPerformed(evt));
|
||||||
pack.setAlignmentX(0.0F);
|
pack.setAlignmentX(0.0F);
|
||||||
|
@ -963,7 +962,7 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
for (int i = 0; i < packPanels.size(); i++) {
|
for (int i = 0; i < packPanels.size(); i++) {
|
||||||
JComboBox pack = findComboInComponent(packPanels.get(i));
|
JComboBox pack = findComboInComponent(packPanels.get(i));
|
||||||
if (pack.equals(curentCombo)) {
|
if (pack != null && pack.equals(curentCombo)) {
|
||||||
startIndex = i + 1;
|
startIndex = i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -972,7 +971,9 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
// change all from start index
|
// change all from start index
|
||||||
for (int i = startIndex; i < packPanels.size(); i++) {
|
for (int i = startIndex; i < packPanels.size(); i++) {
|
||||||
JComboBox pack = findComboInComponent(packPanels.get(i));
|
JComboBox pack = findComboInComponent(packPanels.get(i));
|
||||||
pack.setSelectedIndex(newValue);
|
if(pack != null) {
|
||||||
|
pack.setSelectedIndex(newValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue