Skip to content

Commit

Permalink
#1898 restore size of MatchPredictionDialog (#1946)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsbrenk authored Nov 20, 2023
1 parent b1c920b commit 4a5ed34
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/main/java/core/model/UserParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ public final class UserParameter extends Configuration {
public boolean includeHTOLineups=false;
public boolean includeLineupTemplates=false;

public int matchPredictionDialog_Width = 900;
public int matchPredictionDialog_Height = 600;

//~ Constructors -------------------------------------------------------------------------------

/**
Expand Down Expand Up @@ -639,6 +642,8 @@ public Map<String, String> getValues() {
map.put("lineupIncludeTemplates", String.valueOf(this.includeLineupTemplates));

map.put("series_tableSplitPaneDivider", String.valueOf(this.series_tableSplitPaneDivider.location));
map.put("matchPredictionDialog_Width", String.valueOf(this.matchPredictionDialog_Width));
map.put("matchPredictionDialog_Height", String.valueOf(this.matchPredictionDialog_Height));

return map;
}
Expand Down Expand Up @@ -888,6 +893,7 @@ public void setValues(Map<String, String> values) {
includeLineupTemplates = getBooleanValue(values,"lineupIncludeTemplates");

series_tableSplitPaneDivider.location = getIntValue(values, "series_tableSplitPaneDivider");
matchPredictionDialog_Width = getIntValue(values, "matchPredictionDialog_Width");
matchPredictionDialog_Height = getIntValue(values, "matchPredictionDialog_Height");
}

}
}
18 changes: 15 additions & 3 deletions src/main/java/core/prediction/MatchPredictionDialog.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
package core.prediction;

import core.gui.HOMainFrame;
import core.model.UserParameter;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.io.Serial;

import javax.swing.JDialog;


public class MatchPredictionDialog extends JDialog {

@Serial
private static final long serialVersionUID = 1L;

public MatchPredictionDialog(MatchEnginePanel panel, String match){
super(HOMainFrame.instance(),"",true);
initialize(panel);
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setTitle(match);
addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
var comp = (Component)e.getSource();
UserParameter.instance().matchPredictionDialog_Width = comp.getWidth();
UserParameter.instance().matchPredictionDialog_Height = comp.getHeight();
}
});

setVisible(true);
}

private void initialize(MatchEnginePanel panel) {
getContentPane().setLayout(new BorderLayout());
getContentPane().add(panel, BorderLayout.CENTER);
setResizable(true);
setSize(900, 600);
setSize(UserParameter.instance().matchPredictionDialog_Width, UserParameter.instance().matchPredictionDialog_Height);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* fix error player download nickname null pointer exception (#1938)

### Team Analyzer
* restore size of match prediction dialog box (#1898)

### Rating
* implement schum rating prediction (#1782)
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/module/nthrf/NtTeamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public void testParseXml() {
</Team>
</HattrickData>""";

var ntteam = new NtTeamDetails(xml);
var ntteam = new NtTeamDetails();
ntteam.parseDetails(xml);

Assertions.assertEquals(9, ntteam.getMorale());
Assertions.assertEquals(6, ntteam.getSelfConfidence());
Expand Down

0 comments on commit 4a5ed34

Please sign in to comment.