return new AbstractReadOnlyModel<String>()
{
private static final long serialVersionUID = 1L;
private final IModel<Bytes> size = new SessionSizeModel(Session.get());
private final IModel<Bytes> totalSize = new SessionTotalSizeModel(Session.get());
@Override
public String getObject()
{
Bytes sessionSizeInBytes = size.getObject();
String sessionSizeAsString = sessionSizeInBytes != null
? sessionSizeInBytes.toString() : "unknown";
Bytes totalSizeInBytes = totalSize.getObject();
String totalSizeAsString = totalSizeInBytes != null ? totalSizeInBytes.toString()
: "unknown";
return sessionSizeAsString + " / " + totalSizeAsString;
}
@Override
public void detach()
{
super.detach();
size.detach();
totalSize.detach();
}
};
}