tabpanel.java

来自「非常接近C/S操作方式的Java Ajax框架-ZK 用ZK框架使你的B/S应」· Java 代码 · 共 96 行

JAVA
96
字号
/* Tabpanel.java{{IS_NOTE	Purpose:			Description:			History:		Tue Jul 12 10:43:10     2005, Created by tomyeh}}IS_NOTECopyright (C) 2005 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.Iterator;import org.zkoss.xml.HTMLs;import org.zkoss.zk.ui.Component;import org.zkoss.zk.ui.UiException;import org.zkoss.zul.impl.XulElement;/** * A tab panel. * * @author tomyeh */public class Tabpanel extends XulElement {	public Tabpanel() {	}	/** Returns the tabbox owns this component.	 */	public Tabbox getTabbox() {		final Tabpanels panels = (Tabpanels)getParent();		return panels != null ? panels.getTabbox(): null;	}	/** Returns the tab associated with this tab panel.	 */	public Tab getLinkedTab() {		final int j = getIndex();		if (j >= 0) {			final Tabbox tabbox = getTabbox();			if (tabbox != null) {				final Tabs tabs = tabbox.getTabs();				if (tabs != null && tabs.getChildren().size() > j)					return (Tab)tabs.getChildren().get(j);			}		}		return null;	}	/** Returns whether this tab panel is selected.	 */	public boolean isSelected() {		final Tab tab = getLinkedTab();		return tab != null && tab.isSelected();	}	/** Returns the index of this panel, or -1 if it doesn't belong to any	 * tabpanels.	 */	public int getIndex() {		final Tabpanels tabpanels = (Tabpanels)getParent();		if (tabpanels == null)			return -1;		int j = 0;		for (Iterator it = tabpanels.getChildren().iterator();; ++j)			if (it.next() == this)				return j;	}	//-- super --//	public String getOuterAttrs() {		final String attrs = super.getOuterAttrs();		final String clkattrs = getAllOnClickAttrs(false);		return clkattrs == null ? attrs: attrs + clkattrs;	}	//-- Component --//	public boolean isVisible() {		return super.isVisible() && isSelected();	}	public void setParent(Component parent) {		if (parent != null && !(parent instanceof Tabpanels))			throw new UiException("Wrong parent: "+parent);		super.setParent(parent);	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?