Skip to content

Commit

Permalink
Merge pull request #1811 from AaronGullickson/advance-days-show
Browse files Browse the repository at this point in the history
Fix advance multiple days reports not showing
  • Loading branch information
AaronGullickson authored Jun 17, 2020
2 parents 2d35865 + cac1a01 commit 8ef5692
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions MekHQ/src/mekhq/gui/dialog/AdvanceDaysDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Collections;

Expand Down Expand Up @@ -63,8 +65,8 @@ public AdvanceDaysDialog(Frame owner, CampaignGUI gui) {
this.gui = gui;
setName("formADD"); // NOI18N
getContentPane().setLayout(new GridBagLayout());
this.setPreferredSize(new Dimension(500,500));
initComponents();
this.setPreferredSize(new Dimension(500,500));
setLocationRelativeTo(owner);
setUserPreferences();
}
Expand Down Expand Up @@ -146,6 +148,7 @@ public void actionPerformed(ActionEvent event) {
days = today.lengthOfYear() + 1 - today.getDayOfYear();
}

List<String> reports = new ArrayList<String>();
for (; days > 0; days--) {
if (gui.getCampaign().checkOverDueLoans()
|| gui.nagShortMaintenance()
Expand All @@ -161,16 +164,19 @@ public void actionPerformed(ActionEvent event) {
if (!gui.getCampaign().newDay()) {
break;
}
//String newLogString = logPanel.getLogText();
//newLogString = newLogString.concat(gui.getCampaign().getCurrentReportHTML());
if (firstDay) {
logPanel.refreshLog(gui.getCampaign().getCurrentReportHTML());
String report = gui.getCampaign().getCurrentReportHTML();
logPanel.refreshLog(report);
firstDay = false;
gui.getCampaign().fetchAndClearNewReports();
} else {
logPanel.appendLog(Collections.singletonList("<hr/>")); //$NON-NLS-1$
logPanel.appendLog(gui.getCampaign().fetchAndClearNewReports());
String report = gui.getCampaign().getCurrentReportHTML();
reports.add("<hr/>");
reports.add(report);
gui.getCampaign().fetchAndClearNewReports();
}
}
logPanel.appendLog(reports);

// We couldn't advance all days for some reason,
// set the spinner to the number of remaining days
Expand Down

0 comments on commit 8ef5692

Please sign in to comment.