fix: updates game count for current game view when adding/removing a game entry
This commit is contained in:
parent
7a0ca694ea
commit
9cc504b1d7
|
@ -274,6 +274,7 @@ public class ListPanel extends JPanel
|
|||
super.setSelectionInterval(anchor, lead);
|
||||
mainPanel.getGameDetailsBackgroundPanel().updateSelectedGame(list.getSelectedValue());
|
||||
uiModel.removeNewGameListData();
|
||||
mainPanel.repaintAfterModifications();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -105,6 +105,7 @@ public class MainPanel extends JPanel
|
|||
public void addNewGame()
|
||||
{
|
||||
getListPanel().addNewGame();
|
||||
repaintAfterModifications();
|
||||
}
|
||||
|
||||
public void deleteCurrentGame()
|
||||
|
|
|
@ -392,6 +392,8 @@ public class MainViewModel extends AbstractModel
|
|||
else
|
||||
{
|
||||
dbConnector.deleteGame(currentGameId);
|
||||
//Update all games count, will be reset if its All that is loaded
|
||||
allGamesCount--;
|
||||
//Reload the current view
|
||||
reloadCurrentGameView();
|
||||
}
|
||||
|
@ -449,6 +451,9 @@ public class MainViewModel extends AbstractModel
|
|||
public void addNewGameListData()
|
||||
{
|
||||
gameListModel.addElement(new GameListData("New Game", "", 0));
|
||||
selectedGameView.setGameCount(gameListModel.getSize());
|
||||
//Update all games count
|
||||
allGamesCount++;
|
||||
}
|
||||
|
||||
public void removeNewGameListData()
|
||||
|
@ -456,6 +461,9 @@ public class MainViewModel extends AbstractModel
|
|||
if (gameListModel.get(gameListModel.getSize() - 1).getGameId().isEmpty())
|
||||
{
|
||||
gameListModel.remove(gameListModel.getSize() - 1);
|
||||
selectedGameView.setGameCount(gameListModel.getSize());
|
||||
//Update all games count
|
||||
allGamesCount--;
|
||||
resetDataChanged();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue