List of usage examples for javafx.application Platform runLater
public static void runLater(Runnable runnable)
From source file:eu.ggnet.dwoss.redtape.document.DocumentUpdateView.java
private void addUnitAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addUnitAction if (unitInputField.getText().isEmpty()) return;/*w w w. j a v a2 s.co m*/ if (document.isClosed()) { JOptionPane.showMessageDialog(this, "Hinzufgen von Sopo Ware nicht erlaubt.", "Abgeschlossenes Dokument", JOptionPane.INFORMATION_MESSAGE); return; } for (String sopo : unitInputField.getText().trim().split("(\\s*,\\s*|\\s+)")) { if (StringUtils.isBlank(sopo)) continue; try { controller.addPosition(document.getDossier().getId(), PositionType.UNIT, sopo, false); } catch (Exception ex) { DwOssCore.show(SwingUtilities.getWindowAncestor(this), ex); } } Platform.runLater(new Runnable() { @Override public void run() { positions.clear(); positions.addAll(document.getPositions().values()); } }); unitInputField.setText(""); }
From source file:com.github.drbookings.ui.controller.MainController.java
private void setWorking(final boolean working, final boolean success) { Platform.runLater(() -> setWorkingFX(working, success)); }
From source file:acmi.l2.clientmod.l2smr.Controller.java
private void showUmodel(final String obj, final String file) { Platform.runLater(() -> { try {//from ww w . ja va 2s . c o m FXMLLoader loader = new FXMLLoader(getClass().getResource("smview/smview.fxml")); loader.load(); SMView controller = loader.getController(); controller.setStaticmesh(getStaticMeshDir(), file, obj); Scene scene = new Scene(loader.getRoot()); scene.setOnKeyReleased(controller::onKeyReleased); Stage smStage = new Stage(); smStage.setScene(scene); smStage.setTitle(obj); smStage.show(); smStage.setX(Double.parseDouble(L2smr.getPrefs().get("smview.x", String.valueOf(smStage.getX())))); smStage.setY(Double.parseDouble(L2smr.getPrefs().get("smview.y", String.valueOf(smStage.getY())))); smStage.setWidth(Double .parseDouble(L2smr.getPrefs().get("smview.width", String.valueOf(smStage.getWidth())))); smStage.setHeight(Double .parseDouble(L2smr.getPrefs().get("smview.height", String.valueOf(smStage.getHeight())))); InvalidationListener listener = observable -> { L2smr.getPrefs().put("smview.x", String.valueOf(Math.round(smStage.getX()))); L2smr.getPrefs().put("smview.y", String.valueOf(Math.round(smStage.getY()))); L2smr.getPrefs().put("smview.width", String.valueOf(Math.round(smStage.getWidth()))); L2smr.getPrefs().put("smview.height", String.valueOf(Math.round(smStage.getHeight()))); }; smStage.xProperty().addListener(listener); smStage.yProperty().addListener(listener); smStage.widthProperty().addListener(listener); smStage.heightProperty().addListener(listener); } catch (IOException e) { onException("Couldn't show staticmesh", e); } }); }
From source file:eu.ggnet.dwoss.redtape.document.DocumentUpdateView.java
private void addNonUnitPosition(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addNonUnitPosition PositionType type;//from ww w . ja va 2 s . c om if (((JButton) evt.getSource()) == addProductBatchButton) { type = PositionType.PRODUCT_BATCH; } else if (((JButton) evt.getSource()) == addServiceButton) { type = PositionType.SERVICE; } else if (((JButton) evt.getSource()) == addCommentButton) { type = PositionType.COMMENT; } else { type = PositionType.SHIPPING_COST; } try { controller.addPosition(document.getDossier().getId(), type, null, false); Platform.runLater(() -> { positions.clear(); positions.addAll(document.getPositions().values()); }); } catch (UserInfoException ex) { DwOssCore.show(SwingUtilities.getWindowAncestor(this), ex); } }
From source file:org.wandora.application.gui.topicpanels.webview.WebViewPanel.java
public void browse(final String url, boolean resetWebApp) { if (resetWebApp && url != null) { selectedWebApp = null;/*from w w w . java2 s. co m*/ WandoraModulesServer s = Wandora.getWandora().getHTTPServer(); for (ModulesWebApp webApp : s.getWebApps()) { if (url.equals(webApp.getAppStartPage())) { urlTextField.setBackground(WEBAPP_ACTIVE_COLOR); selectedWebApp = webApp; break; } } } if (selectedWebApp == null) { urlTextField.setBackground(WEBAPP_PASSIVE_COLOR); } Platform.runLater(new Runnable() { @Override public void run() { webEngine.load(url); } }); }
From source file:org.wandora.application.gui.topicpanels.webview.WebViewPanel.java
public void executeScript(final String script) { Platform.runLater(new Runnable() { @Override//w w w . j ava2 s . c om public void run() { webEngine.executeScript(script); } }); }
From source file:com.mycompany.trafficimportfileconverter2.Main2Controller.java
public void UI(Runnable f) { Platform.runLater(f); }
From source file:org.noroomattheinn.visibletesla.MainController.java
private void warnAboutNoCarAccess(final boolean mobileDisabled) { Platform.runLater(new Runnable() { @Override/*from ww w . j a v a2s . c om*/ public void run() { String message = "VisibleTesla is unable to access your car even though" + "the login succeeded.\n\n"; if (mobileDisabled) message = message + "Your Tesla has not been configured to allow mobile " + "access. You have to enable this on your car's touch" + "screen using Controls / Settings / Vehicle.\n\n"; message = message + "VisibleTesla will still launch, but will not" + "be able to control or monitor your car until access is restored."; Dialogs.showErrorDialog(app.stage, message, "Mobile access is not enabled", "Communication Problem"); } }); }
From source file:eu.ggnet.dwoss.redtape.document.DocumentUpdateView.java
private void removePositionAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removePositionAction final MultipleSelectionModel<Position> selection = positionsFxList.getSelectionModel(); final int index = selection.getSelectedIndex(); Position selectedItem = selection.getSelectedItem(); if (index == -1) return;//from w w w.j a va2 s. c om if (isChangeAllowed()) { document.removeAt(selectedItem.getId()); Platform.runLater(() -> { positions.clear(); positions.addAll(document.getPositions().values()); }); } else { JOptionPane.showMessageDialog(this, "nderungen am Dokument sind nicht erlaubt."); } }
From source file:org.wandora.application.gui.topicpanels.webview.WebViewPanel.java
public Object executeSynchronizedScript(final String script) { scriptReturn = null;//from www. j av a 2s.c o m if (script != null && script.length() > 0) { Thread runner = new Thread() { @Override public void run() { scriptReturn = webEngine.executeScript(script); } }; Platform.runLater(runner); do { try { Thread.sleep(100); } catch (Exception ex) { } } while (runner.isAlive()); } return scriptReturn; }