Example usage for javafx.scene.layout BorderPane layout

List of usage examples for javafx.scene.layout BorderPane layout

Introduction

In this page you can find the example usage for javafx.scene.layout BorderPane layout.

Prototype

public final void layout() 

Source Link

Document

Executes a top-down layout pass on the scene graph under this parent.

Usage

From source file:de.hs.mannheim.modUro.controller.diagram.SimulationDiagramController.java

private void setChartContent(int selectedItemIndex, BorderPane pane) {
    // Very quick and dirty: TODO
    // New diagrams obtain size and size+1.
    if (selectedItemIndex == simulationDiagram.getMetricTypes().size()) {
        // This means cell count.
        CelltimesReader ctr = simulation.getCellTimesReader();
        if (ctr != null) {
            JCellCountDiagram ccd = new JCellCountDiagram(ctr.getCellTypes(), ctr.getNumberOfCells());
            ChartViewer viewer = new ChartViewer(ccd.chart);
            pane.setCenter(viewer);/*  w  w w .  jav  a 2  s  . c  om*/
        } else {
            // Cell count not available.
        }
    } else if (selectedItemIndex == simulationDiagram.getMetricTypes().size() + 1) {
        // And this means cell cycle times.
        CelltimesReader ctr = simulation.getCellTimesReader();
        if (ctr != null) {
            // TODO Q&D:
            CellCycleStat stat = new CellCycleStat(ctr.getCellTypes(), ctr.getCycletimes());
            System.out.println(stat);

            JCellcycletimeDiagram ctd = new JCellcycletimeDiagram(ctr.getCellTypes(), ctr.getCycletimes());
            ChartViewer viewer = new ChartViewer(ctd.chart);
            pane.setCenter(viewer);
        } else {
            // Cell count not available.
        }
    } else {
        double[][] data = ((MetricType) simulationDiagram.getMetricTypes().get(selectedItemIndex))
                .getMetricData();
        XYDataset dataset = createDataset(simulationDiagram.getSimulationName(), data);
        JFreeChart chart = createChart(dataset,
                simulationDiagram.getMetricTypes().get(selectedItemIndex).getName());
        ChartViewer viewer = new ChartViewer(chart);
        pane.setCenter(viewer);
    }
    pane.layout();
}