* @throws ModelException
*/
private ListContext createListContext(ModelRequest request, ListingDescriptor listing)
throws ConfigurationException
{
PreferencesManager preferencesManager = (PreferencesManager) SpringTools.getBean(PreferencesManager.ID);
String currentUserName = UserTools.getCurrentUserName(request);
Integer currentUserId = UserTools.getCurrentUserId(request);
ListContext context = new ListContext();
context.setRequest(request);
context.setListing(listing);
context.setUserName(currentUserName);
context.setUserEnvironment(UserTools.getUserEnvironment(request));
java.util.List configPath = getDerivationPath();
if (request.getParameter("recordsPerPage") != null)
{
int prefRows = preferencesManager.getInt(currentUserId, "gui", "tableRowsPerPage", 15);
context.setResultsPerPage(NumberTools.toInt(request.getParameterAsString("recordsPerPage"), prefRows));
}
else
{
int prefRecordsPerPage = preferencesManager.getInt(currentUserId, "gui", "tableRowsPerPage", 15);
context.setResultsPerPage(ModelTools.getConfigInt(configPath, "recordsPerPage", prefRecordsPerPage));
}
context.setNumPrevPages(ModelTools.getConfigInt(configPath, "numPrevPages", 4));