Example usage for javafx.application Platform runLater

List of usage examples for javafx.application Platform runLater

Introduction

In this page you can find the example usage for javafx.application Platform runLater.

Prototype

public static void runLater(Runnable runnable) 

Source Link

Document

Run the specified Runnable on the JavaFX Application Thread at some unspecified time in the future.

Usage

From source file:account.management.controller.ReportLedgerController.java

@FXML
private void onAccountSelect(ActionEvent event) {
    if (!this.ledger_id.isFocused()) {
        Platform.runLater(() -> {
            int id = this.account.getSelectionModel().getSelectedItem().getId();
            this.ledger_id.setText(String.format("LN%03d", id));
        });//from   w  w w.  j a va  2  s. c om
    }

}

From source file:com.hengyi.japp.print.client.controller.MdController.java

public void initMd(Md _md) {
    md = _md;//from  w  w w. j  a v  a 2s  .  co m
    chargLabel.textProperty().bind(md.chargProperty());
    hsdatField.valueProperty().bindBidirectional(md.hsdatProperty());

    sapYmmbanciField.valueProperty().bindBidirectional(md.sapYmmbanciProperty());
    sapYmmbanciField.itemsProperty().bind(md.getSapT001().sapYmmbancisProperty());

    sapT001wField.valueProperty().bindBidirectional(md.sapT001wProperty());
    sapT001wField.itemsProperty().bind(md.getSapT001().sapT001wsProperty());
    //        sapT001wField.valueProperty().addListener((ov, oldV, newV) -> sapT001wLabel.textProperty().bind(newV.name1Property()));
    //        sapT001wField.setCellFactory(SAPT001WCELLFACTORY);

    sapT001lField.valueProperty().bindBidirectional(md.sapT001lProperty());
    sapT001lField.itemsProperty().bind(md.getSapT001w().sapT001lsProperty());
    //        sapT001lField.valueProperty().addListener((ov, oldV, newV) -> sapT001lLabel.textProperty().bind(newV.lgobeProperty()));
    //        sapT001lField.setCellFactory(SAPT001LCELLFACTORY);

    sapZpackageField.valueProperty().bindBidirectional(md.sapZpackageProperty());
    sapZpackageField.itemsProperty().bind(md.getSapT001().sapZpackagesProperty());

    sapYmmzhixField.valueProperty().addListener(
            (ov, oldV, newV) -> sapYmmzhixLabel.setText(newV == null ? null : newV.getYzxwght() + " KG"));
    sapYmmzhixField.valueProperty().bindBidirectional(md.sapYmmzhixProperty());
    sapYmmzhixField.itemsProperty().bind(md.getSapT001().sapYmmzhixsProperty());
    //        sapYmmzhixField.setCellFactory(SAPYMMZHIXCELLFACTORY);

    sapYmmtonggField.valueProperty().addListener(
            (ov, oldV, newV) -> sapYmmtonggLabel.setText(newV == null ? null : newV.getZtgwght() + " KG"));
    sapYmmtonggField.valueProperty().bindBidirectional(md.sapYmmtonggProperty());
    sapYmmtonggField.itemsProperty().bind(md.getSapT001().sapYmmtonggsProperty());
    //        sapYmmtonggField.setCellFactory(SAPYMMTONGGCELLFACTORY);
    zrolmgeField.textProperty().bindBidirectional(md.zrolmgeProperty(), new NumberStringConverter());

    sapYmmmachField.valueProperty().bindBidirectional(md.sapYmmmachProperty());
    sapYmmmachField.itemsProperty().bind(md.getSapT001().sapYmmmachsProperty());
    //        sapYmmmachField.valueProperty().addListener((ov, oldV, newV) -> sapYmmmachLabel.setText(newV == null ? null : newV.getZplant()));
    //        sapYmmmachField.setCellFactory(SAPYMMMACHCELLFACTORY);

    //        sapYmmcheField.valueProperty().bindBidirectional(md.sapYmmcheProperty());
    //        sapYmmcheField.itemsProperty().bind(md.getSapT001().sapymm());
    //        sapYmmcheField.setCellFactory(SAPYMMCHECELLFACTORY);
    //        sapYmmcheField.valueProperty().addListener((ov, oldV, newV) -> sapYmmcheLabel.setText(newV == null ? null : newV.getZchwght() + " KG"));

    zcanmgeField.textProperty().bindBidirectional(md.zcanmgeProperty(), new NumberStringConverter());
    zdzflgField.selectedProperty().bindBidirectional(md.zdzflgProperty());
    zcnwghtField.textProperty().bindBidirectional(md.zcnwghtProperty(), new BigDecimalStringConverter());

    xdTable.itemsProperty().bindBidirectional(md.xdsProperty());
    sumZsgwghtLabel.textProperty().bindBidirectional(md.zsgwghtProperty(), new BigDecimalStringConverter());
    sumZsnwghtLabel.textProperty().bindBidirectional(md.zsnwghtProperty(), new BigDecimalStringConverter());

    if (StringUtils.isNotBlank(md.getCharg())) {
        sapMaraListView.setVisible(false);
        Platform.runLater(() -> matnrField.requestFocus());
    }
}

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.navpanel.NavPanel.java

private void initNavTree() {
    if (navTreeRoot == null) {
        navTreeRoot = new GroupTreeItem("", null, null);

        Platform.runLater(() -> {
            navTree.setRoot(navTreeRoot);
            navTreeRoot.setExpanded(true);
        });//  w w w.  ja v  a  2  s  .c o m
    }
}

From source file:com.ubershy.streamsis.actors.UniversalActor.java

/**
 * Starts Off Actions service and stops On Actions service.
 *///from   w ww .  ja  v  a 2 s.com
protected void runDisable() {
    Platform.runLater(() -> {
        onRepeatingService.cancel();
        if (!offActions.isEmpty()) {
            if (offRepeatingService.getState() == State.READY) {
                offRepeatingService.start();
            } else {
                offRepeatingService.restart();
            }
        }
    });
}

From source file:de.scoopgmbh.copper.monitoring.client.context.ApplicationContext.java

protected void connect(final String serverAdressParam, final String user, final String password) {
    boolean secureConnect = StringUtils.hasText(user) && StringUtils.hasText(password);
    String serverAdress = serverAdressParam;
    if (!serverAdress.endsWith("/")) {
        serverAdress = serverAdress + "/";
    }//from w  w w .  jav a2s .c om

    final LoginService loginService;
    final CommonsHttpInvokerRequestExecutor httpInvokerRequestExecutor = new CommonsHttpInvokerRequestExecutor();
    DefaultHttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(10, false);
    httpInvokerRequestExecutor.getHttpClient().getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
            retryHandler);
    httpInvokerRequestExecutor.getHttpClient().getParams().setSoTimeout(1000 * 60 * 5);
    {
        HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
        httpInvokerProxyFactoryBean.setServiceUrl(serverAdress + "copperMonitoringService");
        httpInvokerProxyFactoryBean.setServiceInterface(LoginService.class);
        httpInvokerProxyFactoryBean.setServiceUrl(serverAdress + "loginService");
        httpInvokerProxyFactoryBean.afterPropertiesSet();
        httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
        loginService = (LoginService) httpInvokerProxyFactoryBean.getObject();
    }

    final String sessionId;
    if (secureConnect) {
        try {
            sessionId = loginService.doLogin(user, password);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    } else {
        sessionId = "";
    }

    if (sessionId == null) {
        getIssueReporterSingleton().reportWarning("Invalid user/password", null, new Runnable() {
            @Override
            public void run() {
                createLoginForm().show();
            }
        });
    } else {
        HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
        httpInvokerProxyFactoryBean.setServiceUrl(serverAdress + "copperMonitoringService");
        httpInvokerProxyFactoryBean.setServiceInterface(CopperMonitoringService.class);
        RemoteInvocationFactory remoteInvocationFactory = secureConnect
                ? new SecureRemoteInvocationFactory(sessionId)
                : new DefaultRemoteInvocationFactory();
        httpInvokerProxyFactoryBean.setRemoteInvocationFactory(remoteInvocationFactory);
        httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
        httpInvokerProxyFactoryBean.afterPropertiesSet();
        final CopperMonitoringService copperMonitoringService = (CopperMonitoringService) httpInvokerProxyFactoryBean
                .getObject();

        final String serverAdressFinal = serverAdress;
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                setGuiCopperDataProvider(copperMonitoringService, serverAdressFinal, sessionId);
            }
        });
    }
}

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.navpanel.NavPanel.java

private void initHashTree() {
    if (hashTreeRoot == null) {
        hashTreeRoot = new GroupTreeItem("", null, null);

        Platform.runLater(() -> {
            hashTree.setRoot(hashTreeRoot);
            hashTreeRoot.setExpanded(true);
        });//from   ww  w  .j  a va  2 s.  c o m
    }
}

From source file:org.jevis.jeconfig.plugin.classes.ClassTree.java

private void expandAll(List<TreeItem<JEVisClass>> list, TreeItem<JEVisClass> root) {
    //        System.out.println("expand all");
    for (final TreeItem<JEVisClass> item : root.getChildren()) {
        for (final TreeItem<JEVisClass> child : list) {
            try {
                if (item.getValue().getName().equals(child.getValue().getName())) {
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            item.setExpanded(true);
                        }// w  ww  .  j  a v  a2  s  .c o  m
                    });

                }
            } catch (JEVisException ex) {
                ex.printStackTrace();
            }
        }
        expandAll(list, item);
    }
}

From source file:org.sleuthkit.autopsy.imageanalyzer.grouping.GroupManager.java

/**
 * remove the given file from the group with the given key. If the group
 * doesn't exist or doesn't already contain this file, this method is a
 * no-op/*from  w  w w.  jav  a  2s  .c om*/
 *
 * @param groupKey the value of groupKey
 * @param fileID   the value of file
 */
public synchronized void removeFromGroup(GroupKey<?> groupKey, final Long fileID) {
    //get grouping this file would be in
    final DrawableGroup group = getGroupForKey(groupKey);
    if (group != null) {
        group.removeFile(fileID);
        if (group.fileIds().isEmpty()) {
            synchronized (groupMap) {
                groupMap.remove(groupKey, group);
            }
            Platform.runLater(() -> {
                analyzedGroups.remove(group);
                synchronized (unSeenGroups) {
                    unSeenGroups.remove(group);
                }
            });
        }

    }
}

From source file:com.jscriptive.moneyfx.ui.account.AccountFrame.java

private void editAccount() {
    AccountItem selectedItem = dataTable.getSelectionModel().getSelectedItem();
    if (selectedItem != null) {
        AccountDialog dialog = new AccountDialog(selectedItem);
        Optional<AccountItem> result = dialog.showAndWait();
        if (result.isPresent()) {
            Account account = accountRepository.findByNumber(result.get().getNumber());
            String countryCode = result.get().getCountry();
            if (!StringUtils.equals(account.getBank().getCountryCode(), countryCode)) {
                Country country = countryRepository.findByCode(countryCode);
                if (country == null) {
                    country = Country.fromCountryCode(countryCode);
                    countryRepository.save(country);
                }/*  w  ww.  j ava2  s . co m*/
                account.getBank().setCountry(country);
                account.getBank().setTransferConceptRegex(
                        Configuration.getInstance().getTransferConceptRegexFor(account.getBank()));
                bankRepository.save(account.getBank());
            }
            account.setName(result.get().getName());
            account.setType(result.get().getType());
            account.setBalance(result.get().getBalance());
            account.setBalanceDate(result.get().getBalanceDate());
            accountRepository.save(account);
            accountData.set(dataTable.getSelectionModel().getSelectedIndex(), result.get());
            Platform.runLater(() -> dataSummaryLabel
                    .setText("Accounts: " + accountData.size() + ", balance: " + getAbsSum(accountData)));
        }
    }
}

From source file:com.ubershy.streamsis.actors.UniversalActor.java

/**
 * Starts On Actions service and stops Off Actions service.
 *///from  w w w . ja  v a2s.co  m
protected void runEnable() {
    Platform.runLater(() -> {
        offRepeatingService.cancel();
        if (!onActions.isEmpty()) {
            if (onRepeatingService.getState() == State.READY) {
                onRepeatingService.start();
            } else {
                onRepeatingService.restart();
            }
        }
    });
}