Skip to content

Commit

Permalink
Converted status toggle into bulk action
Browse files Browse the repository at this point in the history
  • Loading branch information
syd711 committed Oct 31, 2024
1 parent d996690 commit 95d0ef9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ public void refreshContextMenu(TableView<GameRepresentationModel> tableView, Con

if (frontendType.supportStandardFields()) {
boolean isDisabled = game.isDisabled();
String txt = isDisabled ? "Enable Table Data" : "Disable Table Data";
String txt = isDisabled ? "Enable Table" : "Disable Table";
String icon = isDisabled ? "mdi2c-checkbox-marked-outline" : "mdi2c-checkbox-blank-off-outline";
//icon = isDisabled ? "mdi2m-microsoft-xbox-controller" : "mdi2m-microsoft-xbox-controller-off";
MenuItem enableItem = new MenuItem(txt, WidgetFactory.createIcon(icon));
KeyCombination enableItemKey = new KeyCodeCombination(KeyCode.E, KeyCombination.ALT_DOWN);
enableItem.setAccelerator(enableItemKey);
enableItem.setOnAction(actionEvent -> tableOverviewController.onTableToggle());
enableItem.setOnAction(actionEvent -> tableOverviewController.onTableStatusToggle());
ctxMenu.getItems().add(enableItem);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,13 @@ public void onTableEdit() {
* Not mapped to a button in toolbar, but could be. Useful for context menu
*/
@FXML
public void onTableToggle() {
GameRepresentation game = getSelection();
if (game != null) {
public void onTableStatusToggle() {
List<GameRepresentation> selections = getSelections();
toggleTableStatus(selections);
}

private static void toggleTableStatus(List<GameRepresentation> games) {
for (GameRepresentation game : games) {
TableDetails detail = client.getFrontendService().getTableDetails(game.getId());
boolean isDisable = game.isDisabled();
detail.setStatus(isDisable ? 1 : 0);
Expand Down

0 comments on commit 95d0ef9

Please sign in to comment.