Skip to content

Commit

Permalink
Fixed Total
Browse files Browse the repository at this point in the history
Fixed total sometimes bugging out as a result of removing a row
  • Loading branch information
mculig committed Mar 10, 2020
1 parent 1ca115e commit 97f63a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
1 change: 0 additions & 1 deletion TemtemTracker/savedData/table.json

This file was deleted.

25 changes: 9 additions & 16 deletions TemtemTracker/src/temtemTableUI/TemtemTableUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import temtemTableData.TimerData;
import temtemTableData.TotalData;



public class TemtemTableUI extends JPanel {

/**
Expand Down Expand Up @@ -73,6 +75,10 @@ public void removeRow(TableDataRow row) {
this.remove(rowUI);
// Reduce the total
temtemTable.total.encountered -= row.encountered;
// Remove the row
temtemTable.rows.remove(row);
// Remove the row from the hash map
UIRows.remove(row);
// Recalculate Temtem/H
huntingUI.updateCount(temtemTable.total.encountered);
// Recalculate total Luma chance
Expand All @@ -82,24 +88,11 @@ public void removeRow(TableDataRow row) {
tableRow.encounteredPercent = tableRow.encountered / (double) temtemTable.total.encountered;
UIRows.get(tableRow).update();
});
// Remove the row
temtemTable.rows.remove(row);
// Remove the row from the hash map
UIRows.remove(row);
// Redraw the panel
redrawPanel();
}

private void redrawPanel() {
this.removeAll();
this.add(TemtemTableHeaderUIFactory.createHeaderUI(), 0);
this.add(new TemtemTableTotalUI(temtemTable.total), 1);
this.add(huntingUI, 2);
for (TableDataRow row : temtemTable.rows) {
this.add(UIRows.get(row), 1);
}
total.update();
this.revalidate();
this.repaint();
// Redraw the panel
//redrawPanel();
}

private void initializeTable(TemtemDataTable table) {
Expand Down

0 comments on commit 97f63a4

Please sign in to comment.