Adding refresh button to select server dialog

This commit is contained in:
dcollin 2015-11-17 15:05:48 +01:00
parent 9caad6b714
commit 825eb124cb
3 changed files with 22 additions and 1 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
# Eclipse project files and folders # Eclipse project files and folders
bin/* bin/*
/bin/

View file

@ -22,7 +22,14 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<HBox alignment="CENTER_LEFT" prefWidth="200.0" /> <HBox prefWidth="200.0">
<children>
<Button fx:id="refreshButton" mnemonicParsing="false" onAction="#refresh" text="Refresh">
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</Button>
</children></HBox>
<HBox alignment="TOP_RIGHT" prefWidth="200.0" GridPane.columnIndex="1"> <HBox alignment="TOP_RIGHT" prefWidth="200.0" GridPane.columnIndex="1">
<children> <children>
<Button fx:id="exitButton" mnemonicParsing="false" onAction="#exit" text="Exit"> <Button fx:id="exitButton" mnemonicParsing="false" onAction="#exit" text="Exit">

View file

@ -44,6 +44,7 @@ public class SelectServerDialog extends GuiWindow {
@FXML private Button exitButton; @FXML private Button exitButton;
@FXML private Button connectButton; @FXML private Button connectButton;
@FXML private Label errorLabel; @FXML private Label errorLabel;
@FXML private Button refreshButton;
public SelectServerDialog(final CoderClient client) throws IOException { public SelectServerDialog(final CoderClient client) throws IOException {
super(SelectServerDialog.class.getResource("SelectServerDialog.fxml")); super(SelectServerDialog.class.getResource("SelectServerDialog.fxml"));
@ -171,6 +172,12 @@ public class SelectServerDialog extends GuiWindow {
}else if(event.getCode() == KeyCode.ESCAPE){ }else if(event.getCode() == KeyCode.ESCAPE){
logger.fine("User pressed the ESCAPE key"); logger.fine("User pressed the ESCAPE key");
exitButton.fire(); exitButton.fire();
}else if(event.getCode() == KeyCode.F5){
logger.fine("User pressed the F5 key");
refreshButton.fire();
}else if(event.getCode() == KeyCode.R && event.isControlDown()){
logger.fine("User pressed the CTRL+R key");
refreshButton.fire();
} }
} }
@ -179,6 +186,12 @@ public class SelectServerDialog extends GuiWindow {
logger.fine("exit button triggered"); logger.fine("exit button triggered");
client.exit(); client.exit();
} }
@FXML
protected void refresh(ActionEvent event){
logger.fine("refresh button triggered");
client.getSSDPHandler().requestService("coder:discover");
}
@FXML @FXML
protected void connect(ActionEvent event){ protected void connect(ActionEvent event){