Example usage for javafx.collections ObservableList add

List of usage examples for javafx.collections ObservableList add

Introduction

In this page you can find the example usage for javafx.collections ObservableList add.

Prototype

boolean add(E e);

Source Link

Document

Appends the specified element to the end of this list (optional operation).

Usage

From source file:com.ggvaidya.scinames.model.Dataset.java

/** 
 * Set up a TableView to contain the data contained in this dataset.
 * //from   w  ww  .  j  a  va 2s. c  om
 * @param tv The TableView to populate.
 */
public void displayInTableView(TableView<DatasetRow> tv) {
    // Setup table.
    tv.setEditable(false);
    //controller.setTableColumnResizeProperty(TableView.CONSTRAINED_RESIZE_POLICY);
    ObservableList<TableColumn<DatasetRow, ?>> cols = tv.getColumns();
    cols.clear();
    // We need to precalculate.
    ObservableList<DatasetRow> rows = this.rowsProperty();
    // Set up columns.
    TableColumn<DatasetRow, String> colRowName = new TableColumn<>("Name");
    colRowName.setCellValueFactory((TableColumn.CellDataFeatures<DatasetRow, String> features) -> {
        DatasetRow row = features.getValue();
        Set<Name> names = getNamesInRow(row);
        if (names.isEmpty()) {
            return new ReadOnlyStringWrapper("(None)");
        } else {
            return new ReadOnlyStringWrapper(
                    names.stream().map(name -> name.getFullName()).collect(Collectors.joining("; ")));
        }
    });
    colRowName.setPrefWidth(100.0);
    cols.add(colRowName);
    // Create a column for every column here.
    this.getColumns().forEach((DatasetColumn col) -> {
        String colName = col.getName();
        TableColumn<DatasetRow, String> colColumn = new TableColumn<>(colName);
        colColumn.setCellValueFactory((TableColumn.CellDataFeatures<DatasetRow, String> features) -> {
            DatasetRow row = features.getValue();
            String val = row.get(colName);
            return new ReadOnlyStringWrapper(val == null ? "" : val);
        });
        colColumn.setPrefWidth(100.0);
        cols.add(colColumn);
    });

    // Set table items.
    // tv.getItems().clear();
    tv.setItems(rows);
}

From source file:view.FXApplicationController.java

public FXApplicationController(DataController dataController, FeatureModel featureModel, FXViewModel viewModel,
        boolean recreateModelMode) {

    primaryStage = new Stage();

    // Creating FXML Loader
    FXMLLoader loader = new FXMLLoader(FXStartController.class.getResource("Application.fxml"));
    loader.setController(this);

    // Try to load fxml file
    try {//from www . j  a va2  s . co m
        mainGrid = loader.load();
    } catch (IOException e) {
        Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
                "Error during loading Application.fxml file!", e);
    }

    this.dataController = dataController;
    this.dataModel = dataController.getDataModel();

    //initialize important variables
    channelNames = dataModel.getChannelNames();
    displayBuffer = dataModel.data.clone();
    // Set Choice Box for the channels        
    //Set properties for the channels
    for (int i = 0; i < channelNames.length; i++) {
        if (i < 6) {
            //The first value represents wheater the channel is shown
            //The second value represents the current zoom level
            Double[] channelProp = new Double[2];
            channelProp[0] = 1.0;
            channelProp[1] = 1.0;
            allChannels.put(channelNames[i], channelProp);
        } else {
            //The first value represents wheater the channel is shown
            //The second value represents the current zoom level
            Double[] channelProp = new Double[2];
            channelProp[0] = 0.0;
            channelProp[1] = 1.0;
            allChannels.put(channelNames[i], channelProp);
        }

    }

    // Create stage with mainGrid
    scene = new Scene(mainGrid);
    primaryStage.setScene(scene);

    //Properties for stage
    primaryStage.setResizable(true);
    primaryStage.show();
    primaryStage.setTitle(dataModel.getFile().getName());

    ////////////
    this.viewModel = viewModel;
    this.featureModel = featureModel;
    this.featureController = new FeatureController(featureModel, dataModel);

    this.recreateModelMode = recreateModelMode;

    kcDetector = featureController.kcDetector;
    kcDetector.setHighpassCoefficients(featureController.getDisplayHighpassCoefficients());
    kcDetector.setLowpassCoefficients(featureController.getLowpassCoefficients());

    currentEpoch = featureModel.getCurrentEpoch();
    loadEpoch(currentEpoch);
    showEpoch();

    paintSpacing();

    //Configure lineChart
    lineChart.setSnapToPixel(false);

    choices = FXCollections.observableArrayList();
    updateChoiceBox();
    choiceBox.getSelectionModel().select(0);

    ObservableList<String> choicesModel = FXCollections.observableArrayList();

    File folder = new File("./Classifiers").getAbsoluteFile();
    for (File file : folder.listFiles()) {
        if (file.getName().contains("model")) {
            choicesModel.add(file.getName().replace("[model]", "").replace(".jo", ""));
            classifierList.add(file.getAbsolutePath());
        }
    }

    choiceBoxModel.setItems(choicesModel);
    choiceBoxModel.getSelectionModel().select(0);

    tooltips();

    scatterPlot = new FXScatterPlot(this, dataController, dataModel, featureModel, featureController,
            viewModel);
    hypnogram = new FXHypnogrammController(dataModel, featureModel, viewModel, this);

    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            if (recreateModelMode) {
                hypnogram.updateAll();
                hypnogram.hide();
            }
            updateWindows();
        }
    });

    if (((int) (dataModel.getSrate()) % 50) != 0) {
        showPopUp("Sampling rate not supported. Must be a multiple of 50 Hz and > 100 Hz.");
    }
}

From source file:statos2_0.MainA.java

private ObservableList<String> GetByTag(String tag, String price) {
    //    /* w  w  w. j  a v  a 2s  . com*/
    ObservableList<String> al = FXCollections.observableArrayList();
    //if(balance1.size()>=0){balanceadd();}
    if (price.matches("")) {
        for (int i = 0; i < prod.size(); i++) {
            al.add(prod.get(i).get(tag));
        }
    } else {
        // System.out.println("!!"+prod);

        for (int i = 0; i < prod.size(); i++) {
            if (prod.get(i).get("type").matches(price)) {
                al.add(prod.get(i).get(tag));

            }

        }

    }
    return al;
}

From source file:condorclient.CreateJobDialogController.java

@FXML
private void runJobFired(ActionEvent event) {

    nrun = Integer.parseInt(sampleNumText.getText().trim());
    if (nrun == 0) {
        return;/* www  . j a  va  2 s .  co m*/
    }
    int eachrun = 0;

    // System.out.println("map:" + map.toString());
    ObservableList<String> slotname = FXCollections.observableArrayList();
    XMLHandler handler = new XMLHandler();
    if (allocMthod == 0) {//slot?

        if (!slotNumIsOk()) {
            return;
        }
        int i = 0;
        for (String s : map.keySet()) {
            if (i >= useslotnum) {
                break;
            }
            i = i + map.get(s).size();
            if (i <= useslotnum) {//?

                slotname.addAll(map.get(s));
            } else {
                i = i - map.get(s).size();
                for (String rest : map.get(s)) {
                    if (i >= useslotnum) {
                        break;
                    }
                    slotname.add(rest);
                    i++;
                }
            }
        } //slotname
          //??
          // System.out.println("allocMthod:" + allocMthod + "useslotnum:" + useslotnum + "\nslotname:" + slotname.toString());
    } else if (allocMthod == 1) {//?
        //  
        if (!nodeNumInputIsOk()) {//???
            return;
        }
        int i = 0;
        for (String s : map.keySet()) {
            if (i >= usenodenum) {
                break;
            }
            i++;
            if (slotname.size() + map.get(s).size() <= nrun) {
                slotname.addAll(map.get(s));
            } else if (slotname.size() < nrun) {//??ip?
                for (String rs : map.get(s)) {

                    slotname.add(rs);
                    if (slotname.size() == nrun) {
                        break;
                    }
                }
                break;
            }
        }
        //System.out.println("allocMthod:" + allocMthod + "usenodenum:" + usenodenum + "\nslotname:" + slotname.toString());
    } else if (allocMthod == 2) {//?
        int i = 0;
        for (String s : apponitmap.keySet()) {
            // slotname.addAll(map.get(s));//apponitmap?keylist
            if (i >= nrun) {
                break;
            }
            i++;
            //s
            if (slotname.size() + map.get(s).size() <= nrun) {
                slotname.addAll(map.get(s));
            } else if (slotname.size() < nrun) {//??machine?slot
                for (String rs : map.get(s)) {
                    slotname.add(rs);
                    if (slotname.size() == nrun) {
                        break;
                    }
                }
                break;
            }
        }
        if (slotname.size() == 0) {
            //System.out.println("+++++"+otherError.getText());
            otherError.setText("?");
            return;
        }

        //System.out.println("allocMthod:" + allocMthod + "zhi ding ge shu:" + apponitmap.keySet().size() + "\nslotname:" + slotname.toString());
    } else if (allocMthod == 3) {//????????
        int aptNum = 0;
        if (slotNum <= nrun) {//??
            aptNum = slotNum;
        } else {
            aptNum = nrun;
        }
        for (int i = 0; i < aptNum; i++) {//slotNum
            slotname.add("");
        }
    }
    eachrun = nrun / slotname.size();
    int restrun = nrun - eachrun * slotname.size();//?slot
    //System.out.println("eachrun" + eachrun + "restrun" + restrun);

    URL url = null;

    String scheddStr = handler.getURL("schedd");
    try {

        url = new URL(scheddStr);
    } catch (MalformedURLException e3) {
        // TODO Auto-generated catch block
        e3.printStackTrace();
    }
    Schedd schedd = null;
    try {
        schedd = new Schedd(url);
    } catch (ServiceException e2) {
    }

    int j = 0;
    //
    String timestamp = (new SimpleDateFormat("yyyyMMddHHmmss")).format(new Date());
    String resultdirstr = resultFileText.getText().trim() + "\\" + jobNameText.getText().trim() + "\\"
            + timestamp;
    System.out.println(resultdirstr);
    try {
        FileUtils.forceMkdir(new File(resultdirstr));
    } catch (IOException ex) {
        Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex);
    }

    System.out.println(timestamp);
    //?
    File infoFile = new File(infoFileText.getText().trim());
    File expFile = new File(expFileText.getText().trim());

    File[] transfiles = { infoFile, expFile };

    Transaction xact = schedd.createTransaction();
    try {
        xact.begin(30);

    } catch (RemoteException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    int clusterId = 0;
    try {
        clusterId = xact.createCluster();

    } catch (RemoteException e) {
    }
    for (String name : slotname) {//3slot??
        j++;
        int jobId = 0;
        try {
            jobId = xact.createJob(clusterId);
        } catch (RemoteException e) {
        }
        String jobdirstr = resultdirstr + "\\" + jobId;
        File jobdir = new File(jobdirstr);
        try {
            FileUtils.forceMkdir(jobdir);//?job
        } catch (IOException ex) {
            Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex);
        }
        //??job
        /*  for (File f : transfiles) {
           try {
           FileUtils.copyFileToDirectory(f, jobdir);
           } catch (IOException ex) {
           Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex);
           }
                
           }*/

        if (j == slotname.size()) {
            eachrun = eachrun + restrun;
        }
        String eachrunstr = "" + eachrun;

        String argumentsStr = infoFile.getName() + " " + expFile.getName() + " " + eachrunstr;// null;//".exl .ixl nrun"
        String requirementsStr = "Name==\"" + name + "\"";//Name=slot1@Lenovo-PC;String req="Name==\"slot1@Lenovo-PC\"";
        if (name.equals("")) {
            requirementsStr = null;//??
        }
        System.out.println("requirementsStr:" + requirementsStr + "eachrunstr:" + eachrunstr);

        ClassAdStructAttr[] attributes = null;// {new ClassAdStructAttr()};

        // ClassAdStructAttr attribute =new ClassAdStructAttr("WhenToTransferOutput",ClassAdAttrType.value3,"ON_EXIT_OR_EVICT");
        //  attributes[0] = new ClassAdStructAttr("Iwd", ClassAdAttrType.value3, jobdirstr);
        // attributes[1] = new ClassAdStructAttr("JobLeaseDuration", ClassAdAttrType.value1,"1200");
        String commandStr = handler.getexecutableFile();//?

        try {
            xact.submit(clusterId, jobId, "htcondor", UniverseType.VANILLA, commandStr, argumentsStr,
                    requirementsStr, attributes, transfiles);

        } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
    try {
        xact.commit();
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    try {
        schedd.requestReschedule();//
    } catch (RemoteException ex) {
        Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex);
    }
    String jobName = jobNameText.getText();
    handler.addJob(jobName, "" + clusterId, resultdirstr, expFileText.getText().trim(),
            infoFileText.getText().trim());//jobItem

    exeCreate = 1;
    stage.close();

}

From source file:condorclient.CreateJobDialogController.java

@FXML
private void saveJobFired(ActionEvent event) {

    nrun = Integer.parseInt(sampleNumText.getText().trim());
    if (nrun == 0) {
        return;//from  w ww .ja v a  2  s . c  om
    }
    int eachrun = 0;

    // System.out.println("map:" + map.toString());
    ObservableList<String> slotname = FXCollections.observableArrayList();
    XMLHandler handler = new XMLHandler();
    if (allocMthod == 0) {//slot?

        if (!slotNumIsOk()) {
            return;
        }

        int i = 0;
        for (String s : map.keySet()) {
            if (i >= useslotnum) {
                break;
            }

            i = i + map.get(s).size();
            if (i <= useslotnum) {//?

                slotname.addAll(map.get(s));
            } else {
                i = i - map.get(s).size();
                for (String rest : map.get(s)) {
                    if (i >= useslotnum) {
                        break;
                    }
                    slotname.add(rest);
                    i++;
                }
            }
        } //slotname
          //??
          // System.out.println("allocMthod:" + allocMthod + "useslotnum:" + useslotnum + "\nslotname:" + slotname.toString());
    } else if (allocMthod == 1) {//?
        if (!nodeNumInputIsOk()) {
            return;
        }
        int i = 0;
        for (String s : map.keySet()) {
            if (i >= usenodenum) {
                break;
            }
            i++;
            //s
            if (slotname.size() + map.get(s).size() <= nrun) {
                slotname.addAll(map.get(s));
            } else if (slotname.size() < nrun) {//??ip?
                for (String rs : map.get(s)) {
                    slotname.add(rs);
                    if (slotname.size() == nrun) {
                        break;
                    }
                }
                break;
            }

        }

        //System.out.println("allocMthod:" + allocMthod + "usenodenum:" + usenodenum + "\nslotname:" + slotname.toString());
    } else if (allocMthod == 2) {//?
        int i = 0;
        for (String s : apponitmap.keySet()) {
            // slotname.addAll(map.get(s));//apponitmap?keylist  
            ///eee
            if (i >= nrun) {
                break;
            }
            i++;
            //s
            if (slotname.size() + map.get(s).size() <= nrun) {
                slotname.addAll(map.get(s));
            } else if (slotname.size() < nrun) {//??machine?slot
                for (String rs : map.get(s)) {
                    slotname.add(rs);
                    if (slotname.size() == nrun) {
                        break;
                    }
                }
                break;
            }
            ///eee
        }
        if (slotname.size() == 0) {
            // System.out.println("+++++"+otherError.getText());
            otherError.setText("?");
            return;
        }

        //System.out.println("allocMthod:" + allocMthod + "zhi ding ge shu:" + apponitmap.keySet().size() + "\nslotname:" + slotname.toString());
    } else if (allocMthod == 3) {//??
        //e
        int aptNum = 0;
        if (slotNum <= nrun) {//??
            aptNum = slotNum;
        } else {
            aptNum = nrun;
        }
        for (int i = 0; i < aptNum; i++) {//slotNum
            slotname.add("");
        }
        //e
    }
    eachrun = nrun / slotname.size();
    int restrun = nrun - eachrun * slotname.size();//?slot
    //System.out.println("eachrun" + eachrun + "restrun" + restrun);
    URL url = null;

    String scheddStr = handler.getURL("schedd");

    try {
        url = new URL(scheddStr);
        // url = new URL("http://localhost:9628");
    } catch (MalformedURLException e3) {
        // TODO Auto-generated catch block
        e3.printStackTrace();
    }
    Schedd schedd = null;
    try {
        schedd = new Schedd(url);
    } catch (ServiceException e2) {
    }
    //s
    String timestamp = (new SimpleDateFormat("yyyyMMddHHmmss")).format(new Date());
    String resultdirstr = resultFileText.getText().trim() + "\\" + jobNameText.getText().trim() + "\\"
            + timestamp;
    System.out.println(resultdirstr);
    try {
        FileUtils.forceMkdir(new File(resultdirstr));
    } catch (IOException ex) {
        Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex);
    }

    System.out.println(timestamp);
    //?
    File infoFile = new File(infoFileText.getText().trim());
    File expFile = new File(expFileText.getText().trim());
    // File testFile = new File("D:\\HTCondor\\test\\2\\inputfile.txt");
    File[] transfiles = { infoFile, expFile };

    //e
    Transaction xact = schedd.createTransaction();
    try {

        if (xact != null) {
            xact.begin(3000);
        }
    } catch (RemoteException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    int clusterId = 0;
    try {
        clusterId = xact.createCluster();

    } catch (RemoteException e) {
    }
    int j = 0;
    for (String name : slotname) {//3slot??
        j++;
        int jobId = 0;
        try {
            jobId = xact.createJob(clusterId);
        } catch (RemoteException e) {
        }
        //s
        String jobdirstr = resultdirstr + "\\" + jobId;

        File jobdir = new File(jobdirstr);
        try {
            FileUtils.forceMkdir(jobdir);//?job
        } catch (IOException ex) {
            Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex);
        }
        //??job
        /* for (File f : transfiles) {
          try {
          FileUtils.copyFileToDirectory(f, jobdir);
          } catch (IOException ex) {
          Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex);
          }
                
          }*/
        //e
        if (j == slotname.size()) {
            eachrun = eachrun + restrun;
        }
        String eachrunstr = "" + eachrun;

        String argumentsStr = infoFile.getName() + " " + expFile.getName() + " " + eachrunstr;// "" + eachrunstr;// null;//".exl .ixl nrun"
        String requirementsStr = "Name==\"" + name + "\"";//Name=slot1@Lenovo-PC;String req="Name==\"slot1@Lenovo-PC\"";

        if (name.equals("")) {
            requirementsStr = null;//??
        }
        ClassAdStructAttr[] attributes = null;// {new ClassAdStructAttr()};
        // ClassAdStructAttr attribute =new ClassAdStructAttr("WhenToTransferOutput",ClassAdAttrType.value3,"ON_EXIT_OR_EVICT");
        //attributes[0] = new ClassAdStructAttr("Iwd", ClassAdAttrType.value3, jobdirstr);
        //JobLeaseDuration
        //            attributes[1] = new ClassAdStructAttr("JobLeaseDuration", ClassAdAttrType.value1,"1200");
        String commandStr = handler.getexecutableFile();//?

        try {
            xact.submit(clusterId, jobId, "htcondor", UniverseType.VANILLA, commandStr, argumentsStr,
                    requirementsStr, attributes, transfiles);

        } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {
            xact.holdJob(clusterId, jobId, "");//
        } catch (RemoteException ex) {
            Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
    try {
        xact.commit();
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    String jobName = jobNameText.getText();
    handler.addJob(jobName, "" + clusterId, resultdirstr, expFileText.getText().trim(),
            infoFileText.getText().trim());

    // System.out.print("createTransaction succeed haha!!\n");
    exeCreate = 1;
    stage.close();

}

From source file:qupath.lib.gui.panels.survival.KaplanMeierDisplay.java

@SuppressWarnings("unchecked")
private void generatePlot() {

    KaplanMeierDisplay.ScoreData newScoreData = scoreData;

    // If we have a hierarchy, update the scores with the most recent data
    if (hierarchy != null) {
        List<TMACoreObject> cores = PathObjectTools.getTMACoreObjects(hierarchy, false);
        double[] survival = new double[cores.size()];
        boolean[] censored = new boolean[cores.size()];
        double[] scores = new double[cores.size()];

        //            // Optionally sort by scores... helps a bit when debugging e.g. p-values, Hazard ratios etc.
        //            cores.sort((c1, c2) -> Double.compare(c1.getMeasurementList().getMeasurementValue(scoreColumn), c2.getMeasurementList().getMeasurementValue(scoreColumn)));

        //            scoreColumn = "Positive %";
        //         scoreColumn = "RoughScore";
        for (int i = 0; i < cores.size(); i++) {
            TMACoreObject core = cores.get(i);
            MeasurementList ml = core.getMeasurementList();
            survival[i] = core.getMeasurementList().getMeasurementValue(survivalColumn);
            double censoredValue = core.getMeasurementList().getMeasurementValue(censoredColumn);
            boolean hasCensoredValue = !Double.isNaN(censoredValue)
                    && (censoredValue == 0 || censoredValue == 1);
            censored[i] = censoredValue != 0;
            if (!hasCensoredValue) {
                // If we don't have a censored value, ensure we mask out everything else
                scores[i] = Double.NaN;
                survival[i] = Double.NaN;
            } else if (ml.containsNamedMeasurement(scoreColumn))
                // Get the score if we can
                scores[i] = ml.getMeasurementValue(scoreColumn);
            else {
                //               // Try to compute score if we need to
                //               Map<String, Number> map = ROIMeaningfulMeasurements.getPathClassSummaryMeasurements(core.getChildObjects(), true);
                //               Number value = map.get(scoreColumn);
                //               if (value == null)
                scores[i] = Double.NaN;
                //               else
                //                  scores[i] = value.doubleValue();
            }/*from  w  w  w  .j  a  v  a  2s.  co  m*/
        }
        // Mask out any scores that don't have associated survival data
        for (int i = 0; i < survival.length; i++) {
            if (Double.isNaN(survival[i]))
                scores[i] = Double.NaN;
        }

        newScoreData = new ScoreData(scores, survival, censored);

    }

    if (newScoreData == null || newScoreData.scores.length == 0)
        return;

    //         KaplanMeier kmHigh = new KaplanMeier("Above threshold");
    //         KaplanMeier kmLow = new KaplanMeier("Below threshold");

    double[] quartiles = StatisticsHelper.getQuartiles(newScoreData.scores);
    double q1 = quartiles[0];
    double median = quartiles[1];
    double q3 = quartiles[2];
    double[] thresholds;
    if (params != null) {
        Object thresholdMethod = params.getChoiceParameterValue("scoreThresholdMethod");
        if (thresholdMethod.equals("Median")) {
            //               panelParams.setNumericParameterValue("scoreThreshold", median);
            //               ((DoubleParameter)params.getParameters().get("scoreThreshold")).setValue(median); // TODO: UPDATE DIALOG!
            thresholds = new double[] { median };
        } else if (thresholdMethod.equals("Tertiles")) {
            //                  ((DoubleParameter)params.getParameters().get("scoreThreshold")).setValue(median); // TODO: UPDATE DIALOG!
            thresholds = StatisticsHelper.getTertiles(newScoreData.scores);
        } else if (thresholdMethod.equals("Quartiles")) {
            //               ((DoubleParameter)params.getParameters().get("scoreThreshold")).setValue(median); // TODO: UPDATE DIALOG!
            thresholds = new double[] { q1, median, q3 };
        } else if (thresholdMethod.equals("Manual (1)")) {
            thresholds = new double[] { params.getDoubleParameterValue("threshold1") };
        } else if (thresholdMethod.equals("Manual (2)")) {
            thresholds = new double[] { params.getDoubleParameterValue("threshold1"),
                    params.getDoubleParameterValue("threshold2") };
        } else //if (thresholdMethod.equals("Manual (3)")) {
            thresholds = new double[] { params.getDoubleParameterValue("threshold1"),
                    params.getDoubleParameterValue("threshold2"),
                    params.getDoubleParameterValue("threshold3") };
    } else
        thresholds = new double[] { median };

    double minVal = Double.POSITIVE_INFINITY;
    double maxVal = Double.NEGATIVE_INFINITY;
    int numNonNaN = 0;
    for (double d : newScoreData.scores) {
        if (Double.isNaN(d))
            continue;
        if (d < minVal)
            minVal = d;
        if (d > maxVal)
            maxVal = d;
        numNonNaN++;
    }
    boolean scoresValid = maxVal > minVal; // If not this, we don't have valid scores that we can work with

    double maxTimePoint = 0;
    for (double d : newScoreData.survival) {
        if (Double.isNaN(d))
            continue;
        if (d > maxTimePoint)
            maxTimePoint = d;
    }
    if (panelParams != null
            && maxTimePoint > ((IntParameter) params.getParameters().get("censorTimePoints")).getUpperBound()) {
        panelParams.setNumericParameterValueRange("censorTimePoints", 0, Math.ceil(maxTimePoint));
    }

    // Optionally censor at specified time
    double censorThreshold = params == null ? maxTimePoint : params.getIntParameterValue("censorTimePoints");

    // Compute log-rank p-values for *all* possible thresholds
    // Simultaneously determine the threshold that yields the lowest p-value, 
    // resolving ties in favour of a more even split between high/low numbers of events
    boolean pValuesChanged = false;
    if (calculateAllPValues) {
        if (!(pValues != null && pValueThresholds != null && newScoreData.equals(scoreData)
                && censorThreshold == lastPValueCensorThreshold)) {
            Map<Double, Double> mapLogRank = new TreeMap<>();
            Set<Double> setObserved = new HashSet<>();
            for (int i = 0; i < newScoreData.scores.length; i++) {
                Double d = newScoreData.scores[i];
                boolean observed = !newScoreData.censored[i] && newScoreData.survival[i] < censorThreshold;
                if (observed)
                    setObserved.add(d);
                if (mapLogRank.containsKey(d))
                    continue;
                List<KaplanMeierData> kmsTemp = splitByThresholds(newScoreData, new double[] { d },
                        censorThreshold, false);
                //               if (kmsTemp.get(1).nObserved() == 0 || kmsTemp.get(1).nObserved() == 0)
                //                  continue;
                LogRankResult test = LogRankTest.computeLogRankTest(kmsTemp.get(0), kmsTemp.get(1));
                double pValue = test.getPValue();
                //                  double pValue = test.hazardRatio < 1 ? test.hazardRatio : 1.0/test.hazardRatio; // Checking usefulness of Hazard ratios...
                if (!Double.isFinite(pValue))
                    continue;
                //               if (!Double.isFinite(test.getHazardRatio())) {
                ////                  continue;
                //                  pValue = Double.NaN;
                //               }
                mapLogRank.put(d, pValue);
            }
            pValueThresholds = new double[mapLogRank.size()];
            pValues = new double[mapLogRank.size()];
            pValueThresholdsObserved = new boolean[mapLogRank.size()];
            int count = 0;
            for (Entry<Double, Double> entry : mapLogRank.entrySet()) {
                pValueThresholds[count] = entry.getKey();
                pValues[count] = entry.getValue();
                if (setObserved.contains(entry.getKey()))
                    pValueThresholdsObserved[count] = true;
                count++;
            }

            // Find the longest 'significant' stretch
            int maxSigCount = 0;
            int maxSigInd = -1;
            int sigCurrent = 0;
            int[] sigCount = new int[pValues.length];
            for (int i = 0; i < pValues.length; i++) {
                if (pValues[i] < 0.05) {
                    sigCurrent++;
                    sigCount[i] = sigCurrent;
                    if (sigCurrent > maxSigCount) {
                        maxSigCount = sigCurrent;
                        maxSigInd = i;
                    }
                } else
                    sigCurrent = 0;
            }
            if (maxSigCount == 0) {
                logger.info("No p-values < 0.05");
            } else {
                double minThresh = maxSigInd - maxSigCount < 0 ? pValueThresholds[0] - 0.0000001
                        : pValueThresholds[maxSigInd - maxSigCount];
                double maxThresh = pValueThresholds[maxSigInd];
                int nBetween = 0;
                int nBetweenObserved = 0;
                for (int i = 0; i < newScoreData.scores.length; i++) {
                    if (newScoreData.scores[i] > minThresh && newScoreData.scores[i] <= maxThresh) {
                        nBetween++;
                        if (newScoreData.survival[i] < censorThreshold && !newScoreData.censored[i])
                            nBetweenObserved++;
                    }
                }
                logger.info("Longest stretch of p-values < 0.05: {} - {} ({} entries, {} observed)", minThresh,
                        maxThresh, nBetween, nBetweenObserved);
            }

            pValuesSmoothed = new double[pValues.length];
            Arrays.fill(pValuesSmoothed, Double.NaN);
            int n = (pValues.length / 20) * 2 + 1;
            logger.info("Smoothing log-rank test p-values by " + n);
            for (int i = n / 2; i < pValues.length - n / 2; i++) {
                double sum = 0;
                for (int k = i - n / 2; k < i - n / 2 + n; k++) {
                    sum += pValues[k];
                }
                pValuesSmoothed[i] = sum / n;
            }
            //               for (int i = 0; i < pValues.length; i++) {
            //                  double sum = 0;
            //                  for (int k = Math.max(0, i-n/2); k < Math.min(pValues.length, i-n/2+n); k++) {
            //                     sum += pValues[k];
            //                  }
            //                  pValuesSmoothed[i] = sum/n;
            //               }
            //               pValues = pValuesSmoothed;

            lastPValueCensorThreshold = censorThreshold;
            pValuesChanged = true;
        }
    } else {
        lastPValueCensorThreshold = Double.NaN;
        pValueThresholds = null;
        pValues = null;
    }

    //            if (params != null && !Double.isNaN(bestThreshold) && (params.getChoiceParameterValue("scoreThresholdMethod").equals("Lowest p-value")))
    if (params != null && (params.getChoiceParameterValue("scoreThresholdMethod").equals("Lowest p-value"))) {
        int bestIdx = -1;
        double bestPValue = Double.POSITIVE_INFINITY;
        for (int i = pValueThresholds.length / 10; i < pValueThresholds.length * 9 / 10; i++) {
            if (pValues[i] < bestPValue) {
                bestIdx = i;
                bestPValue = pValues[i];
            }
        }
        thresholds = bestIdx >= 0 ? new double[] { pValueThresholds[bestIdx] } : new double[0];
    } else if (params != null
            && (params.getChoiceParameterValue("scoreThresholdMethod").equals("Lowest smoothed p-value"))) {
        int bestIdx = -1;
        double bestPValue = Double.POSITIVE_INFINITY;
        for (int i = pValueThresholds.length / 10; i < pValueThresholds.length * 9 / 10; i++) {
            if (pValuesSmoothed[i] < bestPValue) {
                bestIdx = i;
                bestPValue = pValuesSmoothed[i];
            }
        }
        thresholds = bestIdx >= 0 ? new double[] { pValueThresholds[bestIdx] } : new double[0];
    }

    // Split into different curves using the provided thresholds
    List<KaplanMeierData> kms = splitByThresholds(newScoreData, thresholds, censorThreshold,
            params != null && "Quartiles".equals(params.getChoiceParameterValue("scoreThresholdMethod")));

    //         for (KaplanMeier km : kms)
    //            km.censorAtTime(censorThreshold);
    ////         kmHigh.censorAtTime(censorThreshold);
    ////         kmLow.censorAtTime(censorThreshold);

    //         logger.info("High: " + kmHigh.toString());
    //         logger.info("Low: " + kmLow.toString());
    //         logger.info("Log rank comparison: {}", LogRankTest.computeLogRankTest(kmLow, kmHigh));

    if (plotter == null) {
        plotter = new KaplanMeierChartWrapper(survivalColumn + " time");
        //            plotter.setBorder(BorderFactory.createTitledBorder("Survival plot"));
        //            plotter.getCanvas().setWidth(300);
        //            plotter.getCanvas().setHeight(300);
    }
    KaplanMeierData[] kmArray = new KaplanMeierData[kms.size()];
    plotter.setKaplanMeierCurves(survivalColumn + " time", kms.toArray(kmArray));
    tableModel.setSurvivalCurves(thresholds,
            params != null && params.getChoiceParameterValue("scoreThresholdMethod").equals("Lowest p-value"),
            kmArray);

    // Bar width determined using 'Freedman and Diaconis' rule' (but overridden if this gives < 16 bins...)
    double barWidth = (2 * q3 - q1) * Math.pow(numNonNaN, -1.0 / 3.0);
    int nBins = 100;
    if (!Double.isNaN(barWidth))
        barWidth = (int) Math.max(16, Math.ceil((maxVal - minVal) / barWidth));
    Histogram histogram = scoresValid ? new Histogram(newScoreData.scores, nBins) : null;
    if (histogramPanel == null) {
        GridPane paneHistogram = new GridPane();
        histogramPanel = new HistogramPanelFX();
        histogramPanel.getChart().setAnimated(false);
        histogramWrapper = new ThresholdedChartWrapper(histogramPanel.getChart());
        for (ObservableNumberValue val : threshProperties)
            histogramWrapper.addThreshold(val, ColorToolsFX.getCachedColor(240, 0, 0, 128));
        histogramWrapper.getPane().setPrefHeight(150);
        paneHistogram.add(histogramWrapper.getPane(), 0, 0);
        Tooltip.install(histogramPanel.getChart(), new Tooltip("Distribution of scores"));
        GridPane.setHgrow(histogramWrapper.getPane(), Priority.ALWAYS);
        GridPane.setVgrow(histogramWrapper.getPane(), Priority.ALWAYS);

        NumberAxis xAxis = new NumberAxis();
        xAxis.setLabel("Score threshold");
        NumberAxis yAxis = new NumberAxis();
        yAxis.setLowerBound(0);
        yAxis.setUpperBound(1);
        yAxis.setTickUnit(0.1);
        yAxis.setAutoRanging(false);
        yAxis.setLabel("P-value");
        chartPValues = new LineChart<>(xAxis, yAxis);
        chartPValues.setAnimated(false);
        chartPValues.setLegendVisible(false);

        // Make chart so it can be navigated
        ChartToolsFX.makeChartInteractive(chartPValues, xAxis, yAxis);
        pValuesChanged = true;
        Tooltip.install(chartPValues, new Tooltip(
                "Distribution of p-values (log-rank test) comparing low vs. high for all possible score thresholds"));
        //            chartPValues.getYAxis().setAutoRanging(false);
        pValuesWrapper = new ThresholdedChartWrapper(chartPValues);
        for (ObservableNumberValue val : threshProperties)
            pValuesWrapper.addThreshold(val, ColorToolsFX.getCachedColor(240, 0, 0, 128));

        pValuesWrapper.getPane().setPrefHeight(150);
        paneHistogram.add(pValuesWrapper.getPane(), 0, 1);
        GridPane.setHgrow(pValuesWrapper.getPane(), Priority.ALWAYS);
        GridPane.setVgrow(pValuesWrapper.getPane(), Priority.ALWAYS);

        ContextMenu popup = new ContextMenu();
        ChartToolsFX.addChartExportMenu(chartPValues, popup);

        RadioMenuItem miZoomY1 = new RadioMenuItem("0-1");
        miZoomY1.setOnAction(e -> {
            yAxis.setAutoRanging(false);
            yAxis.setUpperBound(1);
            yAxis.setTickUnit(0.2);
        });
        RadioMenuItem miZoomY05 = new RadioMenuItem("0-0.5");
        miZoomY05.setOnAction(e -> {
            yAxis.setAutoRanging(false);
            yAxis.setUpperBound(0.5);
            yAxis.setTickUnit(0.1);
        });
        RadioMenuItem miZoomY02 = new RadioMenuItem("0-0.2");
        miZoomY02.setOnAction(e -> {
            yAxis.setAutoRanging(false);
            yAxis.setUpperBound(0.2);
            yAxis.setTickUnit(0.05);
        });
        RadioMenuItem miZoomY01 = new RadioMenuItem("0-0.1");
        miZoomY01.setOnAction(e -> {
            yAxis.setAutoRanging(false);
            yAxis.setUpperBound(0.1);
            yAxis.setTickUnit(0.05);
        });
        RadioMenuItem miZoomY005 = new RadioMenuItem("0-0.05");
        miZoomY005.setOnAction(e -> {
            yAxis.setAutoRanging(false);
            yAxis.setUpperBound(0.05);
            yAxis.setTickUnit(0.01);
        });
        RadioMenuItem miZoomY001 = new RadioMenuItem("0-0.01");
        miZoomY001.setOnAction(e -> {
            yAxis.setAutoRanging(false);
            yAxis.setUpperBound(0.01);
            yAxis.setTickUnit(0.005);
        });
        ToggleGroup tgZoom = new ToggleGroup();
        miZoomY1.setToggleGroup(tgZoom);
        miZoomY05.setToggleGroup(tgZoom);
        miZoomY02.setToggleGroup(tgZoom);
        miZoomY01.setToggleGroup(tgZoom);
        miZoomY005.setToggleGroup(tgZoom);
        miZoomY001.setToggleGroup(tgZoom);
        Menu menuZoomY = new Menu("Set y-axis range");
        menuZoomY.getItems().addAll(miZoomY1, miZoomY05, miZoomY02, miZoomY01, miZoomY005, miZoomY001);

        MenuItem miCopyData = new MenuItem("Copy chart data");
        miCopyData.setOnAction(e -> {
            String dataString = ChartToolsFX.getChartDataAsString(chartPValues);
            ClipboardContent content = new ClipboardContent();
            content.putString(dataString);
            Clipboard.getSystemClipboard().setContent(content);
        });

        popup.getItems().addAll(miCopyData, menuZoomY);
        chartPValues.setOnContextMenuRequested(e -> {
            popup.show(chartPValues, e.getScreenX(), e.getScreenY());
        });

        for (int col = 0; col < tableModel.getColumnCount(); col++) {
            TableColumn<Integer, String> column = new TableColumn<>(tableModel.getColumnName(col));
            int colNumber = col;
            column.setCellValueFactory(
                    new Callback<CellDataFeatures<Integer, String>, ObservableValue<String>>() {
                        @Override
                        public ObservableValue<String> call(CellDataFeatures<Integer, String> p) {
                            return new SimpleStringProperty(
                                    (String) tableModel.getValueAt(p.getValue(), colNumber));
                        }
                    });

            column.setCellFactory(new Callback<TableColumn<Integer, String>, TableCell<Integer, String>>() {

                @Override
                public TableCell<Integer, String> call(TableColumn<Integer, String> param) {
                    TableCell<Integer, String> cell = new TableCell<Integer, String>() {
                        @Override
                        protected void updateItem(String item, boolean empty) {
                            super.updateItem(item, empty);
                            setText(item);
                            setTooltip(new Tooltip(item));
                        }
                    };
                    return cell;
                }
            });

            table.getColumns().add(column);
        }
        table.setPrefHeight(250);
        table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
        table.maxHeightProperty().bind(table.prefHeightProperty());

        params = new ParameterList();
        //         maxTimePoint = 0;
        //         for (TMACoreObject core : hierarchy.getTMAGrid().getTMACoreList()) {
        //            double os = core.getMeasurementList().getMeasurementValue(TMACoreObject.KEY_OVERALL_SURVIVAL);
        //            double rfs = core.getMeasurementList().getMeasurementValue(TMACoreObject.KEY_RECURRENCE_FREE_SURVIVAL);
        //            if (os > maxTimePoint)
        //               maxTimePoint = os;
        //            if (rfs > maxTimePoint)
        //               maxTimePoint = rfs;
        //         }
        params.addIntParameter("censorTimePoints", "Max censored time", (int) (censorThreshold + 0.5), null, 0,
                (int) Math.ceil(maxTimePoint), "Latest time point beyond which data will be censored");
        //            params.addChoiceParameter("scoreThresholdMethod", "Threshold method", "Manual", Arrays.asList("Manual", "Median", "Log-rank test"));
        if (calculateAllPValues)
            // Don't include "Lowest smoothed p-value" - it's not an established method and open to misinterpretation...
            params.addChoiceParameter("scoreThresholdMethod", "Threshold method", "Median",
                    Arrays.asList("Manual (1)", "Manual (2)", "Manual (3)", "Median", "Tertiles", "Quartiles",
                            "Lowest p-value"));
        //            params.addChoiceParameter("scoreThresholdMethod", "Threshold method", "Median", Arrays.asList("Manual (1)", "Manual (2)", "Manual (3)", "Median", "Tertiles", "Quartiles", "Lowest p-value", "Lowest smoothed p-value"));
        else
            params.addChoiceParameter("scoreThresholdMethod", "Threshold method", "Median",
                    Arrays.asList("Manual (1)", "Manual (2)", "Manual (3)", "Median", "Tertiles", "Quartiles"));
        params.addDoubleParameter("threshold1", "Threshold 1",
                thresholds.length > 0 ? thresholds[0] : (minVal + maxVal) / 2, null,
                "Threshold to distinguish between patient groups");
        params.addDoubleParameter("threshold2", "Threshold 2",
                thresholds.length > 1 ? thresholds[1] : (minVal + maxVal) / 2, null,
                "Threshold to distinguish between patient groups");
        params.addDoubleParameter("threshold3", "Threshold 3",
                thresholds.length > 2 ? thresholds[2] : (minVal + maxVal) / 2, null,
                "Threshold to distinguish between patient groups");
        params.addBooleanParameter("showAtRisk", "Show at risk", plotter.getShowAtRisk(),
                "Show number of patients at risk below the plot");
        params.addBooleanParameter("showTicks", "Show censored ticks", plotter.getShowCensoredTicks(),
                "Show ticks to indicate censored data");
        params.addBooleanParameter("showKey", "Show key", plotter.getShowKey(),
                "Show key indicating display of each curve");
        //            params.addBooleanParameter("useColor", "Use color", plotter.getUseColor(), "Show each curve in a different color");
        //         params.addBooleanParameter("useStrokes", "Use strokes", plotter.getUseStrokes(), "Show each curve with a differed line stroke");
        // Hide threshold parameters if threshold can't be used
        if (!scoresValid) {
            //               params.setHiddenParameters(true, "scoreThresholdMethod", "scoreThreshold");
            histogramPanel.getChart().setVisible(false);
        }
        panelParams = new ParameterPanelFX(params);
        panelParams.addParameterChangeListener(this);
        updateThresholdsEnabled();

        for (int i = 0; i < threshProperties.length; i++) {
            String p = "threshold" + (i + 1);
            threshProperties[i].addListener((v, o, n) -> {
                if (interactiveThresholds()) {
                    // Need to do a decent double check with tolerance to text field value changing while typing
                    if (!GeneralTools.almostTheSame(params.getDoubleParameterValue(p), n.doubleValue(), 0.0001))
                        panelParams.setNumericParameterValue(p, n);
                }
            });
        }

        BorderPane paneBottom = new BorderPane();
        TitledPane paneOptions = new TitledPane("Options", panelParams.getPane());
        //            paneOptions.setCollapsible(false);
        Pane paneCanvas = new StackPane();
        paneCanvas.getChildren().add(plotter.getCanvas());

        GridPane paneLeft = new GridPane();
        paneLeft.add(paneOptions, 0, 0);
        paneLeft.add(table, 0, 1);
        GridPane.setHgrow(paneOptions, Priority.ALWAYS);
        GridPane.setHgrow(table, Priority.ALWAYS);
        paneBottom.setLeft(paneLeft);
        paneBottom.setCenter(paneHistogram);

        paneMain.setCenter(paneCanvas);
        paneMain.setBottom(paneBottom);

        paneMain.setPadding(new Insets(10, 10, 10, 10));
    } else if (thresholds.length > 0) {
        // Ensure the sliders/text fields are set sensibly
        if (!GeneralTools.almostTheSame(thresholds[0], params.getDoubleParameterValue("threshold1"), 0.0001)) {
            panelParams.setNumericParameterValue("threshold1", thresholds[0]);
        }
        if (thresholds.length > 1 && !GeneralTools.almostTheSame(thresholds[1],
                params.getDoubleParameterValue("threshold2"), 0.0001)) {
            panelParams.setNumericParameterValue("threshold2", thresholds[1]);
        }
        if (thresholds.length > 2 && !GeneralTools.almostTheSame(thresholds[2],
                params.getDoubleParameterValue("threshold3"), 0.0001)) {
            panelParams.setNumericParameterValue("threshold3", thresholds[2]);
        }
    }

    if (histogram != null) {
        histogramPanel.getHistogramData()
                .setAll(HistogramPanelFX.createHistogramData(histogram, false, (Color) null));
        histogramPanel.getChart().getXAxis().setLabel(scoreColumn);
        histogramPanel.getChart().getYAxis().setLabel("Count");

        ChartToolsFX.addChartExportMenu(histogramPanel.getChart(), null);

        //            histogramWrapper.setVerticalLines(thresholds, ColorToolsFX.getCachedColor(240, 0, 0, 128));
        // Deal with threshold adjustment
        //            histogramWrapper.getThresholds().addListener((Observable o) -> generatePlot());
    }

    if (pValues != null) {
        // TODO: Raise earlier where p-value calculation is
        if (pValuesChanged) {
            ObservableList<XYChart.Data<Number, Number>> data = FXCollections.observableArrayList();
            for (int i = 0; i < pValueThresholds.length; i++) {
                double pValue = pValues[i];
                if (Double.isNaN(pValue))
                    continue;
                data.add(new XYChart.Data<>(pValueThresholds[i], pValue, pValueThresholdsObserved[i]));
            }

            ObservableList<XYChart.Data<Number, Number>> dataSmoothed = null;
            if (pValuesSmoothed != null) {
                dataSmoothed = FXCollections.observableArrayList();
                for (int i = 0; i < pValueThresholds.length; i++) {
                    double pValueSmoothed = pValuesSmoothed[i];
                    if (Double.isNaN(pValueSmoothed))
                        continue;
                    dataSmoothed.add(new XYChart.Data<>(pValueThresholds[i], pValueSmoothed));
                }
            }

            // Don't bother showing the smoothed data... it tends to get in the way...
            //            if (dataSmoothed != null)
            //               chartPValues.getData().setAll(new XYChart.Series<>("P-values", data), new XYChart.Series<>("Smoothed P-values", dataSmoothed));
            //            else
            chartPValues.getData().setAll(new XYChart.Series<>("P-values", data));

            // Add line to show 0.05 significance threshold
            if (pValueThresholds.length > 1) {
                Data<Number, Number> sigData1 = new Data<>(pValueThresholds[0], 0.05);
                Data<Number, Number> sigData2 = new Data<>(pValueThresholds[pValueThresholds.length - 1], 0.05);
                XYChart.Series<Number, Number> dataSignificant = new XYChart.Series<>("Signficance 0.05",
                        FXCollections.observableArrayList(sigData1, sigData2));
                chartPValues.getData().add(dataSignificant);
                sigData1.getNode().setVisible(false);
                sigData2.getNode().setVisible(false);
            }

            //               chartPValues.getData().get(0).getNode().setVisible(true);

            //               pValuesWrapper.clearThresholds();
            for (XYChart.Data<Number, Number> dataPoint : data) {
                if (!Boolean.TRUE.equals(dataPoint.getExtraValue()))
                    dataPoint.getNode().setVisible(false);
            }
            //            if (dataSmoothed != null) {
            //               for (XYChart.Data<Number, Number> dataPoint : dataSmoothed) {
            //                  dataPoint.getNode().setVisible(false);
            //               }
            //               chartPValues.getData().get(1).getNode().setOpacity(0.5);
            //            }

            //               int count = 0;               
            //               for (int i = 0; i < pValueThresholds.length; i++) {
            //                  double pValue = pValues[i];
            //                  if (Double.isNaN(pValue))
            //                     continue;
            //                  boolean observed = pValueThresholdsObserved[i];
            ////                  if (observed)
            ////                     pValuesWrapper.addThreshold(new ReadOnlyDoubleWrapper(pValueThresholds[i]), Color.rgb(0, 0, 0, 0.05));
            //                  
            //                  if (!observed) {
            ////                     StackPane pane = (StackPane)data.get(count).getNode();
            ////                     pane.setEffect(new DropShadow());
            //                     data.get(count).getNode().setVisible(false);
            //                  }
            //                  count++;
            //               }
        }

        for (int i = 0; i < threshProperties.length; i++) {
            if (i < thresholds.length)
                threshProperties[i].set(thresholds[i]);
            else
                threshProperties[i].set(Double.NaN);
        }
        boolean isInteractive = interactiveThresholds();
        histogramWrapper.setIsInteractive(isInteractive);
        pValuesWrapper.setIsInteractive(isInteractive);

        chartPValues.setVisible(true);
    }
    //         else
    //            chartPValues.setVisible(false);

    // Store values for next time
    scoreData = newScoreData;
}

From source file:aajavafx.DevicesController.java

public ObservableList<String> getCustomer() throws IOException, JSONException {

    ObservableList<String> customerStrings = FXCollections.observableArrayList();
    //customers.add(new CustomerProperty(1, "Johny", "Walker", "London", "1972-07-01", "7207012222"));
    Customers myCustomer = new Customers();
    //Managers manager = new Managers();
    Gson gson = new Gson();
    ObservableList<CustomerProperty> customersProperty = FXCollections.observableArrayList();
    JSONObject jo = new JSONObject();

    // SSL update .......
    CredentialsProvider provider = new BasicCredentialsProvider();
    UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("EMPLOYEE", "password");
    provider.setCredentials(AuthScope.ANY, credentials);
    HttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(provider).build();
    HttpGet get = new HttpGet("http://localhost:8080/MainServerREST/api/customers");
    HttpResponse response = client.execute(get);
    System.out.println("RESPONSE IS: " + response);

    //JSONArray jsonArray = new JSONArray(IOUtils.toString(new URL("http://localhost:8080/MainServerREST/api/customers"), Charset.forName("UTF-8")));
    JSONArray jsonArray = new JSONArray(
            IOUtils.toString(response.getEntity().getContent(), Charset.forName("UTF-8")));
    // ...........
    System.out.println(jsonArray);
    for (int i = 0; i < jsonArray.length(); i++) {
        jo = (JSONObject) jsonArray.getJSONObject(i);
        myCustomer = gson.fromJson(jo.toString(), Customers.class);
        customers.add(myCustomer);/*w w w  .ja va  2 s  .co  m*/
        System.out.println(myCustomer.getCuId());
        String s = myCustomer.getCuId() + ". " + myCustomer.getCuFirstname() + " " + myCustomer.getCuLastname()
                + " " + myCustomer.getCuPersonnummer();
        customerStrings.add(s);
        customersProperty.add(new CustomerProperty(myCustomer.getCuId(), myCustomer.getCuFirstname(),
                myCustomer.getCuLastname(), myCustomer.getCuBirthdate(), myCustomer.getCuAddress(),
                myCustomer.getCuPersonnummer()));

    }
    return customerStrings;
}

From source file:de.bayern.gdi.gui.Controller.java

private void addStoredQueries(ObservableList<ItemModel> types) {
    List<WFSMeta.StoredQuery> queries = dataBean.getWFSService().getStoredQueries();
    for (WFSMeta.StoredQuery s : queries) {
        types.add(new StoredQueryModel(s));
    }// w w  w  .j  a  va2s.  co  m
}

From source file:de.bayern.gdi.gui.Controller.java

private void chooseAtomType(ItemModel data, boolean datasetAvailable) {
    Atom.Item item;/*  www  . jav  a 2 s.  c om*/
    if (datasetAvailable) {
        item = (Atom.Item) data.getItem();
        try {
            item.load();
        } catch (URISyntaxException | SAXException | ParserConfigurationException | IOException e) {
            log.error("Could not Load Item\n" + e.getMessage(), item);
            return;
        }
    } else {
        try {
            item = new Atom.Item(new URL(this.downloadConfig.getServiceURL()), "");
        } catch (Exception e) {
            return;
        }
    }
    if (wmsAtomMapHandler != null) {
        wmsAtomMapHandler.highlightSelectedPolygon(item.getID());
    }
    List<Atom.Field> fields = item.getFields();
    ObservableList<ItemModel> list = FXCollections.observableArrayList();
    for (Atom.Field f : fields) {
        AtomFieldModel afm = new AtomFieldModel(f);
        list.add(afm);
    }
    this.atomVariationChooser.setItems(list);
    this.atomVariationChooser.getSelectionModel().selectFirst();
    WebEngine engine = this.valueAtomDescr.getEngine();
    java.lang.reflect.Field f;
    try {
        f = engine.getClass().getDeclaredField("page");
        f.setAccessible(true);
        com.sun.webkit.WebPage page = (com.sun.webkit.WebPage) f.get(engine);
        page.setBackgroundColor((new java.awt.Color(BGCOLOR, BGCOLOR, BGCOLOR)).getRGB());
    } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
        // Displays the webview with white background...
    }
    engine.loadContent("<head> <style>" + ".description-content" + "{" + "font-family: Sans-Serif" + "}"
            + "</style> </head>" + "<div class=\"description-content\">" + item.getDescription() + "</div>");
    this.simpleWFSContainer.setVisible(false);
    this.basicWFSContainer.setVisible(false);
    this.atomContainer.setVisible(true);
}