List of usage examples for javafx.application Platform runLater
public static void runLater(Runnable runnable)
From source file:org.wandora.application.gui.topicpanels.webview.WebViewPanel.java
private void forwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_forwardButtonActionPerformed if (webEngine != null) { Platform.runLater(new Runnable() { @Override/*from w w w . j a va 2s . c o m*/ public void run() { webEngine.executeScript("history.forward()"); } }); } }
From source file:de.unibw.inf2.fishification.FishWorld.java
public boolean addFishEntity(final FishEntity fishEntity) { // Required for backend thread calls Platform.runLater(new Runnable() { @Override// w ww . j a v a 2 s. com public void run() { getEntityManager().addEntity(fishEntity); // Remove buttons getButtonManager().removeCategoryButtons(); // Create buttons getButtonManager().initCategoryButtons(); } }); // Increase fish counter m_fishCounter++; return true; }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.java
void animateTo(double xLeft, double yTop) { if (timeline != null) { timeline.stop();//from w w w. ja va 2 s.c o m Platform.runLater(this::requestChartLayout); } timeline = new Timeline(new KeyFrame(Duration.millis(100), new KeyValue(layoutXProperty(), xLeft), new KeyValue(layoutYProperty(), yTop))); timeline.setOnFinished(finished -> Platform.runLater(this::requestChartLayout)); timeline.play(); }
From source file:com.github.drbookings.ui.controller.MainController.java
@FXML private void handleButtonSelectLastMonth(final ActionEvent event) { Platform.runLater(() -> selectLastMonthFX()); }
From source file:com.github.drbookings.ui.controller.MainController.java
@FXML private void handleButtonSelectLastThreeMonth(final ActionEvent event) { Platform.runLater(() -> selectLastThreeMonthFX()); }
From source file:org.beryx.viewreka.fxapp.Viewreka.java
private void updateProjectTabs(ProjectSettings projectSettings) { if (selectedIndexListener != null) { projectTabPane.getSelectionModel().selectedIndexProperty().removeListener(selectedIndexListener); }//ww w.j a v a2 s . c o m menuTabBindingSourceCode.setSettings(projectSettings, true); menuTabBindingHelp.setSettings(projectSettings, false); if (projectSettings != null) { selectedIndexListener = (obs, oldValue, newValue) -> projectSettings .setProperty(PROP_SELECTED_TAB_INDEX, newValue); projectTabPane.getSelectionModel().selectedIndexProperty().addListener(selectedIndexListener); selectedItemListener = (obs, oldTab, newTab) -> { butSaveFile.disableProperty().unbind(); mnuSaveFile.disableProperty().unbind(); butSaveFile.setDisable(true); mnuSaveFile.setDisable(true); if (newTab != null) { CodeTabData tabData = getData(newTab); Platform.runLater(() -> { BooleanBinding scriptChangedBinding = Bindings.createBooleanBinding( () -> !tabData.isDirty(), tabData.getTextProperty(), tabData.getInitialTextProperty()); butSaveFile.disableProperty().bind(scriptChangedBinding); mnuSaveFile.disableProperty().bind(scriptChangedBinding); StringBinding tabTextBinding = Bindings.createStringBinding(() -> { String text = tabData.getTabText(); if (tabData.isDirty()) { text = "*" + text; } return text; }, tabData.getTextProperty(), tabData.getInitialTextProperty()); newTab.textProperty().bind(tabTextBinding); }); } Platform.runLater(() -> { menuTabBindingSourceCode.setSettings(projectSettings, true); menuTabBindingHelp.setSettings(projectSettings, false); butSaveAll.disableProperty().unbind(); mnuSaveAll.disableProperty().unbind(); butSaveAll.setDisable(true); mnuSaveAll.setDisable(true); List<BooleanBinding> saveBindings = new ArrayList<>(); projectTabPane.getTabs().forEach(tab -> { CodeTabData tabData = getData(tab); saveBindings.add(Bindings.createBooleanBinding(() -> !tabData.isDirty(), tabData.getTextProperty(), tabData.getInitialTextProperty())); }); if (!saveBindings.isEmpty()) { BooleanBinding binding = saveBindings.get(0); for (int i = 1; i < saveBindings.size(); i++) { binding = Bindings.and(binding, saveBindings.get(i)); } mnuSaveAll.disableProperty().bind(binding); butSaveAll.disableProperty().bind(binding); } }); }; projectTabPane.getSelectionModel().selectedItemProperty().addListener(selectedItemListener); } int selectedTabIndex = (projectSettings == null) ? 0 : projectSettings.getProperty(PROP_SELECTED_TAB_INDEX, 0, false); ObservableList<Tab> tabs = projectTabPane.getTabs(); tabs.clear(); Tab selectedTab = null; List<String> openFiles = getOpenFiles(projectSettings); for (int i = 0; i < openFiles.size(); i++) { String filePath = openFiles.get(i); Tab addedTab = null; if (filePath.equals(FILE_ALIAS_SOURCE_CODE)) { addedTab = tabSourceCode; String projectPath = projectPathProperty.get(); String tabText = (projectPath == null) ? "Code" : new File(projectPath).getName(); tabSourceCode.setUserData(new CodeTabData(tabText)); } else if (filePath.equals(FILE_ALIAS_HELP)) { addedTab = tabHelp; } else { try { File file = new File(filePath); addedTab = CodeAreaTab.fromFile(file); final Tab tab = addedTab; tab.setOnCloseRequest(ev -> { if (!tryClose(tab)) ev.consume(); }); } catch (Exception e) { addedTab = null; } } if (addedTab != null) { tabs.add(addedTab); getData(addedTab).setFilePath(filePath); if (i == selectedTabIndex) { selectedTab = addedTab; } } } if (!tabs.isEmpty()) { if (selectedTab == null) { selectedTab = tabs.get(0); } projectTabPane.getSelectionModel().select(null); projectTabPane.getSelectionModel().select(selectedTab); } }
From source file:com.github.drbookings.ui.controller.MainController.java
@FXML private void handleMenuItemAbout(final ActionEvent event) { Platform.runLater(() -> showAbout()); }
From source file:org.jevis.jeconfig.plugin.classes.ClassTree.java
private void deteleItemFromTree(final TreeItem<JEVisClass> item) { try {/*w w w . j a v a 2 s. co m*/ Platform.runLater(new Runnable() { @Override public void run() { try { String className = item.getValue().getName(); _itemCache.remove(className); for (Map.Entry<TreeItem<JEVisClass>, ObservableList<TreeItem<JEVisClass>>> entry : _itemChildren .entrySet()) { if (entry.getValue().contains(item)) { entry.getValue().remove(item); } } getSelectionModel().select(item.getParent()); if (_graphicCache.containsKey(className)) { _graphicCache.remove(className); } // parentItem.setExpanded(false); } catch (JEVisException ex) { Logger.getLogger(ClassTree.class.getName()).log(Level.SEVERE, null, ex); } } }); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:com.github.drbookings.ui.controller.MainController.java
@FXML private void handleMenuItemBookingDetails(final ActionEvent event) { Platform.runLater(this::showBookingDetails); }
From source file:genrsa.GenRSAController.java
/** * Initializes the controller class./*w ww . j a v a 2s . c o m*/ */ @FXML // This method is called by the FXMLLoader when initialization is complete void initialize() { assert genManBttn != null : "fx:id=\"genManBttn\" was not injected: check your FXML file 'genRSA.fxml'."; assert primo_P != null : "fx:id=\"primo_P\" was not injected: check your FXML file 'genRSA.fxml'."; assert bits_primo_P != null : "fx:id=\"bits_primo_P\" was not injected: check your FXML file 'genRSA.fxml'."; assert cBoxP != null : "fx:id=\"cBoxP\" was not injected: check your FXML file 'genRSA.fxml'."; assert primo_Q != null : "fx:id=\"primo_Q\" was not injected: check your FXML file 'genRSA.fxml'."; assert bits_primo_Q != null : "fx:id=\"bits_primo_Q\" was not injected: check your FXML file 'genRSA.fxml'."; assert cBoxQ != null : "fx:id=\"cBoxQ\" was not injected: check your FXML file 'genRSA.fxml'."; assert phiN != null : "fx:id=\"phiN\" was not injected: check your FXML file 'genRSA.fxml'."; assert bits_phiN != null : "fx:id=\"bits_phiN\" was not injected: check your FXML file 'genRSA.fxml'."; assert clave_Privada != null : "fx:id=\"clave_Privada\" was not injected: check your FXML file 'genRSA.fxml'."; assert bits_clave_Privada != null : "fx:id=\"bits_clave_Privada\" was not injected: check your FXML file 'genRSA.fxml'."; assert modulo_N != null : "fx:id=\"modulo_N\" was not injected: check your FXML file 'genRSA.fxml'."; assert bits_modulo_N != null : "fx:id=\"bits_modulo_N\" was not injected: check your FXML file 'genRSA.fxml'."; assert clave_Publica != null : "fx:id=\"clave_Publica\" was not injected: check your FXML file 'genRSA.fxml'."; assert bits_clave_Publica != null : "fx:id=\"bits_clave_Publica\" was not injected: check your FXML file 'genRSA.fxml'."; assert num_claves_parejas != null : "fx:id=\"num_claves_parejas\" was not injected: check your FXML file 'genRSA.fxml'."; assert claves_parejas != null : "fx:id=\"claves_parejas\" was not injected: check your FXML file 'genRSA.fxml'."; assert iteraciones_primalidad != null : "fx:id=\"iteraciones_primalidad\" was not injected: check your FXML file 'genRSA.fxml'."; assert isPrime_P != null : "fx:id=\"esPrimo_P\" was not injected: check your FXML file 'genRSA.fxml'."; assert isPrime_Q != null : "fx:id=\"esPrimo_Q\" was not injected: check your FXML file 'genRSA.fxml'."; assert tiempo_primalidad != null : "fx:id=\"tiempo_primalidad\" was not injected: check your FXML file 'genRSA.fxml'."; assert bits_clave_automatica != null : "fx:id=\"bits_clave_automatica\" was not injected: check your FXML file 'genRSA.fxml'."; assert tiempo_clave_automatica != null : "fx:id=\"tiempo_clave_automatica\" was not injected: check your FXML file 'genRSA.fxml'."; assert securePrimes != null : "fx:id=\"securePrimes\" was not injected: check your FXML file 'genRSA.fxml'."; assert sameSizePrimes != null : "fx:id=\"sameSizePrimes\" was not injected: check your FXML file 'genRSA.fxml'."; assert tipicalPubKey != null : "fx:id=\"tipicalPubKey\" was not injected: check your FXML file 'genRSA.fxml'."; assert cantidadNNC != null : "fx:id=\"cantidadNNC\" was not injected: check your FXML file 'genRSA.fxml'."; assert progressNNC != null : "fx:id=\"progressNNC\" was not injected: check your FXML file 'genRSA.fxml'."; assert progress != null : "fx:id=\"progress\" was not injected: check your FXML file 'genRSA.fxml'."; assert unitsP != null : "fx:id=\"unitsP\" was not injected: check your FXML file 'genRSA.fxml'."; assert unitsQ != null : "fx:id=\"unitsQ\" was not injected: check your FXML file 'genRSA.fxml'."; assert unitsPhiN != null : "fx:id=\"unitsPhiN\" was not injected: check your FXML file 'genRSA.fxml'."; assert unitsD != null : "fx:id=\"unitsD\" was not injected: check your FXML file 'genRSA.fxml'."; assert unitsN != null : "fx:id=\"unitsN\" was not injected: check your FXML file 'genRSA.fxml'."; assert unitsE != null : "fx:id=\"unitsE\" was not injected: check your FXML file 'genRSA.fxml'."; assert logNNCbttn != null : "fx:id=\"logNNCbttn\" was not injected: check your FXML file 'genRSA.fxml'."; assert saveKeyMenuI != null : "fx:id=\"saveKeyMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert DeCipherMenuI != null : "fx:id=\"DeCipherMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert SignMenuI != null : "fx:id=\"SignMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert openKeyMenuI != null : "fx:id=\"openKeyMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert manualMenuI != null : "fx:id=\"manualMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert millerMenuI != null : "fx:id=\"millerMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert fermatMenuI != null : "fx:id=\"fermatMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert paradoxMenuI != null : "fx:id=\"paradoxMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert cyclicMenuI != null : "fx:id=\"cyclicMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert factorizeMenuI != null : "fx:id=\"factorizeMenuI\" was not injected: check your FXML file 'genRSA.fxml'."; assert Decimal != null : "fx:id=\"Decimal\" was not injected: check your FXML file 'genRSA.fxml'."; assert Hexadecimal != null : "fx:id=\"Hexadecimal\" was not injected: check your FXML file 'genRSA.fxml'."; assert limpiarDatosBttn != null : "fx:id=\"limpiarDatosBttn\" was not injected: check your FXML file 'genRSA.fxml'."; assert limpiarDatos1Bttn != null : "fx:id=\"limpiarDatos1Bttn\" was not injected: check your FXML file 'genRSA.fxml'."; assert autoGenerarBttn != null : "fx:id=\"autoGenerarBttn\" was not injected: check your FXML file 'genRSA.fxml'."; assert deleteKeyMenu != null : "fx:id=\"deleteKeyMenu\" was not injected: check your FXML file 'genRSA.fxml'."; assert autoGenerarMenu != null : "fx:id=\"autoGenerarMenu\" was not injected: check your FXML file 'genRSA.fxml'."; isPrime_P.setImage(new Image(GenRSAController.class.getResourceAsStream("/allImages/interrogation.png"))); isPrime_Q.setImage(new Image(GenRSAController.class.getResourceAsStream("/allImages/interrogation.png"))); radix = 10; initCboxes = new InitCBox(); initCboxes.initCboxDec(cBoxP, cBoxQ); generate = new GenerateKeys(this); mainWindow = new MainWindow(this); checkPrimes = new CheckPrimes(this); manageKey = new ManageKey(); utilidades = new Utilities(); startLogNNC = true; startGenKey = true; this.disableButtons(); this.configureFocus(); //para poner el foco en originalData Platform.runLater(bits_clave_automatica::requestFocus); }