add(new Label("name", pageMap.getName() == null ? "null" : pageMap.getName()));
add(new Label("size", "" + Bytes.bytes(pageMap.getSizeInBytes())));
// Get entry accesses
// Get entry accesses
final ArrayListStack accessStack;
if (pageMap instanceof AccessStackPageMap)
{
accessStack = ((AccessStackPageMap)pageMap).getAccessStack();
}
else
{
accessStack = new ArrayListStack();
}
final List reversedAccessStack = new ArrayList();
reversedAccessStack.addAll(accessStack);
Collections.reverse(reversedAccessStack);
// Create the table containing the list the components
add(new ListView("accesses", reversedAccessStack)
{
private static final long serialVersionUID = 1L;
/**
* Populate the table with Wicket elements
*/
protected void populateItem(final ListItem listItem)
{
final Access access = (Access)listItem.getModelObject();
IPageMapEntry entry = pageMap.getEntry(access.getId());
PageParameters parameters = new PageParameters();
parameters.put("pageId", "" + entry.getNumericId());
Link link = new BookmarkablePageLink("link", InspectorPage.class, parameters);
link.add(new Label("id", "" + entry.getNumericId()));
listItem.add(link);
listItem.add(new Label("class", "" + entry.getClass().getName()));
long size;
int versions;
if (entry instanceof Page)
{
Page page = (Page)entry;
page.detachModels();
size = page.getSizeInBytes();
versions = page.getVersions();
}
else
{
size = Objects.sizeof(entry);
versions = 0;
}
listItem.add(new Label("access", "" + (accessStack.size() - listItem.getIndex())));
listItem.add(new Label("version", "" + access.getVersion()));
listItem.add(new Label("versions", "" + versions));
listItem.add(new Label("size", size == -1 ? "[Unknown]" : "" + Bytes.bytes(size)));
}
});