/** * set whether the control is editable * * @param b */ public void setEditable(boolean b) { if (control instanceof TextField) { textField.setEditable(b); } else { control.setDisable(!b); } }
/** * Sends a tweet using the {@link NewTweetService}. */ private CompletionStage<Void> sendTweet() { Stream.of(tweetTextArea, sendButton, pickMediaButton).forEach(ctr -> ctr.setDisable(true)); return newTweetService.sendTweet(tweetTextArea.getText(), mediasToUpload) .thenAcceptAsync(status -> { LOG.info("Tweeted status : {} [{}]", status.getId(), status.getText()); this.embeddingStage.getValue().hide(); }, Platform::runLater); }
/** * Sends a reply using the {@link NewTweetService}. */ private CompletionStage<Void> sendReply() { final long inReplyToId = inReplyStatus.getValue().getId(); Stream.of(tweetTextArea, sendButton, pickMediaButton).forEach(ctr -> ctr.setDisable(true)); return newTweetService.sendReply(tweetTextArea.getText(), mediasToUpload, inReplyToId) .thenAcceptAsync(status -> { LOG.info( "Tweeted reply to {} : {} [{}]", inReplyToId, status.getId(), status.getText() ); this.embeddingStage.getValue().hide(); }, Platform::runLater); }
public List<Node> createButtonList() { ArrayList<Node> result = new ArrayList<Node>(); for (final FormCreator form : childFormCreators) { Control createShowFormButton = form.createShowFormButton(); createShowFormButton.setDisable(!form.isEnabled()); createShowFormButton.setTooltip(form.getTooltip()); if (!form.isEnabled()) {/* * workaround disabled button must be wrapped in split pane to show tooltip * https://javafx-jira.kenai.com/browse/RT-28850 */ SplitPane wrapper = new SplitPane(); wrapper.getItems().add(createShowFormButton); createShowFormButton = wrapper; wrapper.setTooltip(form.getTooltip()); } result.add(createShowFormButton); } return result; }