add get file request in client
This commit is contained in:
parent
7712419544
commit
c0591d87e4
@ -51,6 +51,21 @@ public class Connector {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void getFileList() {
|
||||
try {
|
||||
DataOutputStream outputStream = new DataOutputStream(this.client.getOutputStream());
|
||||
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
|
||||
BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
|
||||
|
||||
bufferedWriter.write("GET_ALL_FILES");
|
||||
bufferedWriter.flush();
|
||||
|
||||
this.getMessage();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConnect() {
|
||||
return this.isConnect;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import javafx.scene.control.TextField;
|
||||
|
||||
public class MainPageController {
|
||||
public Button connectButton = null;
|
||||
public Button getFileListButton = null;
|
||||
public TextField rawFieldWithIp = null;
|
||||
public Label messageLabel = null;
|
||||
private Connector connector = Connector.getInstance();
|
||||
@ -30,5 +31,11 @@ public class MainPageController {
|
||||
|
||||
this.messageLabel.setText(this.connector.isConnect() ? "Connected" : "Not connect");
|
||||
this.connectButton.setText("Connect");
|
||||
this.getFileListButton.setDisable(false);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void getFileList(Event e) {
|
||||
this.connector.getFileList();
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
<TextField fx:id="rawFieldWithIp" layoutX="239.0" layoutY="82.0" promptText="Insert ip" />
|
||||
<Button fx:id="connectButton" layoutX="290.0" layoutY="122.0" mnemonicParsing="false" onAction="#connectToServer" text="Connect" />
|
||||
<Label fx:id="messageLabel" alignment="CENTER" contentDisplay="CENTER" layoutX="15.0" layoutY="14.0" prefHeight="18.0" prefWidth="608.0" />
|
||||
<Button fx:id="getFileListButton" disable="true" layoutX="283.0" layoutY="166.0" mnemonicParsing="false" onAction="#getFileList" text="Get file list" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
|
Loading…
Reference in New Issue
Block a user