@Override public void clearLog() { runLater(outputMessages::clear); }
@Override public void clear(){ Platform.runLater(issues::clear); }
@Override public void post(Issue issue) { Platform.runLater( () -> { issues.add(issue); }); }
@Override public void log(Label line) { runLater(() -> outputMessages.add(line)); }
private void addToOutputMessages(Node node) { runLater(() -> outputMessages.add(node)); }
private void clear(Text text) { final List<Rectangle> rectangles = boxes.get(text); if(rectangles != null && !rectangles.isEmpty()) Platform.runLater(() -> getParentChildren(parent).removeAll(rectangles)); } }
/** * @param maximized */ public void setMaximized(boolean maximized) { if (this.maximized != maximized) { Platform.runLater(() -> { btnMax.fire(); }); } }
/** * This method is used to run a specified Runnable in the FX Application thread, * it returns before the task finished execution * * @param doRun This is the sepcifed task to be excuted by the FX Application thread * @return Nothing */ public static void runInFX(Runnable doRun) { if (Platform.isFxApplicationThread()) { doRun.run(); return; } Platform.runLater(doRun); }
/** * Executed when the user selects a node in a treeView or listView. * * @param isFromNameDecl Whether the node was selected in the scope hierarchy treeview */ public void onNodeItemSelected(Node selectedValue, boolean isFromNameDecl) { // doing that in parallel speeds it up Platform.runLater(() -> nodeInfoPanelController.setFocusNode(selectedValue, isFromNameDecl)); Platform.runLater(() -> sourceEditorController.setFocusNode(selectedValue)); }
@Override public void showNotification(String message, Icon icon, Palette palette, Runnable action) { runLater(() -> notifications.add(new NotificationImpl(message, icon, palette, action)) ); }
private void applySuggestion(int insertionIndex, String toReplace, String replacement) { myCodeArea.replaceText(insertionIndex, insertionIndex + toReplace.length(), replacement); Platform.runLater(autoCompletePopup::hide); }
@Override public void startEdit() { Platform.runLater(() -> { textField.selectAll(); textField.requestFocus(); }); }
@Override public void updateItem(T item, boolean empty) { Platform.runLater(() -> { textField.selectAll(); textField.requestFocus(); }); }
@Override public void initialize(URL location, ResourceBundle resources) { runLater(() -> prepareTree(ui.projectProperty())); }
public void enqueue(SnackbarEvent event) { synchronized (this) { if (!eventsSet.contains(event)) { eventsSet.add(event); eventQueue.offer(event); } else if (currentEvent == event && pauseTransition != null) { pauseTransition.playFromStart(); } } if (processingQueue.compareAndSet(false, true)) { Platform.runLater(() -> { currentEvent = eventQueue.poll(); if (currentEvent != null) { show(currentEvent); } }); } }
/** * Highlights the given node (or nothing if null). * Removes highlighting on the previously highlighted node. */ public void setFocusNode(Node node) { if (Objects.equals(node, currentFocusNode.getValue())) { return; } Platform.runLater(() -> focusNodeInTreeView(node)); codeEditorArea.styleNodes(node == null ? emptyList() : singleton(node), StyleLayerIds.FOCUS, true); if (node != null) { scrollEditorToNode(node); } currentFocusNode.setValue(node); }
@Override public Label createNode() { final Label label = new Label(""); events.on(BeforeGenerate.class, bg -> runLater(() -> label.setText("Generating..."))); events.on(FileGenerated.class, fg -> runLater(() -> label.setText(fg.meta().getModel().getName()))); events.on(AfterGenerate.class, ag -> runLater(() -> label.setText(""))); return label; }
public void show(Window window, double x, double y, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) { if (!isShowing()) { if (window == null) { throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); } Window parent = window; final double anchorX = parent.getX() + x + initOffsetX; final double anchorY = parent.getY() + y + initOffsetY; this.show(parent, anchorX, anchorY); ((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY); Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate()); } }
/** * Pops an edition dialog for the given descriptor spec. The dialog is cached and * reused, so that it's parsed a minimal amount of time. * * @param edited The edited property descriptor */ private void popEditPropertyDialog(PropertyDescriptorSpec edited) { Stage dialog = editPropertyDialogCache.getValue(); EditPropertyDialogController wizard = (EditPropertyDialogController) dialog.getUserData(); Platform.runLater(() -> wizard.bindToDescriptor(edited, getRuleProperties())); dialog.setOnHiding(e -> { edited.unbind(); onEditCommit.ifPresent(handler -> handler.accept(edited)); }); dialog.show(); }
@Override protected void beforeParentInit() { xpathAttributesListView.setPlaceholder(new Label("No available attributes")); EventStreams.valuesOf(scopeHierarchyTreeView.getSelectionModel().selectedItemProperty()) .filter(Objects::nonNull) .map(TreeItem::getValue) .filterMap(o -> o instanceof NameDeclaration, o -> (NameDeclaration) o) .filter(nd -> !Objects.equals(nd.getNode(), selectedNode)) .subscribe(declaration -> Platform.runLater(() -> parent.onNodeItemSelected(declaration.getNode(), true))); scopeHierarchyTreeView.setCellFactory(view -> new ScopeHierarchyTreeCell()); hideCommonAttributesProperty() .values() .distinct() .subscribe(show -> displayAttributes(selectedNode)); }