Compare commits
	
		
			7 Commits
		
	
	
		
			eb07e42ab0
			...
			475808acd8
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 475808acd8 | |||
| 8af3162f46 | |||
| 00832e92bf | |||
| 741055b200 | |||
| fa0130b4b4 | |||
| 53d6132ecd | |||
| c0028b2978 | 
| @@ -176,7 +176,7 @@ public class Main extends Application { | |||||||
|             Path nextMessagePath = stationDirPath.resolve("next-message.txt"); |             Path nextMessagePath = stationDirPath.resolve("next-message.txt"); | ||||||
|             String messageText; |             String messageText; | ||||||
|             if (!Files.exists(nextMessagePath)) { |             if (!Files.exists(nextMessagePath)) { | ||||||
|                 messageText = loadedStation.generateMessage(); |                 messageText = loadedStation.generateMessage(settings.getMessageGenerationAttempts()); | ||||||
|             } else { |             } else { | ||||||
|                 messageText = new String(Files.readAllBytes(nextMessagePath)); |                 messageText = new String(Files.readAllBytes(nextMessagePath)); | ||||||
|             } |             } | ||||||
| @@ -202,9 +202,9 @@ public class Main extends Application { | |||||||
|                 System.exit(1); |                 System.exit(1); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             String newMessageText = loadedStation.generateMessage(); |             String newMessageText = loadedStation.generateMessage(settings.getMessageGenerationAttempts()); | ||||||
|             Files.write(nextMessagePath, newMessageText.getBytes(StandardCharsets.UTF_8)); |             Files.write(nextMessagePath, newMessageText.getBytes(StandardCharsets.UTF_8)); | ||||||
|         } catch (IOException e) { |         } catch (IOException | StationSettings.MessageGenerationException e) { | ||||||
|             logger.log(Level.SEVERE, "Exception while posting message to station " + stationName, e); |             logger.log(Level.SEVERE, "Exception while posting message to station " + stationName, e); | ||||||
|             // TODO: Notification |             // TODO: Notification | ||||||
|             System.exit(1); |             System.exit(1); | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ import java.net.URL; | |||||||
| import java.nio.file.Files; | import java.nio.file.Files; | ||||||
| import java.nio.file.Path; | import java.nio.file.Path; | ||||||
| import java.nio.file.Paths; | import java.nio.file.Paths; | ||||||
|  | import java.util.ArrayList; | ||||||
| import java.util.logging.Level; | import java.util.logging.Level; | ||||||
| import java.util.logging.Logger; | import java.util.logging.Logger; | ||||||
| import java.util.Random; | import java.util.Random; | ||||||
| @@ -49,9 +50,6 @@ public class MainController implements Initializable { | |||||||
|  |  | ||||||
|     @FXML |     @FXML | ||||||
|     private void handleStationSettingsButtonPress() { |     private void handleStationSettingsButtonPress() { | ||||||
|         System.out.println("Button pressed!"); |  | ||||||
|         lastRetrievedLabel.setText("Button pressed!"); |  | ||||||
|  |  | ||||||
|         if (settingsStage == null || !settingsStage.isShowing()) { |         if (settingsStage == null || !settingsStage.isShowing()) { | ||||||
|             try { |             try { | ||||||
|                 FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("StationSettingsView.fxml")); |                 FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("StationSettingsView.fxml")); | ||||||
| @@ -67,6 +65,7 @@ public class MainController implements Initializable { | |||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|                 controller.setStationSettings(selectedStation); |                 controller.setStationSettings(selectedStation); | ||||||
|  |                 controller.setStationNameList(settings.getStations().stream().map(StationSettings::toString).toList()); | ||||||
|  |  | ||||||
|                 settingsStage = new Stage(); |                 settingsStage = new Stage(); | ||||||
|                 settingsStage.initModality(Modality.APPLICATION_MODAL); |                 settingsStage.initModality(Modality.APPLICATION_MODAL); | ||||||
| @@ -169,8 +168,12 @@ public class MainController implements Initializable { | |||||||
|             .findFirst() |             .findFirst() | ||||||
|             .orElse(null); |             .orElse(null); | ||||||
|  |  | ||||||
|  |         // TODO: if there are no stations, then create a default station and select that | ||||||
|  |  | ||||||
|         if (selectedStation == null) { |         if (selectedStation == null) { | ||||||
|             // TODO: create a new station and save it? |             logger.log(Level.SEVERE, "Selected station '" + selectedStationName.get() + "' not found"); | ||||||
|  |             selectedStation = settings.getStations().get(0); | ||||||
|  |             selectedStationName.set(selectedStation.getName()); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         messageTextArea.addEventFilter(KeyEvent.ANY, event -> { |         messageTextArea.addEventFilter(KeyEvent.ANY, event -> { | ||||||
|   | |||||||
| @@ -18,8 +18,8 @@ public class MainSettings { | |||||||
|     private static final Logger logger = Logger.getLogger(Main.class.getName()); |     private static final Logger logger = Logger.getLogger(Main.class.getName()); | ||||||
|  |  | ||||||
|     private int digitsPerGroup; |     private int digitsPerGroup; | ||||||
|  |     private int messageGenerationAttempts; | ||||||
|     private String username; |     private String username; | ||||||
|     private int refreshInterval; |  | ||||||
|     private String selectedStationName; |     private String selectedStationName; | ||||||
|  |  | ||||||
|     private ArrayList<StationSettings> stations; |     private ArrayList<StationSettings> stations; | ||||||
| @@ -27,6 +27,7 @@ public class MainSettings { | |||||||
|     public MainSettings() { |     public MainSettings() { | ||||||
|         stations = new ArrayList<>(); |         stations = new ArrayList<>(); | ||||||
|         stations.add(new StationSettings("Station 1")); |         stations.add(new StationSettings("Station 1")); | ||||||
|  |         messageGenerationAttempts = 5; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static Path getSettingsFilePath() { |     public static Path getSettingsFilePath() { | ||||||
| @@ -47,6 +48,14 @@ public class MainSettings { | |||||||
|         return stations; |         return stations; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public int getMessageGenerationAttempts() { | ||||||
|  |         return messageGenerationAttempts; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setMessageGenerationAttempts(int messageGenerationAttempts) { | ||||||
|  |         this.messageGenerationAttempts = messageGenerationAttempts; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public String getUsername() { |     public String getUsername() { | ||||||
|         return username; |         return username; | ||||||
|     } |     } | ||||||
| @@ -55,14 +64,6 @@ public class MainSettings { | |||||||
|         this.username = username; |         this.username = username; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public int getRefreshInterval() { |  | ||||||
|         return refreshInterval; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setRefreshInterval(int refreshInterval) { |  | ||||||
|         this.refreshInterval = refreshInterval; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public String getSelectedStationName() { |     public String getSelectedStationName() { | ||||||
|         return selectedStationName; |         return selectedStationName; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,10 +1,15 @@ | |||||||
| package name.nathanmcrae.numbersstation; | package name.nathanmcrae.numbersstation; | ||||||
|  |  | ||||||
|  | import java.io.IOException; | ||||||
|  | import java.util.logging.Logger; | ||||||
|  | import java.util.logging.Level; | ||||||
| import java.util.Optional; | 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; | ||||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||||
|  | import javafx.scene.control.Alert; | ||||||
|  | import javafx.scene.control.ButtonType; | ||||||
| import javafx.scene.control.ListCell; | import javafx.scene.control.ListCell; | ||||||
| import javafx.scene.control.ListView; | import javafx.scene.control.ListView; | ||||||
| import javafx.scene.control.TextInputDialog; | import javafx.scene.control.TextInputDialog; | ||||||
| @@ -14,6 +19,7 @@ import javafx.scene.Node; | |||||||
| import javafx.stage.Stage; | import javafx.stage.Stage; | ||||||
|  |  | ||||||
| public class StationSelectionController { | public class StationSelectionController { | ||||||
|  |     private static final Logger logger = Logger.getLogger(Main.class.getName()); | ||||||
|  |  | ||||||
|     private MainSettings settings; |     private MainSettings settings; | ||||||
|  |  | ||||||
| @@ -58,6 +64,26 @@ public class StationSelectionController { | |||||||
|  |  | ||||||
|         Optional<String> result = dialog.showAndWait(); |         Optional<String> result = dialog.showAndWait(); | ||||||
|         result.ifPresent(stationName -> { |         result.ifPresent(stationName -> { | ||||||
|  |             if (stationName == null || stationName.equals("")) { | ||||||
|  |                 Alert alert = new Alert(Alert.AlertType.WARNING); | ||||||
|  |                 alert.setTitle("Invalid station name"); | ||||||
|  |                 alert.setHeaderText(null); | ||||||
|  |                 alert.setContentText("Station name must not be empty"); | ||||||
|  |                 alert.showAndWait(); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             for (StationSettings station : stationList) { | ||||||
|  |                 if (stationName.toLowerCase().equals(station.getName().toLowerCase())) { | ||||||
|  |                     Alert alert = new Alert(Alert.AlertType.WARNING); | ||||||
|  |                     alert.setTitle("Invalid station name"); | ||||||
|  |                     alert.setHeaderText(null); | ||||||
|  |                     alert.setContentText("Station name '" + stationName + "' is already used."); | ||||||
|  |                     alert.showAndWait(); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|             StationSettings newStation = new StationSettings(stationName); |             StationSettings newStation = new StationSettings(stationName); | ||||||
|             stationList.add(newStation); |             stationList.add(newStation); | ||||||
|         }); |         }); | ||||||
| @@ -73,7 +99,16 @@ public class StationSelectionController { | |||||||
|     @FXML |     @FXML | ||||||
|     private void handleRemoveButtonPress(ActionEvent event) { |     private void handleRemoveButtonPress(ActionEvent event) { | ||||||
|         int selectedIndex = stationListView.getSelectionModel().getSelectedIndex(); |         int selectedIndex = stationListView.getSelectionModel().getSelectedIndex(); | ||||||
|         if (selectedIndex >= 0) { |         StationSettings station = stationList.get(selectedIndex); | ||||||
|  |         String stationName = station.toString(); | ||||||
|  |  | ||||||
|  |         String message = "Delete station '" + stationName + "'? All data will be erased."; | ||||||
|  |         Alert alert = new Alert(Alert.AlertType.CONFIRMATION, message, ButtonType.YES, ButtonType.NO); | ||||||
|  |         alert.setTitle("Delete station?"); | ||||||
|  |         alert.setHeaderText(null); | ||||||
|  |         alert.showAndWait(); | ||||||
|  |  | ||||||
|  |         if (selectedIndex >= 0 && alert.getResult() == ButtonType.YES) { | ||||||
|             stationList.remove(selectedIndex); |             stationList.remove(selectedIndex); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -101,6 +136,18 @@ public class StationSelectionController { | |||||||
|             if (change.wasRemoved()) { |             if (change.wasRemoved()) { | ||||||
|                 for (StationSettings removedStation : change.getRemoved()) { |                 for (StationSettings removedStation : change.getRemoved()) { | ||||||
|                     System.out.println("Removed: " + removedStation.getName()); |                     System.out.println("Removed: " + removedStation.getName()); | ||||||
|  |  | ||||||
|  |                     try { | ||||||
|  |                         removedStation.deleteDir(); | ||||||
|  |                     } catch (IOException e) { | ||||||
|  |                         logger.log(Level.SEVERE, "Exception when removing station directory", e); | ||||||
|  |                         Alert alert = new Alert(Alert.AlertType.ERROR); | ||||||
|  |                         alert.setTitle("Error removing station"); | ||||||
|  |                         alert.setHeaderText(null); | ||||||
|  |                         alert.setContentText("Exception when removing station directory: " + e.getMessage()); | ||||||
|  |                         alert.showAndWait(); | ||||||
|  |                         return; | ||||||
|  |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -1,15 +1,23 @@ | |||||||
| package name.nathanmcrae.numbersstation; | package name.nathanmcrae.numbersstation; | ||||||
|  |  | ||||||
|  | import java.io.IOException; | ||||||
| import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||||
|  | import java.nio.file.attribute.BasicFileAttributes; | ||||||
|  | import java.nio.file.Files; | ||||||
|  | import java.nio.file.FileVisitResult; | ||||||
| import java.nio.file.Path; | import java.nio.file.Path; | ||||||
| import java.nio.file.Paths; | import java.nio.file.Paths; | ||||||
|  | import java.nio.file.SimpleFileVisitor; | ||||||
| import java.security.SecureRandom; | import java.security.SecureRandom; | ||||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||||
| import java.time.LocalTime; | import java.time.LocalTime; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
|  | import java.util.logging.Logger; | ||||||
| import java.util.Random; | import java.util.Random; | ||||||
|  |  | ||||||
| public class StationSettings { | public class StationSettings { | ||||||
|  |     private static final Logger logger = Logger.getLogger(Main.class.getName()); | ||||||
|  |  | ||||||
|     private String address; |     private String address; | ||||||
|     private int digitsPerGroup; |     private int digitsPerGroup; | ||||||
|     private String externalProgramCommand; |     private String externalProgramCommand; | ||||||
| @@ -57,6 +65,22 @@ public class StationSettings { | |||||||
|         scheduleStartTime = LocalTime.now(); |         scheduleStartTime = LocalTime.now(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public void deleteDir() throws IOException { | ||||||
|  |         Files.walkFileTree(stationPath(), new SimpleFileVisitor<Path>() { | ||||||
|  |             @Override | ||||||
|  |             public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { | ||||||
|  |                 Files.delete(file); | ||||||
|  |                 return FileVisitResult.CONTINUE; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             @Override | ||||||
|  |             public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { | ||||||
|  |                 Files.delete(dir); | ||||||
|  |                 return FileVisitResult.CONTINUE; | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public Path stationPath() { |     public Path stationPath() { | ||||||
|         String configHome = System.getenv("XDG_CONFIG_HOME"); |         String configHome = System.getenv("XDG_CONFIG_HOME"); | ||||||
|         Path directoryPath; |         Path directoryPath; | ||||||
| @@ -76,18 +100,51 @@ public class StationSettings { | |||||||
|         return directoryPath.resolve(stationDirName); |         return directoryPath.resolve(stationDirName); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public String generateMessage() { |     public String generateMessage(int generationAttempts) throws MessageGenerationException { | ||||||
|         SecureRandom random = new SecureRandom(); |         SecureRandom random = new SecureRandom(); | ||||||
|         StringBuilder messageBuilder = new StringBuilder(); |         StringBuilder messageBuilder = new StringBuilder(); | ||||||
|  |  | ||||||
|         for (int i = 0; i < messageLength; i++) { |         int attemptsLeft = generationAttempts; | ||||||
|             if (i > 0 && i % digitsPerGroup == 0) { |         boolean noPrefixCollisions = false; | ||||||
|                 messageBuilder.append(" "); |  | ||||||
|  |         while (!noPrefixCollisions) { | ||||||
|  |             messageBuilder = new StringBuilder(); | ||||||
|  |  | ||||||
|  |             for (int i = 0; i < messageLength; i++) { | ||||||
|  |                 messageBuilder.append(random.nextInt(10)); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             String message = messageBuilder.toString(); | ||||||
|  |  | ||||||
|  |             boolean prefixCollision = false; | ||||||
|  |  | ||||||
|  |             for (String prefix : prefixes) { | ||||||
|  |                 if (message.startsWith(prefix)) { | ||||||
|  |                     prefixCollision = true; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             if (!prefixCollision) { | ||||||
|  |                 noPrefixCollisions = true; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             attemptsLeft--; | ||||||
|  |             if (prefixCollision && attemptsLeft <= 0) { | ||||||
|  |                 throw new MessageGenerationException("Failed " + generationAttempts + " attempts to generate message without matching prefixes. Ensure prefixes are valid."); | ||||||
|             } |             } | ||||||
|             messageBuilder.append(random.nextInt(10)); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return messageBuilder.toString(); |         String messageNoSpaces = messageBuilder.toString(); | ||||||
|  |         StringBuilder messageFormattedBuilder = new StringBuilder(); | ||||||
|  |  | ||||||
|  |         for (int i = 0; i < messageNoSpaces.length(); i++) { | ||||||
|  |             if (i > 0 && i % digitsPerGroup == 0) { | ||||||
|  |                 messageFormattedBuilder.append(" "); | ||||||
|  |             } | ||||||
|  |             messageFormattedBuilder.append(messageNoSpaces.charAt(i)); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return messageFormattedBuilder.toString(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public String getAddress() { |     public String getAddress() { | ||||||
| @@ -197,4 +254,10 @@ public class StationSettings { | |||||||
|     public String toString() { |     public String toString() { | ||||||
|         return name; |         return name; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public class MessageGenerationException extends Exception { | ||||||
|  |         public MessageGenerationException(String message) { | ||||||
|  |             super(message); | ||||||
|  |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -10,9 +10,13 @@ import com.tearsofaunicorn.wordpress.api.model.Post; | |||||||
| import com.tearsofaunicorn.wordpress.api.WordpressClient; | import com.tearsofaunicorn.wordpress.api.WordpressClient; | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
|  | import java.nio.file.Files; | ||||||
|  | import java.nio.file.Path; | ||||||
| import java.time.format.DateTimeFormatter; | import java.time.format.DateTimeFormatter; | ||||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||||
| import java.time.LocalTime; | import java.time.LocalTime; | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.List; | ||||||
| import java.util.logging.Level; | import java.util.logging.Level; | ||||||
| import java.util.logging.Logger; | import java.util.logging.Logger; | ||||||
| import java.util.Optional; | import java.util.Optional; | ||||||
| @@ -30,6 +34,7 @@ import javafx.collections.ObservableList; | |||||||
| import javafx.event.Event; | import javafx.event.Event; | ||||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||||
|  | import javafx.scene.control.Alert; | ||||||
| import javafx.scene.control.Button; | import javafx.scene.control.Button; | ||||||
| import javafx.scene.control.CheckBox; | import javafx.scene.control.CheckBox; | ||||||
| import javafx.scene.control.DatePicker; | import javafx.scene.control.DatePicker; | ||||||
| @@ -74,6 +79,8 @@ public class StationSettingsController { | |||||||
|     private StringProperty scheduleStartTime = new SimpleStringProperty(); |     private StringProperty scheduleStartTime = new SimpleStringProperty(); | ||||||
|     private StringProperty username = new SimpleStringProperty(); |     private StringProperty username = new SimpleStringProperty(); | ||||||
|  |  | ||||||
|  |     private ArrayList<String> stationNames = new ArrayList<String>(); | ||||||
|  |  | ||||||
|     @FXML |     @FXML | ||||||
|     private Label connectionTestStatusLabel; |     private Label connectionTestStatusLabel; | ||||||
|  |  | ||||||
| @@ -390,6 +397,29 @@ public class StationSettingsController { | |||||||
|  |  | ||||||
|     @FXML |     @FXML | ||||||
|     private void handleSaveButtonPress(Event e) { |     private void handleSaveButtonPress(Event e) { | ||||||
|  |         if (stationName.get() == null || stationName.get().equals("")) { | ||||||
|  |             Alert alert = new Alert(Alert.AlertType.WARNING); | ||||||
|  |             alert.setTitle("Invalid station name"); | ||||||
|  |             alert.setHeaderText(null); | ||||||
|  |             alert.setContentText("Station name must not be empty"); | ||||||
|  |             alert.showAndWait(); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!stationName.get().toLowerCase().equals(settings.getName().toLowerCase())) { | ||||||
|  |             for (String otherStationName : stationNames) { | ||||||
|  |                 if (stationName.get().toLowerCase().equals(otherStationName.toLowerCase())) { | ||||||
|  |                     Alert alert = new Alert(Alert.AlertType.WARNING); | ||||||
|  |                     alert.setTitle("Invalid station name"); | ||||||
|  |                     alert.setHeaderText(null); | ||||||
|  |                     alert.setContentText("Station name '" + stationName.get() + "' is already used."); | ||||||
|  |                     alert.showAndWait(); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         Path oldDirectory = settings.stationPath(); | ||||||
|         settings.setAddress(stationAddress.get()); |         settings.setAddress(stationAddress.get()); | ||||||
|         settings.setDigitsPerGroup(digitsPerGroup.get()); |         settings.setDigitsPerGroup(digitsPerGroup.get()); | ||||||
|         settings.setExternalProgramCommand(externalProgramCommand.get()); |         settings.setExternalProgramCommand(externalProgramCommand.get()); | ||||||
| @@ -404,6 +434,14 @@ public class StationSettingsController { | |||||||
|         settings.setScheduleStartDate(scheduleStartDatePicker.getValue()); |         settings.setScheduleStartDate(scheduleStartDatePicker.getValue()); | ||||||
|         settings.setUsername(username.get()); |         settings.setUsername(username.get()); | ||||||
|  |  | ||||||
|  |         try { | ||||||
|  |             if (!oldDirectory.toString().equals(settings.stationPath().toString())) { | ||||||
|  |                 Files.move(oldDirectory, settings.stationPath()); | ||||||
|  |             } | ||||||
|  |         } catch (IOException ex) { | ||||||
|  |             logger.log(Level.SEVERE, "Failed to move directory", ex); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         try { |         try { | ||||||
|             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); |             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); | ||||||
|             LocalTime startTime = LocalTime.parse(scheduleStartTimeField.getText(), formatter); |             LocalTime startTime = LocalTime.parse(scheduleStartTimeField.getText(), formatter); | ||||||
| @@ -419,6 +457,7 @@ public class StationSettingsController { | |||||||
|             logger.log(Level.SEVERE, "Unsupported OS " + osName); |             logger.log(Level.SEVERE, "Unsupported OS " + osName); | ||||||
|         } else { |         } else { | ||||||
|             logger.log(Level.SEVERE, "Unsupported OS " + osName); |             logger.log(Level.SEVERE, "Unsupported OS " + osName); | ||||||
|  |             // TODO: Alert | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         Node node = (Node) e.getSource(); |         Node node = (Node) e.getSource(); | ||||||
| @@ -483,6 +522,11 @@ public class StationSettingsController { | |||||||
|         return stationAddress; |         return stationAddress; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public void setStationNameList(List<String> newStationNames) { | ||||||
|  |         stationNames.clear(); | ||||||
|  |         stationNames.addAll(newStationNames); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public void setStationSettings(StationSettings newSettings) { |     public void setStationSettings(StationSettings newSettings) { | ||||||
|         settings = newSettings; |         settings = newSettings; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user