});
// checkbox for chart rendering, unsortable
{
Column<NamespaceBreakdown, Boolean> checkColumn = new Column<NamespaceBreakdown, Boolean>(
new CheckboxCell(true, false)) {
@Override
public Boolean getValue(NamespaceBreakdown object) {
return namespaceSelectionModel.isSelected(object);
}
};
//empty nothing
namespaceTable.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
}
// namespace column
{
SortableColumn<NamespaceBreakdown, String> column =
new SortableColumn<NamespaceBreakdown, String>(new TextCell()) {
@Override
public String getValue(NamespaceBreakdown breakdown) {
return breakdown.getNamespace();
}
};
namespaceTable.addColumn(column, "Namespace");
namespaceSortHandler.setComparator(column, new Comparator<NamespaceBreakdown>() {
@Override
public int compare(NamespaceBreakdown o1, NamespaceBreakdown o2) {
return o1.getNamespace().compareTo(o2.getNamespace());
}
});
}
// entity count
{
SortableColumn<NamespaceBreakdown, String> column =
new SortableColumn<NamespaceBreakdown, String>(new TextCell()) {
@Override
public String getValue(NamespaceBreakdown breakdown) {
return breakdown.getCount().toString();
}
};
namespaceTable.addColumn(column, "Count");
namespaceSortHandler.setComparator(column, new Comparator<NamespaceBreakdown>() {
@Override
public int compare(NamespaceBreakdown o1, NamespaceBreakdown o2) {
return o1.getCount().compareTo(o2.getCount());
}
});
}
// entity size
{
SortableColumn<NamespaceBreakdown, String> column =
new SortableColumn<NamespaceBreakdown, String>(new TextCell()) {
@Override
public String getValue(NamespaceBreakdown breakdown) {
return breakdown.getBytes().toString();
}
};
namespaceTable.addColumn(column, "Size(Bytes)");
namespaceSortHandler.setComparator(column, new Comparator<NamespaceBreakdown>() {
@Override
public int compare(NamespaceBreakdown o1, NamespaceBreakdown o2) {
return o1.getBytes().compareTo(o2.getBytes());
}
});
}
}
// init property type table
{
propertySortHandler = new SortHandler<PropertyTypeBreakdown>();
propertyTypeTable = new CellTable<PropertyTypeBreakdown>();
propertyTypeTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
propertyTypeTable.addColumnSortHandler(propertySortHandler);
propertyTypeTable.setVisibleRange(0, Integer.MAX_VALUE);
propertySelectionModel =
new MultiSelectionModel<PropertyTypeBreakdown>(PropertyTypeBreakdown.KEY_PROVIDER);
propertyTypeTable.setSelectionModel(propertySelectionModel,
DefaultSelectionEventManager.<PropertyTypeBreakdown>createCheckboxManager());
propertySelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
refreshPropertyTypeChart();
}
});
// checkbox for chart rendering, unsortable
{
Column<PropertyTypeBreakdown, Boolean> checkColumn = new Column<PropertyTypeBreakdown, Boolean>(
new CheckboxCell(true, false)) {
@Override
public Boolean getValue(PropertyTypeBreakdown object) {
return propertySelectionModel.isSelected(object);
}
};
//empty nothing
propertyTypeTable.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
}
// property type
{
SortableColumn<PropertyTypeBreakdown, String> column =
new SortableColumn<PropertyTypeBreakdown, String>(new TextCell()) {
@Override
public String getValue(PropertyTypeBreakdown property) {
return property.getPropertyType();
}
};
propertyTypeTable.addColumn(column, "Type");
propertySortHandler.setComparator(column, new Comparator<PropertyTypeBreakdown>() {
@Override
public int compare(PropertyTypeBreakdown o1, PropertyTypeBreakdown o2) {
return o1.getPropertyType().compareTo(o2.getPropertyType());
}
});
}
// count
{
SortableColumn<PropertyTypeBreakdown, String> column =
new SortableColumn<PropertyTypeBreakdown, String>(new TextCell()) {
@Override
public String getValue(PropertyTypeBreakdown property) {
return property.getCount().toString();
}
};
propertyTypeTable.addColumn(column, "Count");
propertySortHandler.setComparator(column, new Comparator<PropertyTypeBreakdown>() {
@Override
public int compare(PropertyTypeBreakdown o1, PropertyTypeBreakdown o2) {
return o1.getCount().compareTo(o2.getCount());
}
});
}
// size
{
SortableColumn<PropertyTypeBreakdown, String> column =
new SortableColumn<PropertyTypeBreakdown, String>(new TextCell()) {
@Override
public String getValue(PropertyTypeBreakdown property) {
return property.getBytes().toString();
}
};
propertyTypeTable.addColumn(column, "Size(Bytes)");
propertySortHandler.setComparator(column, new Comparator<PropertyTypeBreakdown>() {
@Override
public int compare(PropertyTypeBreakdown o1, PropertyTypeBreakdown o2) {
return o1.getBytes().compareTo(o2.getBytes());
}
});
}
}
// init kinds table with sorting handlers
{
kindSortHandler = new SortHandler<KindBreakdown>();
kindTable = new CellTable<KindBreakdown>();
kindTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
kindTable.addColumnSortHandler(kindSortHandler);
kindTable.setVisibleRange(0, Integer.MAX_VALUE);
kindSelectionModel =
new MultiSelectionModel<KindBreakdown>(KindBreakdown.KEY_PROVIDER);
kindTable.setSelectionModel(kindSelectionModel,
DefaultSelectionEventManager.<KindBreakdown>createCheckboxManager());
kindSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
refreshKindChart();
}
});
// checkbox for chart rendering, unsortable
{
Column<KindBreakdown, Boolean> checkColumn = new Column<KindBreakdown, Boolean>(
new CheckboxCell(true, false)) {
@Override
public Boolean getValue(KindBreakdown object) {
return kindSelectionModel.isSelected(object);
}
};