All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.adoptopenjdk.jitwatch.ui.stats.StatsTableBuilder Maven / Gradle / Ivy

/*
 * Copyright (c) 2017 Chris Newland.
 * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
 * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
 */
package org.adoptopenjdk.jitwatch.ui.stats;

import javafx.collections.ObservableList;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;

public final class StatsTableBuilder
{
	private StatsTableBuilder()
	{
	}

	public static TableView buildTableStats(ObservableList rows)
	{
		TableView tv = new TableView<>();

		TableColumn colName = new TableColumn("Name");
		colName.setCellValueFactory(new PropertyValueFactory("name"));
		colName.prefWidthProperty().bind(tv.widthProperty().multiply(0.33));

		TableColumn colValue = new TableColumn("Value");
		colValue.setCellValueFactory(new PropertyValueFactory("value"));
		colValue.prefWidthProperty().bind(tv.widthProperty().multiply(0.66));

		tv.getColumns().add(colName);
		tv.getColumns().add(colValue);

		tv.setItems(rows);

		return tv;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy