/** * <p>Return the value of the <code>first</code> property.</p> */ public int getFirstRow() { return getUIData().getFirst(); }
/** * @return int */ public int getFirstRow() { return getUIData().getFirst(); }
/** * @return the page index of the uidata */ public int getPageIndex() { UIData uiData = getUIData(); int rows = uiData.getRows(); if (0 == rows) { throw new FacesException("You need to set a value to the 'rows' attribute of component '" + uiData.getClientId(getFacesContext()) + "'" ); } int pageIndex; if (rows > 0) { pageIndex = uiData.getFirst() / rows + 1; } else { log.warn("DataTable " + uiData.getClientId(FacesContext.getCurrentInstance()) + " has invalid rows attribute."); pageIndex = 0; } if (uiData.getFirst() % rows > 0) { pageIndex++; } return pageIndex; }
protected void encodeNextPageListItem(FacesContext facesContext, ResponseWriter responseWriter, Paginator paginator, UIData uiData, String clientId, String namingContainerId) throws IOException { boolean enabled = ((uiData.getFirst() + uiData.getRows()) < uiData.getRowCount()); String nextPageLabel = paginator.getNextPageLabel(); encodeUnorderedListItem(facesContext, responseWriter, paginator, clientId, namingContainerId, "nextPage", nextPageLabel, enabled, false); }
protected void encodeLastPageListItem(FacesContext facesContext, ResponseWriter responseWriter, Paginator paginator, UIData uiData, String clientId, String namingContainerId) throws IOException { boolean enabled = ((uiData.getFirst() + uiData.getRows()) < uiData.getRowCount()); String lastPageLabel = paginator.getLastPageLabel(); encodeUnorderedListItem(facesContext, responseWriter, paginator, clientId, namingContainerId, "lastPage", lastPageLabel, enabled, false); }
protected void encodeLastPageListItem(FacesContext facesContext, ResponseWriter responseWriter, Paginator paginator, UIData uiData, String clientId) throws IOException { boolean enabled = ((uiData.getFirst() + uiData.getRows()) < uiData.getRowCount()); String lastPageLabel = paginator.getLastPageLabel(); encodeUnorderedListItem(facesContext, responseWriter, paginator, clientId, "lastPage", lastPageLabel, enabled, false); }
protected void encodeNextPageListItem(FacesContext facesContext, ResponseWriter responseWriter, Paginator paginator, UIData uiData, String clientId, String namingContainerId) throws IOException { boolean enabled = ((uiData.getFirst() + uiData.getRows()) < uiData.getRowCount()); String nextPageLabel = paginator.getNextPageLabel(); encodeUnorderedListItem(facesContext, responseWriter, paginator, clientId, namingContainerId, "nextPage", nextPageLabel, enabled, false); }
protected void encodeNextPageListItem(FacesContext facesContext, ResponseWriter responseWriter, Paginator paginator, UIData uiData, String clientId) throws IOException { boolean enabled = ((uiData.getFirst() + uiData.getRows()) < uiData.getRowCount()); String nextPageLabel = paginator.getNextPageLabel(); encodeUnorderedListItem(facesContext, responseWriter, paginator, clientId, "nextPage", nextPageLabel, enabled, false); }
protected void encodeLastPageListItem(FacesContext facesContext, ResponseWriter responseWriter, Paginator paginator, UIData uiData, String clientId, String namingContainerId) throws IOException { boolean enabled = ((uiData.getFirst() + uiData.getRows()) < uiData.getRowCount()); String lastPageLabel = paginator.getLastPageLabel(); encodeUnorderedListItem(facesContext, responseWriter, paginator, clientId, namingContainerId, "lastPage", lastPageLabel, enabled, false); }
public UIData getUIData() { String forStr = getFor(); UIData forComp = (UIData) CoreComponentUtils.findComponent(forStr, this); if (forComp == null) { throw new IllegalArgumentException( "could not find UIData referenced by attribute @for = '" + forStr + "'"); } else if (!(forComp instanceof UIData)) { throw new IllegalArgumentException( "uiComponent referenced by attribute @for = '" + forStr + "' must be of type " + UIData.class.getName() + ", not type " + forComp.getClass().getName()); } //compare with cached DataModel to check for updates if( _origDataModelHash != 0 && _origDataModelHash != forComp.getValue().hashCode()){ reset(); } if (!isIgnorePagination() && ((first != Integer.MIN_VALUE && first != forComp.getFirst()) || (rows != Integer.MIN_VALUE && rows != forComp.getRows())) ) { reset(); } Object value = forComp.getValue(); if (null != value) { _origDataModelHash = forComp.getValue().hashCode(); } return forComp; }
protected void processColumnsChildren(FacesContext context, PhaseId phaseId) { int first = getFirst(); int rows = getRows(); int last = (rows != 0) ? (first + rows) : getRowCount(); for (int rowIndex = first; rowIndex < last; rowIndex++) { setRowIndex(rowIndex); if (!isRowAvailable()) { continue; } for (Iterator children = getChildren().iterator(); children .hasNext();) { UIComponent child = (UIComponent) children.next(); if (!(child instanceof UIColumn)) { continue; } for (Iterator grandChildren = child.getChildren().iterator(); grandChildren .hasNext();) { UIComponent grandChild = (UIComponent) grandChildren.next(); if (!grandChild.isRendered()) { continue; } ComponentUtil_.processAppropriatePhaseAction(context, grandChild, phaseId); } } } setRowIndex(-1); }
/** * Sets the dataPaginator to the (n) number of pages back, defined by the * fastStep property */ public void gotoFastRewind() { int fastStep = getFastStep(); if (fastStep <= 0) { fastStep = 1; } int previous = getUIData().getFirst() - getUIData().getRows() * fastStep; if (previous < 0) { previous = 0; } getUIData().setFirst(previous); }
private void processRows(FacesContext context, int processAction) { UIData parentUIData = getParentUIData(); int first = parentUIData.getFirst(); int rows = parentUIData.getRows(); int last; if (rows == 0) { last = parentUIData.getRowCount(); } else { last = first + rows; } for (int rowIndex = first; rowIndex < last; rowIndex++) { parentUIData.setRowIndex(rowIndex); if (parentUIData.isRowAvailable()) { processColumns(context, processAction); } } }
/** * Sets the dataPaginator to the previous page */ public void gotoPreviousPage() { if (isModelResultSet()) { int first = getUIData().getFirst() - getUIData().getRows(); if (first < 0) { first = 0; } getUIData().setFirst(first); } else { int previous = getUIData().getFirst() - getUIData().getRows(); int rowCount = getRowCount(); if (previous >= 0) { if (previous > rowCount) { previous = rowCount; } getUIData().setFirst(previous); } } }
ResponseWriter writer = facesContext.getResponseWriter(); int first = uiData.getFirst(); int rows = uiData.getRows(); int last;
/** * Sets the dataPaginator to the (n) number of pages forward, defined by the * fastStep property */ public void gotoFastForward() { int fastStep = getFastStep(); if (fastStep <= 0) { fastStep = 1; } int next = getUIData().getFirst() + getUIData().getRows() * fastStep; int rowcount = getUIData().getRowCount(); if (next >= rowcount) { next = (rowcount - 1) - ((rowcount - 1) % getUIData().getRows()); } getUIData().setFirst(next); }
int rows = 0; if (visitRows) { rowIndex = getFirst() - 1; rows = getRows();
/** * Sets the dataPaginator to the next page */ public void gotoNextPage() { int next = getUIData().getFirst() + getUIData().getRows(); if (isModelResultSet()) { getUIData().setRowIndex(next); if (getUIData().isRowAvailable()) { getUIData().setFirst(next); } } else { if (next < getUIData().getRowCount()) { getUIData().setFirst(next); } } }
int rowIndex = data.getFirst() - 1; int rows = data.getRows();
/** * Sets the dataPaginator to the last page */ public void gotoLastPage() { if (isModelResultSet()) { int first = getUIData().getFirst(); while (true) { getUIData().setRowIndex(first + 1); if (getUIData().isRowAvailable()) { first++; } else { break; } } getUIData().setFirst(first - (first % getUIData().getRows())); } else { int rowcount = getUIData().getRowCount(); int rows = getUIData().getRows(); int delta = rowcount % rows; int first = delta > 0 && delta < rows ? rowcount - delta : rowcount - rows; if (first >= 0) { getUIData().setFirst(first); } else { getUIData().setFirst(0); } } }