Example usage for javafx.scene.text Text Text

List of usage examples for javafx.scene.text Text Text

Introduction

In this page you can find the example usage for javafx.scene.text Text Text.

Prototype

public Text(String text) 

Source Link

Document

Creates an instance of Text containing the given string.

Usage

From source file:qupath.lib.gui.tma.TMASummaryViewer.java

void setTMAEntries(final Collection<TMAEntry> newEntries) {

    //      boolean containsSummaries = newEntries.stream().anyMatch(e -> e instanceof TMASummaryEntry);

    // Turn off use-selected - can be crashy when replacing entries
    if (!newEntries.equals(entriesBase)) {
        useSelectedProperty.set(false);/*from w ww.  jav  a 2s.  c o m*/

        // Reset the cache
        imageCache.clear();

        // Try to load small images in a background thread
        List<TMAEntry> duplicateEntries = new ArrayList<>(newEntries);
        ExecutorService service = Executors.newSingleThreadExecutor();
        service.submit(() -> {
            duplicateEntries.parallelStream().forEach(entry -> {
                imageCache.getImage(entry, maxSmallWidth.get());
                imageCache.getOverlay(entry, maxSmallWidth.get());
            });
        });
        service.shutdown();

    }
    this.entriesBase.setAll(newEntries);

    // Store the names of any currently hidden columns
    lastHiddenColumns = table.getColumns().stream().filter(c -> !c.isVisible()).map(c -> c.getText())
            .collect(Collectors.toSet());

    //      this.table.getColumns().clear();

    //      // Useful for a paper, but not generally...
    //      int count = 0;
    //      int nCells = 0;
    //      int nTumor = 0;
    //      for (TMAEntry entry : entriesBase) {
    //         if (!entry.isMissing() && (predicate.get() == null || predicate.get().test(entry))) {
    //            count++;
    //            nCells += (int)(entry.getMeasurement("Num Tumor").doubleValue() + entry.getMeasurement("Num Stroma").doubleValue());
    //            nTumor += (int)(entry.getMeasurement("Num Tumor").doubleValue());
    //         }
    //      }
    //      System.err.println(String.format("Num entries:\t%d\tNum tumor:\t%d\tNum cells:\t%d", count, nTumor, nCells));

    // Update measurement names
    Set<String> namesMeasurements = new LinkedHashSet<>();
    Set<String> namesMetadata = new LinkedHashSet<>();
    //      boolean containsSummaries = false;
    for (TMAEntry entry : newEntries) {
        namesMeasurements.addAll(entry.getMeasurementNames());
        namesMetadata.addAll(entry.getMetadataNames());
        //         containsSummaries = containsSummaries || entry instanceof TMASummaryEntry;
    }

    // Get the available survival columns
    String currentSurvival = getSurvivalColumn();
    survivalColumns.clear();
    if (namesMeasurements.contains(TMACoreObject.KEY_OVERALL_SURVIVAL))
        survivalColumns.add(TMACoreObject.KEY_OVERALL_SURVIVAL);
    if (namesMeasurements.contains(TMACoreObject.KEY_RECURRENCE_FREE_SURVIVAL))
        survivalColumns.add(TMACoreObject.KEY_RECURRENCE_FREE_SURVIVAL);
    if (currentSurvival != null && survivalColumns.contains(currentSurvival))
        comboSurvival.getSelectionModel().select(currentSurvival);
    else if (!survivalColumns.isEmpty())
        comboSurvival.getSelectionModel().select(survivalColumns.get(0));

    //      // Add the count of non-missing cores if we are working with summaries
    //      if (containsSummaries)
    namesMeasurements.add("Available cores");

    // Make sure there are no nulls or other unusable values
    namesMeasurements.remove(null);
    namesMeasurements.remove("");
    //      measurementNames.clear();
    String selectedMainMeasurement = comboMainMeasurement.getSelectionModel().getSelectedItem();
    measurementNames.setAll(namesMeasurements);
    if (namesMeasurements.contains(selectedMainMeasurement))
        comboMainMeasurement.getSelectionModel().select(selectedMainMeasurement);
    else {
        namesMeasurements.remove(TMACoreObject.KEY_UNIQUE_ID);
        namesMeasurements.remove(TMACoreObject.KEY_OVERALL_SURVIVAL);
        namesMeasurements.remove(TMACoreObject.KEY_RECURRENCE_FREE_SURVIVAL);
        namesMeasurements.remove(TMACoreObject.KEY_OS_CENSORED);
        namesMeasurements.remove(TMACoreObject.KEY_RFS_CENSORED);
        namesMeasurements.remove("Censored"); // For historical reasons when there was only one censored column supported...
        if (!namesMeasurements.isEmpty())
            comboMainMeasurement.getSelectionModel().select(0);
    }
    metadataNames.clear();
    metadataNames.addAll(namesMetadata);

    refreshTableData();

    // The next time the table is empty, show a different placeholder 
    // from the original (which is for loading/import)
    table.setPlaceholder(new Text("No data"));
}

From source file:com.virus.removal.javafxapplication.FXMLDocumentController.java

/**
 * //from  w w  w  .  ja  v a2 s. co  m
 */
private void processHistoryData() {

    if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_JOB_COMPLETED
            || handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_STOPPED) {

        textAreaForHistory.setStyle("-fx-text-fill: #00AEEF;");

        /* Enable the button */
        if (clearHistory.isDisabled()
                && (textAreaForHistory.getText().contains(HISTORY_UNAVAILABLE)
                        || textAreaForHistory.getText().contains(HISTORY_UNAVAILABLE_IN_SPANISH)
                        || textAreaForHistory.getText().contains(HISTORY_UNAVAILABLE_IN_FRENCH)
                        || textAreaForHistory.getText().contains(HISTORY_UNAVAILABLE_IN_PORTUGUESE))
                && virusScanHistoryList.size() > 0) {
            clearHistory.setDisable(false);
            textAreaForHistory.clear();
        }

        textAreaForHistory.setFont(Font.font("Verdana", FontWeight.EXTRA_BOLD, 11));

        for (final VirusScanHistory virusScanHistory : virusScanHistoryList) {

            /* Scanned Date */
            final Text scannedText = new Text("Scanned: " + virusScanHistory.getScanDate());
            scannedText.setLayoutX(50.0);
            scannedText.setLayoutY(150.0);

            if (virusScanHistoryCount != 0) {
                textAreaForHistory.appendText("\n\n\n\n");
            }

            textAreaForHistory.appendText(scannedText.getText());
            textAreaForHistory.appendText("                                                         ");

            /* Status */
            final String jobStatus = virusScanHistory.getScanStatus();
            final Text jobStatusText = new Text(jobStatus);

            final Text statusText = new Text("Status: " + jobStatusText.getText());
            statusText.setLayoutX(450.0);
            statusText.setLayoutY(150.0);

            textAreaForHistory.appendText(statusText.getText());

            textAreaForHistory.appendText("\n\n");

            /* PC Name */
            final Text pcNameText = new Text("PC Name: " + virusScanHistory.getPcName());
            pcNameText.setLayoutX(50.0);
            pcNameText.setLayoutY(175.0);

            textAreaForHistory.appendText(pcNameText.getText());
            textAreaForHistory.appendText(
                    "                                                                                  ");

            /* Threats Found */
            final Text threatsFoundText = new Text("Threats Found: " + virusScanHistory.getThreatsFound());
            threatsFoundText.setLayoutX(450.0);
            threatsFoundText.setLayoutY(175.0);

            textAreaForHistory.appendText(threatsFoundText.getText());
            virusScanHistoryCount++;

        }
    } else {

        //         if (handler.getVirusScanStatus() == null || handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_STARTED) {
        //
        //            if (textAreaForHistory.getText() == null || textAreaForHistory.getText().isEmpty()) {
        //               textAreaForHistory.appendText("\n\n\n\n\n\n\n\n\n\n\n                                                  ");
        //
        //               if (StringUtils.equals(drop.getText(), "English")) {
        //                  textAreaForHistory.appendText(HISTORY_UNAVAILABLE);
        //                  textForLastScanInHistory.setText("Last Scan: Please perform a scan.");
        //               } else if (StringUtils.equals(drop.getText(), "Spanish")) {
        //                  textAreaForHistory.appendText(HISTORY_UNAVAILABLE_IN_SPANISH);
        //                  textForLastScanInHistory.setText("ltimo escaneo: Por favor, haga un escaneo.");
        //               } else if (StringUtils.equals(drop.getText(), "French")) {
        //                  textAreaForHistory.appendText(HISTORY_UNAVAILABLE_IN_FRENCH);
        //                  textForLastScanInHistory.setText("Dernier scan: Veuillez effectuer un scan.");
        //               } else if (StringUtils.equals(drop.getText(), "Portuguese")) {
        //                  textAreaForHistory.appendText(HISTORY_UNAVAILABLE_IN_PORTUGUESE);
        //                  textForLastScanInHistory.setText("ltima anlise: Por-favor faa uma anlise.");
        //               } 
        //               
        //               textAreaForHistory.setFont(Font.font("Verdana", FontWeight.EXTRA_BOLD, 12));
        //               
        //               /* First time, button is disabled */
        //               clearHistory.setDisable(true);
        //               
        //            }
        //         }
    }

    virusScanHistoryList.clear();
}

From source file:patientmanagerv1.HomeController.java

public void enableBackdoorModifications() {
    final Stage dialog = new Stage();
    dialog.initModality(Modality.APPLICATION_MODAL);

    final TextField textField = new TextField();
    Button submit = new Button();
    Button cancel = new Button();
    final Label label = new Label();

    cancel.setText("Cancel");
    cancel.setAlignment(Pos.CENTER);//from   www  . j a  va2 s .  c o m
    submit.setText("Submit");
    submit.setAlignment(Pos.BOTTOM_RIGHT);

    final VBox dialogVbox = new VBox(20);
    dialogVbox.getChildren().add(new Text(
            "Only the physician can open this document for modification. Please Enter the master password: "));
    dialogVbox.getChildren().add(textField);
    dialogVbox.getChildren().add(submit);
    dialogVbox.getChildren().add(cancel);
    dialogVbox.getChildren().add(label);

    Scene dialogScene = new Scene(dialogVbox, 300, 200);
    dialog.setScene(dialogScene);
    dialog.setTitle("Security/Physician Authentication");
    dialog.show();

    submit.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent anEvent) {
            String password = textField.getText();

            if (password.equalsIgnoreCase("protooncogene")) {
                dialog.close();

                sign.setVisible(true);
                saveButton.setDisable(false);
                signature.setText("This document has been digitally signed by David Zhvikov MD");
                signature.setVisible(false);
                signature2.setVisible(false);

                //update the "signed" status document here, checked the "signed" status in the initialize() method and enable/disable the buttons and message accordingly onLoad...when the signed document is first created, it should be set to false (f) by default
                try {
                    File signedStatus = new File(installationPath + "/userdata/" + firstName.toLowerCase()
                            + lastName.toLowerCase() + dob + "/EvaluationForm/signed.txt");
                    FileWriter writ = new FileWriter(signedStatus, false); //it is set to false so that it (the current patient) will be overwritten every time
                    BufferedWriter bw = new BufferedWriter(writ);
                    writ.append("false");
                    bw.close();
                    writ.close();
                } catch (IOException e) {
                }

                ap.setDisable(false);

                //System.out.println(engaged.isSelected());
            } else if (password.equalsIgnoreCase("siberianplatypus")) {
                dialog.close();

                sign.setVisible(true);
                assistantsign.setVisible(true);
                assistantsign.setDisable(false);
                saveButton.setDisable(false);
                //signature.setText("This document has been digitally signed by David Zhvikov MD");
                assistantsignature.setVisible(false);
                signature.setVisible(false);
                signature2.setVisible(false);

                //update the "signed" status document here, checked the "signed" status in the initialize() method and enable/disable the buttons and message accordingly onLoad...when the signed document is first created, it should be set to false (f) by default
                try {
                    File signedStatus = new File(installationPath + "/userdata/" + firstName.toLowerCase()
                            + lastName.toLowerCase() + dob + "/EvaluationForm/signed.txt");
                    FileWriter writ = new FileWriter(signedStatus, false); //it is set to false so that it (the current patient) will be overwritten every time
                    BufferedWriter bw = new BufferedWriter(writ);
                    writ.append("false");
                    bw.close();
                    writ.close();
                } catch (IOException e) {
                }
                try {
                    File signedStatus = new File(installationPath + "/userdata/" + firstName.toLowerCase()
                            + lastName.toLowerCase() + dob + "/EvaluationForm/assistantsigned.txt");
                    FileWriter writ = new FileWriter(signedStatus, false); //it is set to false so that it (the current patient) will be overwritten every time
                    BufferedWriter bw = new BufferedWriter(writ);
                    writ.append("false");
                    bw.close();
                    writ.close();
                } catch (IOException e) {
                }

                ap.setDisable(false);

                //System.out.println(engaged.isSelected());
            }

            else {
                label.setText("The password you entered is incorrect. Please try again.");
            }

            //adds files to file tracker

        }
    });

    cancel.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent anEvent) {
            dialog.close();
            //close the window here
        }
    });

}

From source file:patientmanagerv1.HomeController.java

public void assistantSign() {
    final Stage dialog = new Stage();
    dialog.initModality(Modality.APPLICATION_MODAL);

    final TextField textField = new TextField();
    Button submit = new Button();
    Button cancel = new Button();
    final Label label = new Label();

    cancel.setText("Cancel");
    cancel.setAlignment(Pos.CENTER);//  w  w  w. ja v  a 2 s .c o  m
    submit.setText("Submit");
    submit.setAlignment(Pos.BOTTOM_RIGHT);

    final VBox dialogVbox = new VBox(20);
    dialogVbox.getChildren().add(new Text("Please enter the physician's assistant password: "));
    dialogVbox.getChildren().add(textField);
    dialogVbox.getChildren().add(submit);
    dialogVbox.getChildren().add(cancel);
    dialogVbox.getChildren().add(label);

    Scene dialogScene = new Scene(dialogVbox, 300, 200);
    dialog.setScene(dialogScene);
    dialog.setTitle("Security/Physician's Assistant Authentication");
    dialog.show();

    submit.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent anEvent) {
            String password = textField.getText();

            if (password.equalsIgnoreCase("siberianplatypus")) {
                partnerSigned = true;

                dialog.close();

                assistantsign.setVisible(false);
                saveButton.setDisable(true);
                //signature.setText("This document has been digitally signed by David Zhvikov MD");
                //signature.setVisible(true);
                //signature2.setVisible(true);
                assistantsignature.setVisible(true);

                //update the "signed" status document here, checked the "signed" status in the initialize() method and enable/disable the buttons and message accordingly onLoad...when the signed document is first created, it should be set to false (f) by default
                try {
                    File signedStatus = new File(installationPath + "/userdata/" + firstName.toLowerCase()
                            + lastName.toLowerCase() + dob + "/EvaluationForm/assistantsigned.txt");
                    FileWriter writ = new FileWriter(signedStatus, false); //it is set to false so that it (the current patient) will be overwritten every time
                    BufferedWriter bw = new BufferedWriter(writ);
                    writ.append("true");
                    bw.close();
                    writ.close();
                } catch (IOException e) {
                }

                ap.setDisable(true);

                //System.out.println(engaged.isSelected());
            } else {
                label.setText("The password you entered is incorrect. Please try again.");
            }

            //adds files to file tracker

        }
    });

    cancel.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent anEvent) {
            dialog.close();
            //close the window here
        }
    });
}

From source file:patientmanagerv1.HomeController.java

public void signEvaluation() {
    final Stage dialog = new Stage();
    dialog.initModality(Modality.APPLICATION_MODAL);

    final TextField textField = new TextField();
    Button submit = new Button();
    Button cancel = new Button();
    final Label label = new Label();

    cancel.setText("Cancel");
    cancel.setAlignment(Pos.CENTER);/*w  w w. j av a2s  .  c o m*/
    submit.setText("Submit");
    submit.setAlignment(Pos.BOTTOM_RIGHT);

    final VBox dialogVbox = new VBox(20);
    dialogVbox.getChildren()
            .add(new Text("Only the physician can sign this document. Please enter the master password: "));
    dialogVbox.getChildren().add(textField);
    dialogVbox.getChildren().add(submit);
    dialogVbox.getChildren().add(cancel);
    dialogVbox.getChildren().add(label);

    Scene dialogScene = new Scene(dialogVbox, 300, 200);
    dialog.setScene(dialogScene);
    dialog.setTitle("Security/Physician Authentication");
    dialog.show();

    submit.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent anEvent) {
            String password = textField.getText();

            if (password.equalsIgnoreCase("protooncogene")) {
                dccSigned = true;

                dialog.close();

                sign.setVisible(false);
                saveButton.setDisable(true);
                signature.setText("This document has been digitally signed by David Zhvikov MD");
                signature.setVisible(true);
                signature2.setVisible(true);

                //update the "signed" status document here, checked the "signed" status in the initialize() method and enable/disable the buttons and message accordingly onLoad...when the signed document is first created, it should be set to false (f) by default
                try {
                    File signedStatus = new File(installationPath + "/userdata/" + firstName.toLowerCase()
                            + lastName.toLowerCase() + dob + "/EvaluationForm/signed.txt");
                    FileWriter writ = new FileWriter(signedStatus, false); //it is set to false so that it (the current patient) will be overwritten every time
                    BufferedWriter bw = new BufferedWriter(writ);
                    writ.append("true");
                    bw.close();
                    writ.close();
                } catch (IOException e) {
                }

                ap.setDisable(true);

                //System.out.println(engaged.isSelected());
            } else {
                label.setText("The password you entered is incorrect. Please try again.");
            }

            //adds files to file tracker

        }
    });

    cancel.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent anEvent) {
            dialog.close();
            //close the window here
        }
    });

    //"save as document" (exporting) should become enabled after signing? (ask dcc if he wants this) --> it should automatically convert the generated word document to a pdf
}

From source file:patientmanagerv1.HomeController.java

public void printAdv() {
    final Stage dialog = new Stage();
    dialog.initModality(Modality.APPLICATION_MODAL);

    final TextField textField = new TextField();
    Button submit = new Button();
    Button cancel = new Button();
    final Label label = new Label();

    cancel.setText("Cancel");
    cancel.setAlignment(Pos.CENTER);/*from w  w  w  .  j  a v  a 2 s .co m*/
    submit.setText("Submit");
    submit.setAlignment(Pos.BOTTOM_RIGHT);

    final VBox dialogVbox = new VBox(20);
    dialogVbox.getChildren().add(new Text("Enter the master password: "));
    dialogVbox.getChildren().add(textField);
    dialogVbox.getChildren().add(submit);
    dialogVbox.getChildren().add(cancel);
    dialogVbox.getChildren().add(label);

    Scene dialogScene = new Scene(dialogVbox, 300, 200);
    dialog.setScene(dialogScene);
    dialog.setTitle("Security/Physician Authentication");
    dialog.show();

    submit.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent anEvent) {
            String password = textField.getText();

            if (password.equalsIgnoreCase("protooncogene")) {
                dialog.close();

                writeEvalToDocX(false, "");

                //OPENS the document for printing:
                try {
                    if (Desktop.isDesktopSupported()) {
                        Desktop.getDesktop()
                                .open(new File(installationPath + "/userdata/" + firstName + lastName + dob
                                        + "/" + firstName + lastName + dob + "psychiatricevaluation.docx"));
                    }
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                }
            } else {
                label.setText("The password you entered is incorrect. Please try again.");
            }

            //adds files to file tracker

        }
    });

    cancel.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent anEvent) {
            dialog.close();
            //close the window here
        }
    });

}