📄 htmldatalist.java
字号:
/* * Copyright 2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.myfaces.custom.datalist;import javax.faces.component.UIComponent;import javax.faces.component.UIData;import javax.faces.context.FacesContext;import javax.faces.el.ValueBinding;import java.util.Iterator;import java.util.Map;/** * @author Manfred Geiler (latest modification by $Author: mmarinschek $) * @version $Revision: 1.7 $ $Date: 2005/03/24 10:06:22 $ */public class HtmlDataList extends UIData{ public void processDecodes(FacesContext context) { int first = getFirst(); int rows = getRows(); int last; if (rows == 0) { last = getRowCount(); } else { last = first + rows; } for (int rowIndex = first; rowIndex < last; rowIndex++) { setRowIndex(rowIndex); if (isRowAvailable()) { for (Iterator it = getChildren().iterator(); it.hasNext();) { UIComponent child = (UIComponent)it.next(); if (!child.isRendered()) { continue; } child.processDecodes(context); } } } setRowIndex(-1); } public void setRowIndex(int rowIndex) { super.setRowIndex(rowIndex); String rowIndexVar = getRowIndexVar(); String rowCountVar = getRowCountVar(); if (rowIndexVar != null || rowCountVar != null) { Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap(); if (rowIndex >= 0) { //regular row index, update request scope variables if (rowIndexVar != null) { requestMap.put(getRowIndexVar(), new Integer(rowIndex)); } if (rowCountVar != null) { requestMap.put(getRowCountVar(), new Integer(getRowCount())); } } else { //rowIndex == -1 means end of loop --> remove request scope variables if (rowIndexVar != null) { requestMap.remove(getRowIndexVar()); } if (rowCountVar != null) { requestMap.remove(getRowCountVar()); } } } } //------------------ GENERATED CODE BEGIN (do not modify!) -------------------- public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlDataList"; private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.List"; private String _layout = null; private String _rowIndexVar = null; private String _rowCountVar = null; public HtmlDataList() { setRendererType(DEFAULT_RENDERER_TYPE); } public void setLayout(String layout) { _layout = layout; } public String getLayout() { if (_layout != null) return _layout; ValueBinding vb = getValueBinding("layout"); return vb != null ? (String)vb.getValue(getFacesContext()) : null; } public void setRowIndexVar(String rowIndexVar) { _rowIndexVar = rowIndexVar; } public String getRowIndexVar() { if (_rowIndexVar != null) return _rowIndexVar; ValueBinding vb = getValueBinding("rowIndexVar"); return vb != null ? (String)vb.getValue(getFacesContext()) : null; } public void setRowCountVar(String rowCountVar) { _rowCountVar = rowCountVar; } public String getRowCountVar() { if (_rowCountVar != null) return _rowCountVar; ValueBinding vb = getValueBinding("rowCountVar"); return vb != null ? (String)vb.getValue(getFacesContext()) : null; } public Object saveState(FacesContext context) { Object values[] = new Object[4]; values[0] = super.saveState(context); values[1] = _layout; values[2] = _rowIndexVar; values[3] = _rowCountVar; return ((Object) (values)); } public void restoreState(FacesContext context, Object state) { Object values[] = (Object[])state; super.restoreState(context, values[0]); _layout = (String)values[1]; _rowIndexVar = (String)values[2]; _rowCountVar = (String)values[3]; } //------------------ GENERATED CODE END ---------------------------------------}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -