Compare commits
6 Commits
4444b82edc
...
6ab5e5d1ca
Author | SHA1 | Date | |
---|---|---|---|
6ab5e5d1ca | |||
e21c078e4c | |||
9a49ea572a | |||
7a6e250804 | |||
b434a52fa2 | |||
9f59fc813f |
@ -1,6 +1,6 @@
|
||||
$Env:JAVA_HOME = "C:\Users\nathanm\Downloads\openjdk-23.0.1_windows-x64_bin\jdk-23.0.1"
|
||||
$Env:PATH = "C:\Users\nathanm\Downloads\openjdk-23.0.1_windows-x64_bin\jdk-23.0.1\bin;$($Env:PATH)"
|
||||
$Env:PATH_TO_FX="C:\Users\nathanm\Downloads\openjfx-23.0.1_windows-x64_bin-sdk\javafx-sdk-23.0.1\lib"
|
||||
javac --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml .\name\nathanmcrae\*.java -d out
|
||||
cp name/nathanmcrae/*.fxml out/name/nathanmcrae
|
||||
java --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml -cp out name.nathanmcrae.NumbersStation
|
||||
javac --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml .\name\nathanmcrae\numbersstation\*.java -d out
|
||||
cp name/nathanmcrae/numbersstation/*.fxml out/name/nathanmcrae/numbersstation
|
||||
java --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml -cp out name.nathanmcrae.numbersstation.Main
|
||||
|
@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.Spinner?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.FlowPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane prefHeight="700.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.NumbersStationSettingsController">
|
||||
<children>
|
||||
<ScrollPane fitToWidth="true" hbarPolicy="NEVER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="297.0" prefWidth="600.0" AnchorPane.bottomAnchor="40.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<content>
|
||||
<VBox prefHeight="551.0" prefWidth="585.0">
|
||||
<children>
|
||||
<FlowPane alignment="CENTER_LEFT" prefHeight="41.0" prefWidth="640.0">
|
||||
<children>
|
||||
<Label prefHeight="17.0" prefWidth="49.0" text="Station: " />
|
||||
<TextField fx:id="stationNameField" editable="false" style="-fx-background-color: #EEEEEE; -fx-border-color: #AAAAAA;" text="My Station">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</TextField>
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</FlowPane>
|
||||
<Separator prefWidth="200.0" />
|
||||
<AnchorPane prefHeight="120.0" prefWidth="578.0">
|
||||
<children>
|
||||
<FlowPane alignment="CENTER_LEFT" layoutX="8.0" layoutY="7.0" prefHeight="63.0" prefWidth="216.0">
|
||||
<children>
|
||||
<Label prefHeight="38.0" prefWidth="103.0" text="Digit group size: (only for display)" textAlignment="RIGHT" textOverrun="CLIP" wrapText="true">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Label>
|
||||
<Spinner editable="true" prefHeight="25.0" prefWidth="96.0" />
|
||||
</children>
|
||||
</FlowPane>
|
||||
<FlowPane alignment="CENTER_LEFT" layoutX="7.0" layoutY="69.0" prefHeight="63.0" prefWidth="219.0">
|
||||
<children>
|
||||
<Label prefHeight="38.0" prefWidth="103.0" text="Groups in line: (only for display)" textAlignment="RIGHT" textOverrun="CLIP" wrapText="true">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Label>
|
||||
<Spinner editable="true" prefHeight="25.0" prefWidth="96.0" />
|
||||
</children>
|
||||
</FlowPane>
|
||||
<FlowPane alignment="CENTER_LEFT" layoutX="233.0" layoutY="7.0" prefHeight="63.0" prefWidth="216.0">
|
||||
<children>
|
||||
<Label prefHeight="38.0" prefWidth="109.0" text="Message length:" textAlignment="RIGHT" textOverrun="CLIP">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Label>
|
||||
<Spinner editable="true" prefHeight="25.0" prefWidth="96.0" />
|
||||
</children>
|
||||
</FlowPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<Separator prefWidth="200.0" />
|
||||
<AnchorPane prefHeight="147.0" prefWidth="578.0">
|
||||
<children>
|
||||
<Label layoutY="6.0" text="Send messages via:">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="170.0" layoutY="16.0" text="Numbers station address:" />
|
||||
<TextField fx:id="stationAddressField" layoutX="180.0" layoutY="40.0" prefHeight="25.0" prefWidth="390.0" AnchorPane.leftAnchor="188.0" AnchorPane.rightAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<Separator prefWidth="200.0" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<FlowPane alignment="CENTER_RIGHT" prefHeight="40.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" onMousePressed="#handleSaveButtonPress" text="Save" textAlignment="RIGHT">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" text="Cancel">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
</Button>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets right="10.0" />
|
||||
</padding>
|
||||
</FlowPane>
|
||||
</children>
|
||||
</AnchorPane>
|
@ -1,47 +0,0 @@
|
||||
package name.nathanmcrae;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
public class NumbersStationSettingsController {
|
||||
private NumbersStationSettings settings;
|
||||
private StringProperty stationNameAndAddress = new SimpleStringProperty();
|
||||
|
||||
@FXML
|
||||
private TextField stationNameField;
|
||||
|
||||
@FXML
|
||||
private TextField stationAddressField;
|
||||
|
||||
public NumbersStationSettingsController() throws IOException {
|
||||
System.out.println("Created settings controller");
|
||||
File file = new File("setting-test.xml");
|
||||
XmlMapper xmlMapper = new XmlMapper();
|
||||
settings = xmlMapper.readValue(file, NumbersStationSettings.class);
|
||||
settings.setRefreshInterval(settings.getRefreshInterval() + 40);
|
||||
settings.getStations().add(new StationSettings());
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void initialize() {
|
||||
stationNameField.textProperty().bindBidirectional(stationNameAndAddress);
|
||||
stationAddressField.textProperty().bindBidirectional(stationNameAndAddress);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleSaveButtonPress() throws IOException {
|
||||
XmlMapper xmlMapper = new XmlMapper();
|
||||
xmlMapper.writeValue(new File("setting-test.xml"), settings);
|
||||
}
|
||||
|
||||
public StringProperty stationNameAndAddressProperty() {
|
||||
return stationNameAndAddress;
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package name.nathanmcrae;
|
||||
|
||||
public class StationSettings {
|
||||
private String name;
|
||||
private int digitsPerGroup;
|
||||
private int messageLength;
|
||||
|
||||
public StationSettings() { }
|
||||
|
||||
public StationSettings(String newName) {
|
||||
name = newName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String newName) {
|
||||
name = newName;
|
||||
}
|
||||
|
||||
public int getDigitsPerGroup() {
|
||||
return digitsPerGroup;
|
||||
}
|
||||
|
||||
public void setDigitsPerGroup(int newDigitsPerGroup) {
|
||||
digitsPerGroup = newDigitsPerGroup;
|
||||
}
|
||||
|
||||
public int getMessageLength() {
|
||||
return messageLength;
|
||||
}
|
||||
|
||||
public void setMessageLength(int newMessageLength) {
|
||||
messageLength = newMessageLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package name.nathanmcrae;
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
@ -6,10 +6,10 @@ import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class NumbersStation extends Application {
|
||||
public class Main extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
Parent root = FXMLLoader.load(getClass().getResource("NumbersStation.fxml"));
|
||||
Parent root = FXMLLoader.load(getClass().getResource("MainView.fxml"));
|
||||
primaryStage.setTitle("Numbers Station");
|
||||
primaryStage.setScene(new Scene(root));
|
||||
primaryStage.show();
|
@ -1,4 +1,4 @@
|
||||
package name.nathanmcrae;
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.io.File;
|
||||
@ -23,10 +23,10 @@ import javafx.scene.Scene;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class NumbersStationController implements Initializable {
|
||||
public class MainController implements Initializable {
|
||||
private Stage settingsStage;
|
||||
private Stage selectStationStage;
|
||||
private NumbersStationSettings settings;
|
||||
private MainSettings settings;
|
||||
private StationSettings selectedStation;
|
||||
|
||||
private StringProperty selectedStationName = new SimpleStringProperty();
|
||||
@ -47,12 +47,20 @@ public class NumbersStationController implements Initializable {
|
||||
|
||||
if (settingsStage == null || !settingsStage.isShowing()) {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("NumbersStationSettings.fxml"));
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainSettingsView.fxml"));
|
||||
Parent root = fxmlLoader.load();
|
||||
|
||||
MainSettingsController controller = fxmlLoader.getController();
|
||||
controller.setStationSettings(selectedStation);
|
||||
|
||||
settingsStage = new Stage();
|
||||
settingsStage.initModality(Modality.APPLICATION_MODAL);
|
||||
settingsStage.setTitle("Numbers Station Settings");
|
||||
settingsStage.setScene(new Scene(root));
|
||||
settingsStage.show();
|
||||
settingsStage.setOnHiding(event -> {
|
||||
settings.save();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -65,11 +73,11 @@ public class NumbersStationController implements Initializable {
|
||||
private void handleSelectStationButtonPress() {
|
||||
if (selectStationStage == null || !selectStationStage.isShowing()) {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("NumbersStationSelection.fxml"));
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("StationSelectionView.fxml"));
|
||||
Parent root = fxmlLoader.load();
|
||||
|
||||
// Pass settings to the controller
|
||||
NumbersStationSelectionController controller = fxmlLoader.getController();
|
||||
StationSelectionController controller = fxmlLoader.getController();
|
||||
controller.setSettings(settings);
|
||||
|
||||
selectStationStage = new Stage();
|
||||
@ -79,16 +87,18 @@ public class NumbersStationController implements Initializable {
|
||||
selectStationStage.setScene(new Scene(root));
|
||||
selectStationStage.show();
|
||||
selectStationStage.setOnHiding(event -> {
|
||||
selectedStationName.set((String) selectStationStage.getUserData());
|
||||
if (selectedStation != null) {
|
||||
selectedStation = settings.getStations().stream()
|
||||
.filter(station -> station.getName().equals(selectedStationName.get()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
settings.setSelectedStationName(selectedStationName.get());
|
||||
String newStationName = (String)selectStationStage.getUserData();
|
||||
StationSettings newSelectedStation = settings.getStations().stream()
|
||||
.filter(station -> station.getName().equals(newStationName))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (newSelectedStation != null) {
|
||||
selectedStation = newSelectedStation;
|
||||
selectedStationName.set(newStationName);
|
||||
settings.setSelectedStationName(selectedStationName.get());
|
||||
|
||||
settings.save();
|
||||
settings.save();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -111,11 +121,11 @@ public class NumbersStationController implements Initializable {
|
||||
}
|
||||
|
||||
if (!Files.exists(filePath)) {
|
||||
settings = new NumbersStationSettings();
|
||||
settings = new MainSettings();
|
||||
|
||||
xmlMapper.writeValue(new File(filePath.toString()), settings);
|
||||
} else {
|
||||
settings = xmlMapper.readValue(new File(filePath.toString()), NumbersStationSettings.class);
|
||||
settings = xmlMapper.readValue(new File(filePath.toString()), MainSettings.class);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Print the contents of filePath
|
@ -1,4 +1,4 @@
|
||||
package name.nathanmcrae;
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.io.File;
|
||||
@ -8,7 +8,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class NumbersStationSettings {
|
||||
public class MainSettings {
|
||||
private int digitsPerGroup;
|
||||
private String username;
|
||||
private int refreshInterval;
|
||||
@ -16,7 +16,7 @@ public class NumbersStationSettings {
|
||||
|
||||
private ArrayList<StationSettings> stations;
|
||||
|
||||
public NumbersStationSettings() {
|
||||
public MainSettings() {
|
||||
stations = new ArrayList<>();
|
||||
stations.add(new StationSettings("Station 1"));
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.event.Event;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.Spinner;
|
||||
import javafx.scene.control.SpinnerValueFactory;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.Node;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class MainSettingsController {
|
||||
private IntegerProperty digitsPerGroup = new SimpleIntegerProperty();
|
||||
private StringProperty externalProgramCommand = new SimpleStringProperty();
|
||||
private IntegerProperty messageLength = new SimpleIntegerProperty();
|
||||
private ObjectProperty<StationSettings.MessageMethod> messageMethod = new SimpleObjectProperty<>();
|
||||
private StringProperty password = new SimpleStringProperty();
|
||||
private StationSettings settings;
|
||||
private StringProperty stationAddress = new SimpleStringProperty();
|
||||
private StringProperty stationName = new SimpleStringProperty();
|
||||
private StringProperty username = new SimpleStringProperty();
|
||||
|
||||
@FXML
|
||||
private TextField stationNameField;
|
||||
|
||||
@FXML
|
||||
private TextField stationAddressField;
|
||||
|
||||
@FXML
|
||||
private Spinner<Integer> digitsPerGroupSpinner;
|
||||
|
||||
@FXML
|
||||
private TextField externalProgramCommandField;
|
||||
|
||||
@FXML
|
||||
private Spinner<Integer> messageLengthSpinner;
|
||||
|
||||
@FXML
|
||||
private ToggleGroup messageMethodGroup;
|
||||
|
||||
@FXML
|
||||
private RadioButton ftpRadioButton;
|
||||
|
||||
@FXML
|
||||
private RadioButton sftpRadioButton;
|
||||
|
||||
@FXML
|
||||
private RadioButton scpRadioButton;
|
||||
|
||||
@FXML
|
||||
private RadioButton externalProgramRadioButton;
|
||||
|
||||
@FXML
|
||||
private TextField usernameField;
|
||||
|
||||
@FXML
|
||||
private TextField passwordField;
|
||||
|
||||
public MainSettingsController() throws IOException {
|
||||
// System.out.println("Created settings controller");
|
||||
// File file = new File("setting-test.xml");
|
||||
// XmlMapper xmlMapper = new XmlMapper();
|
||||
// settings = xmlMapper.readValue(file, NumbersStationSettings.class);
|
||||
// settings.setRefreshInterval(settings.getRefreshInterval() + 40);
|
||||
// settings.getStations().add(new StationSettings());
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void initialize() {
|
||||
externalProgramCommandField.textProperty().bindBidirectional(externalProgramCommand);
|
||||
stationNameField.textProperty().bindBidirectional(stationName);
|
||||
stationAddressField.textProperty().bindBidirectional(stationAddress);
|
||||
passwordField.textProperty().bindBidirectional(password);
|
||||
usernameField.textProperty().bindBidirectional(username);
|
||||
|
||||
digitsPerGroupSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 100, 1));
|
||||
messageLengthSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 1000, 1));
|
||||
|
||||
digitsPerGroupSpinner.getValueFactory().valueProperty().bindBidirectional(digitsPerGroup.asObject());
|
||||
messageLengthSpinner.getValueFactory().valueProperty().bindBidirectional(messageLength.asObject());
|
||||
|
||||
messageMethodGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue == ftpRadioButton) {
|
||||
messageMethod.set(StationSettings.MessageMethod.FTP);
|
||||
} else if (newValue == sftpRadioButton) {
|
||||
messageMethod.set(StationSettings.MessageMethod.SFTP);
|
||||
} else if (newValue == scpRadioButton) {
|
||||
messageMethod.set(StationSettings.MessageMethod.SCP);
|
||||
} else if (newValue == externalProgramRadioButton) {
|
||||
messageMethod.set(StationSettings.MessageMethod.EXTERNAL_PROGRAM);
|
||||
}
|
||||
});
|
||||
|
||||
messageMethod.addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue == StationSettings.MessageMethod.FTP) {
|
||||
messageMethodGroup.selectToggle(ftpRadioButton);
|
||||
} else if (newValue == StationSettings.MessageMethod.SFTP) {
|
||||
messageMethodGroup.selectToggle(sftpRadioButton);
|
||||
} else if (newValue == StationSettings.MessageMethod.SCP) {
|
||||
messageMethodGroup.selectToggle(scpRadioButton);
|
||||
} else if (newValue == StationSettings.MessageMethod.EXTERNAL_PROGRAM) {
|
||||
messageMethodGroup.selectToggle(externalProgramRadioButton);
|
||||
}
|
||||
});
|
||||
|
||||
// Set user data. Default result is no update.
|
||||
stationNameField.sceneProperty().addListener((observable, oldScene, newScene) -> {
|
||||
if (newScene != null) {
|
||||
Stage stage = (Stage) newScene.getWindow();
|
||||
stage.setUserData(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleAddPrefixButtonPress() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleCancelButtonPress(Event e) {
|
||||
Node node = (Node) e.getSource();
|
||||
Stage stage = (Stage) node.getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleRemovePrefixButtonPress() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleSaveButtonPress(Event e) {
|
||||
settings.setAddress(stationAddress.get());
|
||||
settings.setDigitsPerGroup(digitsPerGroup.get());
|
||||
settings.setExternalProgramCommand(externalProgramCommand.get());
|
||||
settings.setMessageLength(messageLength.get());
|
||||
settings.setMessageMethod(messageMethod.get());
|
||||
settings.setName(stationName.get());
|
||||
settings.setPassword(password.get());
|
||||
settings.setUsername(username.get());
|
||||
|
||||
Node node = (Node) e.getSource();
|
||||
Stage stage = (Stage) node.getScene().getWindow();
|
||||
stage.setUserData(true);
|
||||
stage.close();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleTestConnectionButtonPress() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public StringProperty stationAddressProperty() {
|
||||
return stationAddress;
|
||||
}
|
||||
|
||||
public void setStationSettings(StationSettings newSettings) {
|
||||
settings = newSettings;
|
||||
|
||||
stationAddress.set(settings.getAddress());
|
||||
stationName.set(settings.getName());
|
||||
digitsPerGroup.set(settings.getDigitsPerGroup());
|
||||
externalProgramCommand.set(settings.getExternalProgramCommand());
|
||||
messageLength.set(settings.getMessageLength());
|
||||
messageMethod.set(settings.getMessageMethod());
|
||||
username.set(settings.getUsername());
|
||||
password.set(settings.getPassword());
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.DatePicker?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.PasswordField?>
|
||||
<?import javafx.scene.control.RadioButton?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.Spinner?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.ToggleGroup?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.FlowPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane prefHeight="700.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.numbersstation.MainSettingsController">
|
||||
<children>
|
||||
<ScrollPane fitToWidth="true" hbarPolicy="NEVER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="600.0" AnchorPane.bottomAnchor="40.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<content>
|
||||
<VBox prefHeight="679.0" prefWidth="598.0">
|
||||
<children>
|
||||
<FlowPane alignment="CENTER_LEFT" prefHeight="41.0" prefWidth="640.0">
|
||||
<children>
|
||||
<Label prefHeight="17.0" prefWidth="49.0" text="Station: " />
|
||||
<TextField fx:id="stationNameField" editable="false" style="-fx-background-color: #EEEEEE; -fx-border-color: #AAAAAA;" text="My Station">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</TextField>
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</FlowPane>
|
||||
<Separator prefWidth="200.0" />
|
||||
<AnchorPane prefHeight="77.0" prefWidth="578.0">
|
||||
<children>
|
||||
<FlowPane alignment="CENTER_LEFT" layoutX="8.0" layoutY="7.0" prefHeight="63.0" prefWidth="216.0">
|
||||
<children>
|
||||
<Label prefHeight="38.0" prefWidth="103.0" text="Digit group size: (only for display)" textAlignment="RIGHT" textOverrun="CLIP" wrapText="true">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Label>
|
||||
<Spinner fx:id="digitsPerGroupSpinner" editable="true" prefHeight="25.0" prefWidth="96.0" />
|
||||
</children>
|
||||
</FlowPane>
|
||||
<FlowPane alignment="CENTER_LEFT" layoutX="233.0" layoutY="7.0" prefHeight="63.0" prefWidth="216.0">
|
||||
<children>
|
||||
<Label prefHeight="38.0" prefWidth="109.0" text="Message length:" textAlignment="RIGHT" textOverrun="CLIP">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Label>
|
||||
<Spinner fx:id="messageLengthSpinner" editable="true" prefHeight="25.0" prefWidth="96.0" />
|
||||
</children>
|
||||
</FlowPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<Separator prefWidth="200.0" />
|
||||
<AnchorPane prefHeight="170.0" prefWidth="578.0">
|
||||
<children>
|
||||
<Label layoutY="6.0" text="Send messages via:">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="170.0" layoutY="9.0" text="Numbers station address:" />
|
||||
<TextField fx:id="stationAddressField" layoutX="188.0" layoutY="33.0" prefHeight="25.0" prefWidth="390.0" AnchorPane.leftAnchor="188.0" AnchorPane.rightAnchor="0.0" />
|
||||
<RadioButton fx:id="ftpRadioButton" layoutX="16.0" layoutY="44.0" mnemonicParsing="false" text="FTP">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="messageMethodGroup" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="sftpRadioButton" layoutX="16.0" layoutY="74.0" mnemonicParsing="false" text="SFTP">
|
||||
<toggleGroup>
|
||||
<fx:reference source="messageMethodGroup" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="scpRadioButton" layoutX="16.0" layoutY="104.0" mnemonicParsing="false" text="SCP">
|
||||
<toggleGroup>
|
||||
<fx:reference source="messageMethodGroup" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="externalProgramRadioButton" layoutX="16.0" layoutY="134.0" mnemonicParsing="false" text="External program:">
|
||||
<toggleGroup>
|
||||
<fx:reference source="messageMethodGroup" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<Label layoutX="380.0" layoutY="69.0" text="Username:" AnchorPane.rightAnchor="142.0" />
|
||||
<Label layoutX="380.0" layoutY="99.0" text="Password:" AnchorPane.rightAnchor="142.0" />
|
||||
<TextField fx:id="usernameField" layoutX="444.0" layoutY="65.0" prefHeight="25.0" prefWidth="135.0" AnchorPane.rightAnchor="0.0" />
|
||||
<PasswordField fx:id="passwordField" layoutX="444.0" layoutY="95.0" prefHeight="25.0" prefWidth="135.0" AnchorPane.rightAnchor="0.0" />
|
||||
<TextField fx:id="externalProgramCommandField" layoutX="140.0" layoutY="131.0" prefHeight="25.0" prefWidth="438.0" AnchorPane.leftAnchor="140.0" AnchorPane.rightAnchor="0.0" />
|
||||
<Button layoutX="188.0" layoutY="65.0" mnemonicParsing="false" onMousePressed="#handleTestConnectionButtonPress" text="Test connection" />
|
||||
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</AnchorPane>
|
||||
<Separator prefWidth="200.0" />
|
||||
<AnchorPane prefHeight="33.0" prefWidth="578.0">
|
||||
<children>
|
||||
<Label layoutX="8.0" layoutY="6.0" text="Prefixes" AnchorPane.leftAnchor="8.0">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Button layoutX="520.5" layoutY="4.0" mnemonicParsing="false" onMousePressed="#handleAddPrefixButtonPress" text="+" AnchorPane.rightAnchor="33.0" />
|
||||
<Button layoutX="552.0" layoutY="4.0" mnemonicParsing="false" onMousePressed="#handleRemovePrefixButtonPress" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="1.0" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</AnchorPane>
|
||||
<ListView prefHeight="103.0" prefWidth="578.0" />
|
||||
<Separator prefWidth="200.0">
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</Separator>
|
||||
<Label text="Message Schedule">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<AnchorPane prefHeight="152.0" prefWidth="578.0">
|
||||
<children>
|
||||
<CheckBox layoutX="395.0" mnemonicParsing="false" text="Manage schedule externally" AnchorPane.rightAnchor="14.5" />
|
||||
<RadioButton layoutX="14.0" layoutY="8.0" mnemonicParsing="false" text="Daily">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="scheduleFrequency" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton layoutX="14.0" layoutY="38.0" mnemonicParsing="false" text="Weekly" toggleGroup="$scheduleFrequency" />
|
||||
<RadioButton layoutX="14.0" layoutY="68.0" mnemonicParsing="false" text="Monthly" toggleGroup="$scheduleFrequency" />
|
||||
<DatePicker layoutX="115.0" layoutY="34.0" />
|
||||
<Label layoutX="115.0" layoutY="8.0" text="Starting from:" />
|
||||
<TextField layoutX="115.0" layoutY="64.0" text="23:24:49" />
|
||||
<Label layoutX="48.0" layoutY="102.0" text="TODO: Jitter" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<FlowPane alignment="CENTER_RIGHT" prefHeight="40.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" onMousePressed="#handleSaveButtonPress" text="Save" textAlignment="RIGHT">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" onMousePressed="#handleCancelButtonPress" text="Cancel">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
</Button>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets right="10.0" />
|
||||
</padding>
|
||||
</FlowPane>
|
||||
</children>
|
||||
</AnchorPane>
|
@ -43,7 +43,7 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.NumbersStationController">
|
||||
<AnchorPane xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.numbersstation.MainController">
|
||||
<children>
|
||||
<VBox maxHeight="1.7976931348623157E308" minWidth="400.0" prefHeight="400.0" prefWidth="640.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
@ -1,4 +1,4 @@
|
||||
package name.nathanmcrae;
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.FXCollections;
|
||||
@ -13,16 +13,16 @@ import javafx.scene.Node;
|
||||
import javafx.stage.Stage;
|
||||
import java.util.Optional;
|
||||
|
||||
public class NumbersStationSelectionController {
|
||||
public class StationSelectionController {
|
||||
|
||||
private NumbersStationSettings settings;
|
||||
private MainSettings settings;
|
||||
|
||||
@FXML
|
||||
private ListView<StationSettings> stationListView;
|
||||
|
||||
private ObservableList<StationSettings> stationList;
|
||||
|
||||
public NumbersStationSelectionController() {
|
||||
public StationSelectionController() {
|
||||
// Initialize the list with an empty list
|
||||
stationList = FXCollections.observableArrayList();
|
||||
// Add listener to the stationList
|
||||
@ -45,7 +45,7 @@ public class NumbersStationSelectionController {
|
||||
});
|
||||
}
|
||||
|
||||
public void setSettings(NumbersStationSettings newSettings) {
|
||||
public void setSettings(MainSettings newSettings) {
|
||||
settings = newSettings;
|
||||
stationList.addAll(settings.getStations());
|
||||
stationListView.setItems(stationList);
|
@ -6,7 +6,7 @@
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="437.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.NumbersStationSelectionController">
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="437.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.numbersstation.StationSelectionController">
|
||||
<children>
|
||||
<Label layoutX="14.0" layoutY="14.0" text="Numbers Stations">
|
||||
<font>
|
@ -0,0 +1,94 @@
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
public class StationSettings {
|
||||
private String address;
|
||||
private int digitsPerGroup;
|
||||
private String externalProgramCommand;
|
||||
private int messageLength;
|
||||
private MessageMethod messageMethod;
|
||||
private String name;
|
||||
private String password;
|
||||
private String username;
|
||||
|
||||
public enum MessageMethod {
|
||||
FTP,
|
||||
SFTP,
|
||||
SCP,
|
||||
EXTERNAL_PROGRAM
|
||||
}
|
||||
|
||||
public StationSettings() { }
|
||||
|
||||
public StationSettings(String newName) {
|
||||
name = newName;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String newAddress) {
|
||||
address = newAddress;
|
||||
}
|
||||
|
||||
public int getDigitsPerGroup() {
|
||||
return digitsPerGroup;
|
||||
}
|
||||
|
||||
public void setDigitsPerGroup(int newDigitsPerGroup) {
|
||||
digitsPerGroup = newDigitsPerGroup;
|
||||
}
|
||||
|
||||
public String getExternalProgramCommand() {
|
||||
return externalProgramCommand;
|
||||
}
|
||||
|
||||
public void setExternalProgramCommand(String newExternalProgramCommand) {
|
||||
externalProgramCommand = newExternalProgramCommand;
|
||||
}
|
||||
|
||||
public int getMessageLength() {
|
||||
return messageLength;
|
||||
}
|
||||
|
||||
public void setMessageLength(int newMessageLength) {
|
||||
messageLength = newMessageLength;
|
||||
}
|
||||
|
||||
public MessageMethod getMessageMethod() {
|
||||
return messageMethod;
|
||||
}
|
||||
|
||||
public void setMessageMethod(MessageMethod newMessageMethod) {
|
||||
messageMethod = newMessageMethod;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String newName) {
|
||||
name = newName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String newPassword) {
|
||||
password = newPassword;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String newUsername) {
|
||||
username = newUsername;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user