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

org.adoptopenjdk.jitwatch.ui.report.inlining.InliningRowBuilder 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.report.inlining;

import org.adoptopenjdk.jitwatch.report.Report;
import org.adoptopenjdk.jitwatch.ui.report.IReportRowBean;
import org.adoptopenjdk.jitwatch.ui.report.cell.LinkedBCICell;
import org.adoptopenjdk.jitwatch.ui.report.cell.TextTableCell;

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

public final class InliningRowBuilder
{
	private InliningRowBuilder()
	{
	}

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

		TableColumn metaClass = new TableColumn("Caller Class");
		metaClass.setCellValueFactory(new PropertyValueFactory("metaClass"));
		metaClass.setCellFactory(new Callback, TableCell>()
		{
			@Override
			public TableCell call(TableColumn col)
			{
				return new TextTableCell();
			}
		});

		TableColumn member = new TableColumn("Caller method");
		member.setCellValueFactory(new PropertyValueFactory("member"));
		member.setCellFactory(new Callback, TableCell>()
		{
			@Override
			public TableCell call(TableColumn col)
			{
				return new TextTableCell();
			}
		});

		TableColumn compilation = new TableColumn("Compilation");
		compilation.setCellValueFactory(new PropertyValueFactory("compilation"));
		compilation.setCellFactory(new Callback, TableCell>()
		{
			@Override
			public TableCell call(TableColumn col)
			{
				return new TextTableCell();
			}
		});

		TableColumn viewBCI = new TableColumn("BCI");
		viewBCI.setCellValueFactory(new PropertyValueFactory("report"));
		viewBCI.setCellFactory(new Callback, TableCell>()
		{
			@Override
			public TableCell call(TableColumn col)
			{
				return new LinkedBCICell();
			}
		});
		
		TableColumn success = new TableColumn("Inlined?");
		success.setCellValueFactory(new PropertyValueFactory("success"));
		success.setCellFactory(new Callback, TableCell>()
		{
			@Override
			public TableCell call(TableColumn col)
			{
				return new TextTableCell();
			}
		});

		TableColumn reason = new TableColumn("Reason");
		reason.setCellValueFactory(new PropertyValueFactory("reason"));
		reason.setCellFactory(new Callback, TableCell>()
		{
			@Override
			public TableCell call(TableColumn col)
			{
				return new TextTableCell();
			}
		});

		metaClass.prefWidthProperty().bind(tv.widthProperty().multiply(0.2));
		member.prefWidthProperty().bind(tv.widthProperty().multiply(0.2));
		compilation.prefWidthProperty().bind(tv.widthProperty().multiply(0.2));
		viewBCI.prefWidthProperty().bind(tv.widthProperty().multiply(0.10));
		success.prefWidthProperty().bind(tv.widthProperty().multiply(0.08));
		reason.prefWidthProperty().bind(tv.widthProperty().multiply(0.22));

		tv.getColumns().add(metaClass);
		tv.getColumns().add(member);
		tv.getColumns().add(compilation);
		tv.getColumns().add(viewBCI);
		tv.getColumns().add(success);
		tv.getColumns().add(reason);

		tv.setItems(rows);

		return tv;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy