return activeComponent;
}
public void processEvent(SystemEvent event) throws AbortProcessingException {
AbstractDataScroller activeDataScroller = null;
UIComponent dataTable = null;
FacesContext facesContext = FacesContext.getCurrentInstance();
UIComponent source = (UIComponent) event.getSource();
if ((source instanceof UIDataAdaptor) || (source instanceof UIData)) {
dataTable = source;
List<AbstractDataScroller> dataScrollers = DataScrollerUtils.findDataScrollers(dataTable);
if (!dataScrollers.isEmpty()) {
activeDataScroller = processActiveDatascroller(facesContext, dataScrollers, dataTable);
}
} else if (source instanceof AbstractDataScroller) {
activeDataScroller = (AbstractDataScroller) source;
dataTable = activeDataScroller.getDataTable();
}
if ((activeDataScroller != null) && (dataTable != null)) {
DataComponentsContextUtil.resetDataModelOncePerPhase(facesContext, dataTable);
String scrollerStateKey = dataTable.getClientId(facesContext) + AbstractDataScroller.SCROLLER_STATE_ATTRIBUTE;
int rowCount = DataScrollerUtils.getRowCount(dataTable);
int rows = DataScrollerUtils.getRows(dataTable);
int pageCount = DataScrollerUtils.getPageCount(dataTable, rowCount, rows);
int page = activeDataScroller.getPage();
int newPage = -1;
if (page < 1) {
newPage = 1;
} else if (page > pageCount) {
newPage = (pageCount != 0 ? pageCount : 1);
}
if (newPage != -1) {
Object label = MessageUtil.getLabel(facesContext, activeDataScroller);
String formattedMessage = Messages.getMessage(Messages.DATASCROLLER_PAGE_MISSING, new Object[] { label, page,
pageCount, newPage });
LOG.warn(formattedMessage);
page = newPage;
dataTable.getAttributes().put(scrollerStateKey, page);
}
int first;
String lastPageMode = activeDataScroller.getLastPageMode();
if (lastPageMode == null) {
lastPageMode = AbstractDataScroller.PAGEMODE_SHORT;
} else if (!AbstractDataScroller.PAGEMODE_SHORT.equals(lastPageMode)
&& !AbstractDataScroller.PAGEMODE_FULL.equals(lastPageMode)) {