use of com.agiletec.aps.tags.util.IPagerVO in project entando-core by entando.
the class AdminPagerTag method doStartTag.
@Override
public int doStartTag() throws JspException {
Object source = this.findValue(this.getSource());
ServletRequest request = this.pageContext.getRequest();
ValueStack stack = this.getStack();
ComponentPagerVO compPagerVo = new ComponentPagerVO(stack);
try {
AdminPagerTagHelper helper = this.getPagerHelper();
IPagerVO pagerVo = helper.getPagerVO((Collection) source, this.getPagerId(), this.getCount(), this.isAdvanced(), this.getOffset(), request);
compPagerVo.initPager(pagerVo);
stack.getContext().put(this.getObjectName(), compPagerVo);
stack.setValue("#attr['" + this.getObjectName() + "']", compPagerVo, false);
} catch (Throwable t) {
_logger.error("Error creating the pager", t);
// ApsSystemUtils.logThrowable(t, this, "doStartTag");
throw new JspException("Error creating the pager", t);
}
SubsetIteratorFilter subsetIteratorFilter = new SubsetIteratorFilter();
subsetIteratorFilter.setCount(this.getCount());
subsetIteratorFilter.setDecider(null);
subsetIteratorFilter.setSource(source);
subsetIteratorFilter.setStart(compPagerVo.getBegin());
subsetIteratorFilter.execute();
this.setSubsetIteratorFilter(subsetIteratorFilter);
this.getStack().push(subsetIteratorFilter);
if (getId() != null) {
pageContext.setAttribute(getId(), subsetIteratorFilter);
}
return EVAL_BODY_INCLUDE;
}
use of com.agiletec.aps.tags.util.IPagerVO in project entando-core by entando.
the class AdminPagerTagHelper method getPagerVO.
public IPagerVO getPagerVO(Collection collection, String pagerId, int max, boolean isAdvanced, int offset, ServletRequest request) throws ApsSystemException {
IPagerVO pagerVo = null;
try {
int item = this.getItemNumber(pagerId, request);
pagerVo = this.buildPageVO(collection, item, max, pagerId, isAdvanced, offset);
} catch (Throwable t) {
_logger.error("Error while building pagerVo", t);
throw new ApsSystemException("Error while building pagerVo", t);
}
return pagerVo;
}
use of com.agiletec.aps.tags.util.IPagerVO in project entando-core by entando.
the class PagerTag method doStartTag.
@Override
public int doStartTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
try {
Object object = this.pageContext.getAttribute(this.getListName());
Collection collection = (null != object && object instanceof SimpleSequence) ? ((SimpleSequence) object).toList() : (Collection) object;
if (collection == null) {
_logger.error("There is no list in the request");
} else {
PagerTagHelper helper = new PagerTagHelper();
IPagerVO pagerVo = helper.getPagerVO(collection, this.getPagerId(), this.isPagerIdFromFrame(), this.getMax(), this.isAdvanced(), this.getOffset(), request);
this.pageContext.setAttribute(this.getObjectName(), pagerVo);
}
} catch (Throwable t) {
_logger.error("Error detected during tag initialization", t);
// ApsSystemUtils.logThrowable(e, this, "doStartTag");
throw new JspException("Error detected during tag initialization", t);
}
return EVAL_BODY_INCLUDE;
}
Aggregations