DataGridTagModel dgm = DataGridUtil.getDataGridTagModel(getJspContext());
if(dgm == null)
throw new JspException(Bundle.getErrorString("DataGridTags_MissingDataGridModel"));
PagerModel pm = dgm.getState().getPagerModel();
assert pm != null;
if(_disableDefaultPager != null)
dgm.setDisableDefaultPagerRendering(_disableDefaultPager.booleanValue());
if(_pageSize != null)
pm.setPageSize(_pageSize.intValue());
if(_defaultPageSize != null)
pm.setDefaultPageSize(_defaultPageSize.intValue());
PagerRenderer pagerRenderer = null;
if(_pagerRendererClass != null) {
try {
pagerRenderer = (PagerRenderer)ExtensionUtil.instantiateClass(_pagerRendererClass, PagerRenderer.class);
assert pagerRenderer != null : "Expected a non-null pager renderer of type \"" + _pagerRendererClass + "\"";
}
catch(DataGridExtensionException e) {
String msg = Bundle.getErrorString("ConfigurePager_CantCreateCustomPagerRenderer", new Object[]{e});
throw new JspException(msg, e);
}
}
else if(_pagerFormat != null) {
if(_pagerFormat.equals(PAGER_FORMAT_FIRST_LAST_PREV_NEXT))
pagerRenderer = new FirstPreviousNextLastPagerRenderer();
else if(_pagerFormat.equals(PAGER_FORMAT_PREV_NEXT))
pagerRenderer = new PreviousNextPagerRenderer();
else
throw new JspException(Bundle.getErrorString("ConfigurePager_UnsupportedPagerFormat", new Object[]{_pagerFormat}));
}
if(pagerRenderer != null)
dgm.setPagerRenderer(pagerRenderer);
if(_pageHref != null && _pageAction != null)
throw new JspException(Bundle.getErrorString("ConfigurePager_CantSetHrefAndAction"));
if(_pageHref == null && _pageAction == null) {
LOGGER.info("The configurePager tag has no page action or HREF specified; using the current request URI instead.");
_pageHref = ((HttpServletRequest)JspUtil.getRequest(getJspContext())).getRequestURI();
}
if(_pageHref != null)
pm.setPageHref(_pageHref);
if(_pageAction != null)
pm.setPageAction(_pageAction);
}