📄 footer.java
字号:
/* Footer.java{{IS_NOTE Purpose: Description: History: Fri Jan 19 12:27:04 2007, Created by tomyeh}}IS_NOTECopyright (C) 2007 Potix Corporation. All Rights Reserved.{{IS_RIGHT This program is distributed under GPL Version 2.0 in the hope that it will be useful, but WITHOUT ANY WARRANTY.}}IS_RIGHT*/package org.zkoss.zul;import java.util.List;import java.util.Iterator;import org.zkoss.xml.HTMLs;import org.zkoss.zk.ui.Component;import org.zkoss.zk.ui.UiException;import org.zkoss.zul.impl.LabelImageElement;/** * A column of the footer of a grid ({@link Grid}). * Its parent must be {@link Foot}. * * <p>Unlike {@link Column}, you could place any child in a grid footer. * * @author tomyeh */public class Footer extends LabelImageElement { private int _span = 1; public Footer() { } public Footer(String label) { setLabel(label); } public Footer(String label, String src) { setLabel(label); setImage(src); } /** Returns the grid that this belongs to. */ public Grid getGrid() { final Component comp = getParent(); return comp != null ? (Grid)comp.getParent(): null; } /** Returns the set of footers that this belongs to. * @deprecated As of release 2.4.1, due to confusion */ public Foot getFoot() { return (Foot)getParent(); } /** Returns the column index, starting from 0. */ public int getColumnIndex() { int j = 0; for (Iterator it = getParent().getChildren().iterator(); it.hasNext(); ++j) if (it.next() == this) break; return j; } /** Returns the column that is in the same column as * this footer, or null if not available. */ public Column getColumn() { final Grid grid = getGrid(); if (grid != null) { final Columns cs = grid.getColumns(); if (cs != null) { final int j = getColumnIndex(); final List cschs = cs.getChildren(); if (j < cschs.size()) return (Column)cschs.get(j); } } return null; } /** Returns number of columns to span this footer. * Default: 1. */ public int getSpan() { return _span; } /** Sets the number of columns to span this footer. * <p>It is the same as the colspan attribute of HTML TD tag. */ public void setSpan(int span) { if (_span != span) { _span = span; smartUpdate("colspan", Integer.toString(_span)); } } //-- super --// public String getOuterAttrs() { final StringBuffer sb = new StringBuffer(80).append(super.getOuterAttrs()); final String clkattrs = getAllOnClickAttrs(false); if (clkattrs != null) sb.append(clkattrs); final Column col = getColumn(); if (col != null) sb.append(col.getColAttrs()); if (_span != 1) HTMLs.appendAttribute(sb, "colspan", _span); return sb.toString(); } //-- Component --// public void setParent(Component parent) { if (parent != null && !(parent instanceof Foot)) throw new UiException("Wrong parent: "+parent); super.setParent(parent); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -