/
EliminatedAllocationRowBuilder.java
114 lines (100 loc) · 4.4 KB
/
EliminatedAllocationRowBuilder.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* Copyright (c) 2013-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.eliminatedallocation;
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 EliminatedAllocationRowBuilder
{
private EliminatedAllocationRowBuilder()
{
}
public static TableView<IReportRowBean> buildTable(ObservableList<IReportRowBean> rows)
{
TableView<IReportRowBean> tv = new TableView<>();
TableColumn<IReportRowBean, String> metaClass = new TableColumn<IReportRowBean, String>("Class");
metaClass.setCellValueFactory(new PropertyValueFactory<IReportRowBean, String>("metaClass"));
metaClass.setCellFactory(new Callback<TableColumn<IReportRowBean, String>, TableCell<IReportRowBean, String>>()
{
@Override
public TableCell<IReportRowBean, String> call(TableColumn<IReportRowBean, String> col)
{
return new TextTableCell();
}
});
TableColumn<IReportRowBean, String> member = new TableColumn<IReportRowBean, String>("Member");
member.setCellValueFactory(new PropertyValueFactory<IReportRowBean, String>("member"));
member.setCellFactory(new Callback<TableColumn<IReportRowBean, String>, TableCell<IReportRowBean, String>>()
{
@Override
public TableCell<IReportRowBean, String> call(TableColumn<IReportRowBean, String> col)
{
return new TextTableCell();
}
});
TableColumn<IReportRowBean, String> compilation = new TableColumn<IReportRowBean, String>("Compilation");
compilation.setCellValueFactory(new PropertyValueFactory<IReportRowBean, String>("compilation"));
compilation.setCellFactory(new Callback<TableColumn<IReportRowBean, String>, TableCell<IReportRowBean, String>>()
{
@Override
public TableCell<IReportRowBean, String> call(TableColumn<IReportRowBean, String> col)
{
return new TextTableCell();
}
});
TableColumn<IReportRowBean, Report> viewBCI = new TableColumn<IReportRowBean, Report>("BCI");
viewBCI.setCellValueFactory(new PropertyValueFactory<IReportRowBean, Report>("report"));
viewBCI.setCellFactory(new Callback<TableColumn<IReportRowBean, Report>, TableCell<IReportRowBean, Report>>()
{
@Override
public TableCell<IReportRowBean, Report> call(TableColumn<IReportRowBean, Report> col)
{
return new LinkedBCICell();
}
});
TableColumn<IReportRowBean, String> directOrInline = new TableColumn<IReportRowBean, String>("How");
directOrInline.setCellValueFactory(new PropertyValueFactory<IReportRowBean, String>("kind"));
directOrInline.setCellFactory(new Callback<TableColumn<IReportRowBean, String>, TableCell<IReportRowBean, String>>()
{
@Override
public TableCell<IReportRowBean, String> call(TableColumn<IReportRowBean, String> col)
{
return new TextTableCell();
}
});
TableColumn<IReportRowBean, String> eliminatedType = new TableColumn<IReportRowBean, String>("Eliminated Type");
eliminatedType.setCellValueFactory(new PropertyValueFactory<IReportRowBean, String>("eliminatedType"));
eliminatedType.setCellFactory(new Callback<TableColumn<IReportRowBean, String>, TableCell<IReportRowBean, String>>()
{
@Override
public TableCell<IReportRowBean, String> call(TableColumn<IReportRowBean, String> 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.12));
directOrInline.prefWidthProperty().bind(tv.widthProperty().multiply(0.1));
eliminatedType.prefWidthProperty().bind(tv.widthProperty().multiply(0.18));
tv.getColumns().add(metaClass);
tv.getColumns().add(member);
tv.getColumns().add(compilation);
tv.getColumns().add(viewBCI);
tv.getColumns().add(directOrInline);
tv.getColumns().add(eliminatedType);
tv.setItems(rows);
return tv;
}
}