_parent = (ValueListSpaceTag) JspUtils.getParent(this,
ValueListSpaceTag.class);
Locale local = _parent.getConfig().getLocaleResolver().resolveLocale(
(HttpServletRequest) pageContext.getRequest());
MessageSource message = _parent.getConfig().getMessageSource();
ValueListInfo valueListInfo = getValueListInfo();
// Create a map of parameters that are used to generate the links.
parameters = new HashMap(_parent.getTableInfo().getParameters());
// todo: set these correctly
parameters.put(ParameterNames.sortColumn, valueListInfo.getSortingColumn());
parameters.put(ParameterNames.sortDirection, valueListInfo.getSortingDirection());
StringBuffer sb = new StringBuffer();
page = _parent.getValueList().getValueListInfo().getPagingPage();
total = _parent.getValueList().getValueListInfo()
.getTotalNumberOfEntries();
qtyOnPage = _parent.getValueList().getValueListInfo()
.getPagingNumberPer();
numberOfPages = _parent.getValueList().getValueListInfo()
.getTotalNumberOfPages();
currentPage = (int) (page - (pages / 2));
if (currentPage < 1)
{
currentPage = 1;
}
maxPage = (currentPage - 1) + pages;
if (maxPage > numberOfPages)
{
currentPage -= (maxPage - numberOfPages);
maxPage = numberOfPages;
}
if (maxPage < 2)
{
maxPage = 0;
}
if (currentPage < 1)
{
currentPage = 1;
}
sb.append("\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\""
+ (getAttributes()==null ? "":(" "+getAttributes()))
+ ">\n");
sb.append(" <tr>\n");
if (showSummary == true)
{
sb.append(generateSumary(message, local));
sb.append(" <td align=\"right\">\n");
sb
.append("\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" >\n");
sb.append(" <tr>\n");
}
String value = null;
String delim = _parent.getConfig().getDisplayHelper().help(pageContext,
message.getMessage("paging.delim", null, "", local));
sb
.append(generateFocusControl(_parent.getValueList()
.getValueListInfo(), delim, message, local));