Skip to content
Snippets Groups Projects
Commit 7c78ed84 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Improve PlayoutLog session name validation; Fixed PlayoutLog Session deletion

parent 6d6caa37
Branches
Tags
No related merge requests found
...@@ -65,7 +65,7 @@ public class PlayoutLogViewController extends NVC { ...@@ -65,7 +65,7 @@ public class PlayoutLogViewController extends NVC {
@Override @Override
public void init() { public void init() {
logList.getItems().setAll(LogSeasons.getAllLogSeasonsLazy()); updateListView();
if (LogSeasons.getCurrentSession() != null) { // Running if (LogSeasons.getCurrentSession() != null) { // Running
startButton.setText(Localization.getString(Strings.PLAYOUT_LOG_DIALOG_BUTTON_STOP)); startButton.setText(Localization.getString(Strings.PLAYOUT_LOG_DIALOG_BUTTON_STOP));
...@@ -82,6 +82,8 @@ public class PlayoutLogViewController extends NVC { ...@@ -82,6 +82,8 @@ public class PlayoutLogViewController extends NVC {
autoStartCheckbox.selectedProperty().addListener((observable, oldValue, newValue) -> autoStartCheckbox.selectedProperty().addListener((observable, oldValue, newValue) ->
SettingsProxy.getSettings(PlayoutLogSettings.class).autoStartLogging(newValue)); SettingsProxy.getSettings(PlayoutLogSettings.class).autoStartLogging(newValue));
startButton.disableProperty().bind(nameTextField.textProperty().isEmpty());
exportButton.setDisable(true); exportButton.setDisable(true);
exportCsvButton.setDisable(true); exportCsvButton.setDisable(true);
logList.getSelectionModel().getSelectedItems().addListener((InvalidationListener) observable -> { logList.getSelectionModel().getSelectedItems().addListener((InvalidationListener) observable -> {
...@@ -91,6 +93,10 @@ public class PlayoutLogViewController extends NVC { ...@@ -91,6 +93,10 @@ public class PlayoutLogViewController extends NVC {
deleteButton.disableProperty().bind(logList.getSelectionModel().selectedItemProperty().isNull()); deleteButton.disableProperty().bind(logList.getSelectionModel().selectedItemProperty().isNull());
} }
private void updateListView() {
logList.getItems().setAll(LogSeasons.getAllLogSeasonsLazy());
}
@Override @Override
public void initStage(Stage stage) { public void initStage(Stage stage) {
stage.getIcons().add(PlayPadPlugin.getInstance().getIcon()); stage.getIcons().add(PlayPadPlugin.getInstance().getIcon());
...@@ -111,6 +117,11 @@ public class PlayoutLogViewController extends NVC { ...@@ -111,6 +117,11 @@ public class PlayoutLogViewController extends NVC {
return; return;
} }
if (LogSeasons.getAllLogSeasonsLazy().stream().anyMatch(item -> item.getName().equals(nameTextField.getText()))) {
showErrorMessage(Localization.getString("PlayoutLogDialog.Error.NameExists"));
return;
}
final Project currentProject = PlayPadPlugin.getInstance().getCurrentProject(); final Project currentProject = PlayPadPlugin.getInstance().getCurrentProject();
final ProjectSettings settings = currentProject.getSettings(); final ProjectSettings settings = currentProject.getSettings();
...@@ -119,10 +130,13 @@ public class PlayoutLogViewController extends NVC { ...@@ -119,10 +130,13 @@ public class PlayoutLogViewController extends NVC {
startButton.setText(Localization.getString(Strings.PLAYOUT_LOG_DIALOG_BUTTON_STOP)); startButton.setText(Localization.getString(Strings.PLAYOUT_LOG_DIALOG_BUTTON_STOP));
nameTextField.setDisable(false); nameTextField.setDisable(false);
updateListView();
} else { // Stop } else { // Stop
LogSeasons.stop(); LogSeasons.stop();
startButton.setText(Localization.getString(Strings.PLAYOUT_LOG_DIALOG_BUTTON_START)); startButton.setText(Localization.getString(Strings.PLAYOUT_LOG_DIALOG_BUTTON_START));
nameTextField.setDisable(false); nameTextField.setDisable(false);
nameTextField.setText("");
} }
} }
...@@ -188,10 +202,8 @@ public class PlayoutLogViewController extends NVC { ...@@ -188,10 +202,8 @@ public class PlayoutLogViewController extends NVC {
@FXML @FXML
private void deleteButtonHandler(ActionEvent event) { private void deleteButtonHandler(ActionEvent event) {
logList.getSelectionModel().getSelectedItems().forEach(season -> { logList.getSelectionModel().getSelectedItems().forEach(season -> LogSeasons.deleteSession(season.getId()));
LogSeasons.deleteSession(season.getId()); updateListView();
logList.getItems().remove(season);
});
} }
@FXML @FXML
......
...@@ -8,3 +8,5 @@ PlayoutLogDialog.Button.Stop=Stoppen ...@@ -8,3 +8,5 @@ PlayoutLogDialog.Button.Stop=Stoppen
PlayoutLogDialog.Button.Export=PDF Exportieren... PlayoutLogDialog.Button.Export=PDF Exportieren...
PlayoutLogDialog.Button.ExportAll=CSV Exportieren... PlayoutLogDialog.Button.ExportAll=CSV Exportieren...
PlayoutLogDialog.Button.Delete=L\u00F6schen... PlayoutLogDialog.Button.Delete=L\u00F6schen...
PlayoutLogDialog.Error.NameExists=Dieser Name ist bereits verwendet. W\u00E4hlen Sie bitte einen anderen Namen.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment