/** Mets l'UI en état de chargement. */ private void nowLoading() { notGood.setDisable(true); good.setDisable(true); text.setDisable(true); text.setText(""); progress.setProgress(-1); }
private void hideSendMsgInfo(Timer timer) { timer.stop(); inputTextArea.setDisable(false); FxTimer.runLater( Duration.ofMillis(5000), () -> { sendMsgInfoLabel.setVisible(false); sendMsgInfoLabel.setManaged(false); }); sendMsgProgressIndicator.setProgress(0); sendMsgProgressIndicator.setVisible(false); sendMsgProgressIndicator.setManaged(false); }
private void onSendMessage(String inputText, Dispute dispute) { DisputeDirectMessage disputeDirectMessage = disputeManager.sendDisputeDirectMessage( dispute, inputText, new ArrayList<>(tempAttachments)); tempAttachments.clear(); scrollToBottom(); inputTextArea.setDisable(true); inputTextArea.clear(); final Timer timer = FxTimer.runLater( Duration.ofMillis(500), () -> { sendMsgInfoLabel.setVisible(true); sendMsgInfoLabel.setManaged(true); sendMsgInfoLabel.setText("Sending Message..."); sendMsgProgressIndicator.setProgress(-1); sendMsgProgressIndicator.setVisible(true); sendMsgProgressIndicator.setManaged(true); }); disputeDirectMessage .arrivedProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue) { hideSendMsgInfo(timer); } }); disputeDirectMessage .storedInMailboxProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue) { sendMsgInfoLabel.setVisible(true); sendMsgInfoLabel.setManaged(true); sendMsgInfoLabel.setText( "Receiver is not online. Message is saved to his mailbox."); hideSendMsgInfo(timer); } }); }
/** Mets l'UI en état chargé. */ private void nowLoaded() { notGood.setDisable(false); good.setDisable(false); text.setDisable(false); progress.setProgress(1); }