⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 groupbox.java

📁 非常接近C/S操作方式的Java Ajax框架-ZK 用ZK框架使你的B/S应用程序更漂亮更易操作。 官网:www.zkoss.org
💻 JAVA
字号:
/* Groupbox.java{{IS_NOTE	Purpose:			Description:			History:		Fri Jul 29 16:55:24     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 org.zkoss.zk.ui.Component;import org.zkoss.zk.ui.UiException;import org.zkoss.zk.ui.event.Events;import org.zkoss.zk.ui.ext.render.MultiBranch;import org.zkoss.zk.ui.ext.client.Openable;import org.zkoss.zul.impl.XulElement;/** * Groups a set of child elements to have a visual effect. * * @author tomyeh */public class Groupbox extends XulElement {	private Caption _caption;	private boolean _open = true, _closable = true;	/** Returns the caption of this groupbox.	 */	public Caption getCaption() {		return _caption;	}	/** Returns whether this groupbox is open.	 *	 * <p>Note: the default mold ({@link #getMold}) doesn't support	 * the open attribute.	 *	 * <p>Default: true.	 */	public boolean isOpen() {		return _open;	}	/** Opens or closes this groupbox.	 */	public void setOpen(boolean open) {		if (_open != open) {			_open = open;			smartUpdate("z.open", _open);		}	}	/** Returns whether user can open or close the group box.	 * In other words, if false, users are no longer allowed to	 * change the open status (by clicking on the title).	 *	 * <p>Default: true.	 */	public boolean isClosable() {		return _closable;	}	/** Sets whether user can open or close the group box.	 */	public void setClosable(boolean closable) {		if (_closable != closable) {			_closable = closable;			smartUpdate("z.closable", closable);		}	}	//-- super --//	public String getOuterAttrs() {		final StringBuffer sb = new StringBuffer(64).append(super.getOuterAttrs());		appendAsapAttr(sb, Events.ON_OPEN);		final String clkattrs = getAllOnClickAttrs(false);		if (clkattrs != null) sb.append(clkattrs);			//though widget.js handles onclick (if 3d), it is useful			//to support onClick for groupbox		if (!_closable)			sb.append(" z.closable=\"false\"");		return sb.toString();	}	//-- Component --//	public boolean insertBefore(Component child, Component insertBefore) {		if (child instanceof Caption) {			if (_caption != null && _caption != child)				throw new UiException("Only one caption is allowed: "+this);			if (!getChildren().isEmpty())				insertBefore = (Component)getChildren().get(0);				//always makes caption as the first child			_caption = (Caption)child;			invalidate();		} else if (insertBefore instanceof Caption) {			throw new UiException("caption must be the first child");		}		return super.insertBefore(child, insertBefore);	}	public void onChildRemoved(Component child) {		if (child instanceof Caption) {			_caption = null;			invalidate();		}		super.onChildRemoved(child);	}	//-- ComponentCtrl --//	protected Object newExtraCtrl() {		return new ExtraCtrl();	}	/** A utility class to implement {@link #getExtraCtrl}.	 * It is used only by component developers.	 */	protected class ExtraCtrl extends XulElement.ExtraCtrl	implements MultiBranch, Openable {		//-- MultiBranch --//		public boolean inDifferentBranch(Component child) {			return child instanceof Caption; //in different branch		}		//-- Openable --//		public void setOpenByClient(boolean open) {			_open = open;		}	}}

⌨️ 快捷键说明

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