Compare commits

...

3 Commits

Author SHA1 Message Date
97c3cc3243 Show notification for error while running station 2025-02-22 19:29:10 -08:00
18b3e5d0d9 Fix argument quoting in run.sh 2025-02-22 19:21:22 -08:00
917be83ddc Change all buttons to use onAction
Covers more activation cases. I initially tried to use onAction, but
that didn't seem to work at the time, but I must've been mistaken.
2025-02-22 18:51:21 -08:00
6 changed files with 24 additions and 24 deletions

2
run.sh
View File

@ -6,4 +6,4 @@ PATH_TO_FX=/home/nathanmcrae/Downloads/javafx-sdk-23.0.2/lib/
MODULE_PATH=$PATH_TO_FX:$(dirname "$0")/lib MODULE_PATH=$PATH_TO_FX:$(dirname "$0")/lib
MODULES=com.ctc.wstx,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml,com.fasterxml.jackson.datatype.jsr310,com.jcraft.jsch,javafx.controls,javafx.fxml,org.apache.commons.cli,result,wordpress.xmlrpc.client MODULES=com.ctc.wstx,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml,com.fasterxml.jackson.datatype.jsr310,com.jcraft.jsch,javafx.controls,javafx.fxml,org.apache.commons.cli,result,wordpress.xmlrpc.client
java --module-path $MODULE_PATH --add-modules $MODULES -cp out name.nathanmcrae.numbersstation.Main $@ java --module-path $MODULE_PATH --add-modules $MODULES -cp out name.nathanmcrae.numbersstation.Main "$@"

View File

@ -153,9 +153,9 @@ public class Main extends Application {
Result<MainSettings, Exception> result = MainSettings.load(); Result<MainSettings, Exception> result = MainSettings.load();
if (!result.hasSuccess()) { if (!result.hasSuccess()) {
logger.log(Level.SEVERE, "Unable to load settings"); String message = "Unable to load settings";
// TODO: Notification logger.log(Level.SEVERE, message);
System.exit(1); throw new StationRunException(message);
} }
MainSettings settings = result.getSuccess().get(); MainSettings settings = result.getSuccess().get();
@ -205,17 +205,17 @@ public class Main extends Application {
String newPostId = client.newPost(post); String newPostId = client.newPost(post);
break; break;
default: default:
logger.log(Level.SEVERE, "Message method " + loadedStation.getMessageMethod() + " not supported"); String message = "Message method " + loadedStation.getMessageMethod() + " not supported";
// TODO: Notification logger.log(Level.SEVERE, message);
System.exit(1); throw new StationRunException(message);
} }
String newMessageText = loadedStation.generateMessage(settings.getMessageGenerationAttempts()); String newMessageText = loadedStation.generateMessage(settings.getMessageGenerationAttempts());
Files.write(nextMessagePath, newMessageText.getBytes(StandardCharsets.UTF_8)); Files.write(nextMessagePath, newMessageText.getBytes(StandardCharsets.UTF_8));
} catch (IOException | StationSettings.MessageGenerationException e) { } catch (Exception e) {
logger.log(Level.SEVERE, "Exception while posting message to station " + parsedArgs.getStationName(), e); String message = "Exception while posting message to station " + parsedArgs.getStationName();
// TODO: Notification logger.log(Level.SEVERE, message, e);
System.exit(1); throw new StationRunException(message);
} }
System.exit(0); System.exit(0);

View File

@ -74,7 +74,7 @@
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Button layoutX="534.0" layoutY="13.0" mnemonicParsing="false" onMouseClicked="#handleStationSettingsButtonPress" text="Station Settings" AnchorPane.rightAnchor="6.5" AnchorPane.topAnchor="13.0" /> <Button layoutX="534.0" layoutY="13.0" mnemonicParsing="false" onAction="#handleStationSettingsButtonPress" text="Station Settings" AnchorPane.rightAnchor="6.5" AnchorPane.topAnchor="13.0" />
</children> </children>
</AnchorPane> </AnchorPane>
<SplitPane fx:id="splitPane" dividerPositions="1.0" prefHeight="272.0" prefWidth="640.0"> <SplitPane fx:id="splitPane" dividerPositions="1.0" prefHeight="272.0" prefWidth="640.0">
@ -98,7 +98,7 @@
</VBox> </VBox>
<FlowPane alignment="CENTER_RIGHT" prefHeight="34.0" prefWidth="620.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"> <FlowPane alignment="CENTER_RIGHT" prefHeight="34.0" prefWidth="620.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<children> <children>
<Button mnemonicParsing="false" onMousePressed="#handleSetAsNextMessageButtonPress" text="Set as next message" /> <Button mnemonicParsing="false" onAction="#handleSetAsNextMessageButtonPress" text="Set as next message" />
</children> </children>
</FlowPane> </FlowPane>
</children> </children>

View File

@ -45,8 +45,8 @@
<Font name="Liberation Sans Bold" size="16.0" /> <Font name="Liberation Sans Bold" size="16.0" />
</font> </font>
</Label> </Label>
<Button fx:id="dismissButton" layoutX="325.0" layoutY="139.0" mnemonicParsing="false" onMousePressed="#handleDismissButtonPressed" text="Dismiss" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" /> <Button fx:id="dismissButton" layoutX="325.0" layoutY="139.0" mnemonicParsing="false" onAction="#handleDismissButtonPressed" text="Dismiss" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" />
<Button fx:id="openButton" layoutX="270.0" layoutY="139.0" mnemonicParsing="false" onMousePressed="#handleOpenButtonPressed" text="Open" visible="false" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="79.5" /> <Button fx:id="openButton" layoutX="270.0" layoutY="139.0" mnemonicParsing="false" onAction="#handleOpenButtonPressed" text="Open" visible="false" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="79.5" />
<Label fx:id="iconLabel" alignment="CENTER" contentDisplay="CENTER" layoutX="14.0" layoutY="5.0" prefHeight="60.0" prefWidth="65.0" text="⚠" textAlignment="CENTER" textFill="RED"> <Label fx:id="iconLabel" alignment="CENTER" contentDisplay="CENTER" layoutX="14.0" layoutY="5.0" prefHeight="60.0" prefWidth="65.0" text="⚠" textAlignment="CENTER" textFill="RED">
<font> <font>
<Font size="42.0" /> <Font size="42.0" />

View File

@ -16,7 +16,7 @@
<Button layoutX="358.0" layoutY="17.0" mnemonicParsing="false" onAction="#handleAddButtonPress" prefHeight="25.0" prefWidth="26.0" text="+" AnchorPane.rightAnchor="55.0" AnchorPane.topAnchor="17.0" /> <Button layoutX="358.0" layoutY="17.0" mnemonicParsing="false" onAction="#handleAddButtonPress" prefHeight="25.0" prefWidth="26.0" text="+" AnchorPane.rightAnchor="55.0" AnchorPane.topAnchor="17.0" />
<Button layoutX="391.0" layoutY="17.0" mnemonicParsing="false" onAction="#handleRemoveButtonPress" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="21.0" AnchorPane.topAnchor="17.0" /> <Button layoutX="391.0" layoutY="17.0" mnemonicParsing="false" onAction="#handleRemoveButtonPress" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="21.0" AnchorPane.topAnchor="17.0" />
<ListView fx:id="stationListView" layoutX="14.0" layoutY="57.0" prefHeight="301.0" prefWidth="409.0" AnchorPane.bottomAnchor="42.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="57.0" /> <ListView fx:id="stationListView" layoutX="14.0" layoutY="57.0" prefHeight="301.0" prefWidth="409.0" AnchorPane.bottomAnchor="42.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="57.0" />
<Button layoutX="313.0" layoutY="365.0" mnemonicParsing="false" onMousePressed="#handleSelectButtonPress" text="Select" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="76.5" /> <Button layoutX="313.0" layoutY="365.0" mnemonicParsing="false" onAction="#handleSelectButtonPress" text="Select" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="76.5" />
<Button layoutX="370.0" layoutY="365.0" mnemonicParsing="false" onMousePressed="#handleCancelButtonPress" text="Cancel" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="15.5" /> <Button layoutX="370.0" layoutY="365.0" mnemonicParsing="false" onAction="#handleCancelButtonPress" text="Cancel" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="15.5" />
</children> </children>
</AnchorPane> </AnchorPane>

View File

@ -92,7 +92,7 @@
<TextField fx:id="usernameField" layoutX="245.0" layoutY="95.0" prefHeight="25.0" prefWidth="124.0" AnchorPane.rightAnchor="209.0" /> <TextField fx:id="usernameField" layoutX="245.0" layoutY="95.0" prefHeight="25.0" prefWidth="124.0" AnchorPane.rightAnchor="209.0" />
<PasswordField fx:id="passwordField" layoutX="444.0" layoutY="95.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="-2.0" layoutY="131.0" prefHeight="25.0" prefWidth="580.0" AnchorPane.leftAnchor="-2.0" AnchorPane.rightAnchor="0.0" /> <TextField fx:id="externalProgramCommandField" layoutX="-2.0" layoutY="131.0" prefHeight="25.0" prefWidth="580.0" AnchorPane.leftAnchor="-2.0" AnchorPane.rightAnchor="0.0" />
<Button fx:id="testConnectionButton" layoutX="464.0" layoutY="7.0" mnemonicParsing="false" onMousePressed="#handleTestConnectionButtonPress" text="Test connection" /> <Button fx:id="testConnectionButton" layoutX="464.0" layoutY="7.0" mnemonicParsing="false" onAction="#handleTestConnectionButtonPress" text="Test connection" />
<Label fx:id="connectionTestStatusLabel" layoutX="257.0" layoutY="11.0" prefHeight="17.0" prefWidth="196.0" AnchorPane.leftAnchor="257.0" AnchorPane.rightAnchor="125.0" /> <Label fx:id="connectionTestStatusLabel" layoutX="257.0" layoutY="11.0" prefHeight="17.0" prefWidth="196.0" AnchorPane.leftAnchor="257.0" AnchorPane.rightAnchor="125.0" />
</children> </children>
@ -108,8 +108,8 @@
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Button layoutX="520.5" layoutY="4.0" mnemonicParsing="false" onMousePressed="#handleAddPrefixButtonPress" text="+" AnchorPane.rightAnchor="33.0" /> <Button layoutX="520.5" layoutY="4.0" mnemonicParsing="false" onAction="#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" /> <Button layoutX="552.0" layoutY="4.0" mnemonicParsing="false" onAction="#handleRemovePrefixButtonPress" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="1.0" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets bottom="10.0" />
@ -148,8 +148,8 @@
<Label layoutX="115.0" layoutY="8.0" text="Starting from:" /> <Label layoutX="115.0" layoutY="8.0" text="Starting from:" />
<TextField fx:id="scheduleStartTimeField" disable="${manageScheduleExternallyCheckBox.selected}" layoutX="115.0" layoutY="64.0" text="23:24:49" /> <TextField fx:id="scheduleStartTimeField" disable="${manageScheduleExternallyCheckBox.selected}" layoutX="115.0" layoutY="64.0" text="23:24:49" />
<Label layoutX="48.0" layoutY="102.0" text="TODO: Jitter" /> <Label layoutX="48.0" layoutY="102.0" text="TODO: Jitter" />
<Button layoutX="377.0" layoutY="73.0" mnemonicParsing="false" onMousePressed="#handleTestRegisterScheduleButtonPress" text="Test register scheduled task" /> <Button layoutX="377.0" layoutY="73.0" mnemonicParsing="false" onAction="#handleTestRegisterScheduleButtonPress" text="Test register scheduled task" />
<Button layoutX="377.0" layoutY="107.0" mnemonicParsing="false" onMousePressed="#handleTestRunScheduleButtonPress" text="Test running scheduled task" /> <Button layoutX="377.0" layoutY="107.0" mnemonicParsing="false" onAction="#handleTestRunScheduleButtonPress" text="Test running scheduled task" />
</children> </children>
</AnchorPane> </AnchorPane>
@ -162,12 +162,12 @@
</ScrollPane> </ScrollPane>
<FlowPane alignment="CENTER_RIGHT" prefHeight="40.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"> <FlowPane alignment="CENTER_RIGHT" prefHeight="40.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<children> <children>
<Button mnemonicParsing="false" onMousePressed="#handleSaveButtonPress" text="Save" textAlignment="RIGHT"> <Button mnemonicParsing="false" onAction="#handleSaveButtonPress" text="Save" textAlignment="RIGHT">
<FlowPane.margin> <FlowPane.margin>
<Insets right="10.0" /> <Insets right="10.0" />
</FlowPane.margin> </FlowPane.margin>
</Button> </Button>
<Button mnemonicParsing="false" onMousePressed="#handleCancelButtonPress" text="Cancel"> <Button mnemonicParsing="false" onAction="#handleCancelButtonPress" text="Cancel">
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>