Remove some spurious comments
This commit is contained in:
parent
3b725e3f29
commit
b1d1acad2f
@ -1,5 +1,6 @@
|
|||||||
package name.nathanmcrae.numbersstation;
|
package name.nathanmcrae.numbersstation;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
@ -11,7 +12,6 @@ import javafx.event.ActionEvent;
|
|||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class StationSelectionController {
|
public class StationSelectionController {
|
||||||
|
|
||||||
@ -23,9 +23,7 @@ public class StationSelectionController {
|
|||||||
private ObservableList<StationSettings> stationList;
|
private ObservableList<StationSettings> stationList;
|
||||||
|
|
||||||
public StationSelectionController() {
|
public StationSelectionController() {
|
||||||
// Initialize the list with an empty list
|
|
||||||
stationList = FXCollections.observableArrayList();
|
stationList = FXCollections.observableArrayList();
|
||||||
// Add listener to the stationList
|
|
||||||
stationList.addListener((ListChangeListener<StationSettings>) change -> onStationListChanged(change));
|
stationList.addListener((ListChangeListener<StationSettings>) change -> onStationListChanged(change));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,16 +51,13 @@ public class StationSelectionController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void handleAddButtonPress(ActionEvent event) {
|
private void handleAddButtonPress(ActionEvent event) {
|
||||||
// Create a TextInputDialog
|
|
||||||
TextInputDialog dialog = new TextInputDialog();
|
TextInputDialog dialog = new TextInputDialog();
|
||||||
dialog.setTitle("New Station");
|
dialog.setTitle("New Station");
|
||||||
dialog.setHeaderText("Add a New Station");
|
dialog.setHeaderText("Add a New Station");
|
||||||
dialog.setContentText("Please enter the station name:");
|
dialog.setContentText("Please enter the station name:");
|
||||||
|
|
||||||
// Show the dialog and capture the result
|
|
||||||
Optional<String> result = dialog.showAndWait();
|
Optional<String> result = dialog.showAndWait();
|
||||||
result.ifPresent(stationName -> {
|
result.ifPresent(stationName -> {
|
||||||
// Add the new station to the list
|
|
||||||
StationSettings newStation = new StationSettings(stationName);
|
StationSettings newStation = new StationSettings(stationName);
|
||||||
stationList.add(newStation);
|
stationList.add(newStation);
|
||||||
});
|
});
|
||||||
@ -70,7 +65,6 @@ public class StationSelectionController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void handleRemoveButtonPress(ActionEvent event) {
|
private void handleRemoveButtonPress(ActionEvent event) {
|
||||||
// Remove the selected item from the list
|
|
||||||
int selectedIndex = stationListView.getSelectionModel().getSelectedIndex();
|
int selectedIndex = stationListView.getSelectionModel().getSelectedIndex();
|
||||||
if (selectedIndex >= 0) {
|
if (selectedIndex >= 0) {
|
||||||
stationList.remove(selectedIndex);
|
stationList.remove(selectedIndex);
|
||||||
|
Loading…
Reference in New Issue
Block a user