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

📄 nativeinfo.java

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JAVA
字号:
/* NativeInfo.java{{IS_NOTE	Purpose:			Description:			History:		Tue Aug 21 10:20:34     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.zk.ui.metainfo;import java.util.Collections;import java.util.Iterator;import java.util.List;import java.util.LinkedList;import org.zkoss.idom.Namespace;import org.zkoss.zk.ui.Page;import org.zkoss.zk.ui.Component;import org.zkoss.zk.ui.ext.Native;import org.zkoss.zk.xel.ExValue;/** * Represents the compmonent infomation about the native components. * * <p>Note:it is not thread-safe. * * @author tomyeh * @since 3.0.0 */public class NativeInfo extends ComponentInfo {	private List _prokids, _epikids;	private NativeInfo _splitkid;	/** Declared namespaces (Namespace). */	private List _dns;	public NativeInfo(NodeInfo parent, ComponentDefinition compdef,	String tagnm) {		super(parent, compdef, tagnm);		if (!compdef.isNative())			throw new IllegalArgumentException("compdef must be native");	}	/** Returns a readonly list of the declared namespaces (never null).	 */	public List getDeclaredNamespaces() {		return _dns != null ? _dns: Collections.EMPTY_LIST;	}	/** Adds a declared namespace.	 */	public void addDeclaredNamespace(Namespace ns) {		if (_dns == null)			_dns = new LinkedList();		_dns.add(ns);	}	/** Adds a Sting child.	 */	public void appendChild(TextInfo text) {		appendChildDirectly(text);	}	/** Returns a readonly list of the prolog children ({@link NativeInfo}).	 * A prolog child is a special child of {@link NativeInfo}.	 * (it is not part of {@link #getChildren}	 * that is used to optimize the native components such that	 * ZK can use one native components to represent several {@link NativeInfo}.	 * In other words, a prolog child won't be created as part of	 * <p>The prolog children must be rendered before {@link #getChildren}.	 */	public List getPrologChildren() {		return _prokids != null ? _prokids: Collections.EMPTY_LIST;	}	/** Returns a readonly list of the epilog children ({@link NativeInfo}).	 * The epilog children must be rendered after {@link #getChildren}.	 */	public List getEpilogChildren() {		return _epikids != null ? _epikids: Collections.EMPTY_LIST;	}	/** Adds a prolog child.	 *	 * <p>Note: if child belong to other {@link ComponentInfo},	 * you have to remove them first before calling this method.	 * Otherwise, the result is unpreditable.	 *	 * @param child the prolog child.	 * @see #getPrologChildren	 */	public void addPrologChild(NativeInfo child) {		addPrologChildDirectly(child);	}	/** Adds a prolog child.	 *	 * @param child the prolog child. If child belongs to {@link #getChildren},	 * it will be removed first.	 * @see #getPrologChildren	 */	public void addPrologChild(ZScript child) {		addPrologChildDirectly(child);	}	/** Adds a prolog child.	 *	 * @param child the prolog child. If child belongs to {@link #getChildren},	 * it will be removed first.	 * @see #getPrologChildren	 */	public void addPrologChild(VariablesInfo child) {		addPrologChildDirectly(child);	}	/** Adds a prolog child.	 *	 * <p>Note: if child belong to other {@link ComponentInfo},	 * you have to remove them first before calling this method.	 * Otherwise, the result is unpreditable.	 *	 * @param child the prolog child.	 * @see #getPrologChildren	 */	public void addPrologChild(AttributesInfo child) {		addPrologChildDirectly(child);	}	/** Adds a text as a prolog child.	 */	public void addPrologChild(TextInfo text) {		addPrologChildDirectly(text);	}	/** Adds a prolog child.	 * @param chld the child can NOT be{@link ComponentInfo}.	 */	/*package*/ void addPrologChildDirectly(Object child) {		if (_prokids == null)			_prokids = new LinkedList();		_prokids.add(child);	}	/** Adds an epilog child.	 *	 * @param child the epilog child. If child belongs to {@link #getChildren},	 * it will be removed first.	 * @see #getPrologChildren	 */	public void addEpilogChild(NativeInfo child) {		addEpilogChildDirectly(child);	}	/** Adds an epilog child.	 *	 * @param child the epilog child. If child belongs to {@link #getChildren},	 * it will be removed first.	 * @see #getPrologChildren	 */	public void addEpilogChild(ZScript child) {		addEpilogChildDirectly(child);	}	/** Adds an epilog child.	 *	 * @param child the epilog child. If child belongs to {@link #getChildren},	 * it will be removed first.	 * @see #getPrologChildren	 */	public void addEpilogChild(VariablesInfo child) {		addEpilogChildDirectly(child);	}	/** Adds an epilog child.	 *	 * @param child the epilog child. If child belongs to {@link #getChildren},	 * it will be removed first.	 * @see #getPrologChildren	 */	public void addEpilogChild(AttributesInfo child) {		addEpilogChildDirectly(child);	}	/** Adds an epilog child.	 * @param chld the child can NOT be{@link ComponentInfo}.	 */	/*package*/ void addEpilogChildDirectly(Object child) {		if (_epikids == null)			_epikids = new LinkedList();		_epikids.add(child);	}	/** Returns the split child, or null if not available.	 * Each native info has at most one split child.	 * If a native info has a single child and the child is also	 * a native info, we can merge them by making the child as	 * the split child.	 *	 * @since 3.0.0	 */	public NativeInfo getSplitChild() {		return _splitkid;	}	/** Sets the split kid.	 * @see #getSplitChild	 * @since 3.0.0	 */	public void setSplitChild(NativeInfo child) {		_splitkid = child;	}	//super//	public Component newInstance(Page page) {		final Component comp = super.newInstance(page);		if (_dns != null) {			final Native nc = (Native)comp;			for (Iterator it = _dns.iterator(); it.hasNext();)				nc.addDeclaredNamespace((Namespace)it.next());		}		return comp;	}	public Object clone() {		final NativeInfo clone = (NativeInfo)super.clone();		if (clone._prokids != null)			clone._prokids = new LinkedList(clone._prokids);		if (clone._epikids != null)			clone._epikids = new LinkedList(clone._epikids);		return clone;	}}

⌨️ 快捷键说明

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