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

📄 page.java

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* Page.java{{IS_NOTE	Purpose:			Description:			History:		Fri Jun  3 18:17:32     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.zk.ui;import java.util.Map;import java.util.Collection;import java.util.Iterator;import java.util.List;import org.zkoss.xel.FunctionMapper;import org.zkoss.xel.VariableResolver;import org.zkoss.xel.Function;import org.zkoss.zk.scripting.Interpreter;import org.zkoss.zk.scripting.Namespace;import org.zkoss.zk.scripting.InterpreterNotFoundException;import org.zkoss.zk.ui.event.EventListener;import org.zkoss.zk.ui.metainfo.LanguageDefinition;import org.zkoss.zk.ui.metainfo.ComponentDefinition;import org.zkoss.zk.ui.metainfo.ComponentDefinitionMap;/** * A page. A desktop consists of a set of pages. * <p>When a ZK request is asking to render a new page, a new page is * created and components that are created duing this request all belong to * this page. * * <p>If a ZK requst is asking an update, it must have at lease one UUID of * a component ({@link Component#getUuid}. * From this UUID, we know which page it belongs and activate it * to process the update. * <p>By activation, the system guarantees no concurrent access to pages * and components (so you don't need use synchronized for them). * * <h2>Desktop</h2> * * <p>In portal and some environments, a client request (e.g., ServletRequest) * might consists of several ZK requests ({@link org.zkoss.zk.au.AuRequest}). * While each ZK request might ask to create an independent page, * all these pages are grouped as a desktop, such that they are activated * and removed at the same time. * Moreover, pages in the same desktop could communicate to eath other * (see <a href="#inter-page">Inter-page communication</a>). * * <p>A session, {@link Session}, might have multiple desktops of pages, * {@link Page}, while a page belongs to exactly one session. * A page, {@link Page}, might have many components, {@link Component}, while * a component belongs to exactly one page. * * <p>All components of the same desktop of pages are removed at the same time * if a page become 'obsolete'. * * <p>During each execution (${link Execution}), exactly one desktop of * pages are locked (aka., activated). Though an execution serves * a client request (e.g., ServletRequest), a client request might consist * of multiple ZK request ({@link org.zkoss.zk.au.AuRequest}). * Each ZK request might target to a different page (of the same desktop). * * <h2><a name="#inter-page"></a>Inter-page Communication</h2> * * <p>To do inter-page communication, you could do: * <ol> * <li>Invoke methods of components from another page directly.</li> * <li>Use {@link Execution#postEvent} to post events to components from * another page.</li> * </ol> * * <p>They are the same as handling components from the same page. * However, invoking method directly for components from another page has * one restriction:<br> * It cannot <b>create</b> component. * * @author tomyeh */public interface Page extends IdSpace {	/** Returns ID which is unique in the request (never null).	 *	 * <p>Note: it returns null when	 * {@link org.zkoss.zk.ui.util.Initiator#doInit} is called.	 */	public String getId();	/** Sets the identifier of this page.	 *	 * <p>Note: you can change the page's ID only in	 * {@link org.zkoss.zk.ui.util.Initiator#doInit}	 * or {@link org.zkoss.zk.ui.util.ExecutionInit#init}.	 * Once the page is initialized (by {@link org.zkoss.zk.ui.sys.PageCtrl#init}),	 * calling this	 * method will cause an exception.	 *	 * @exception UiException if the page is initialized, i.e.,	 * {@link org.zkoss.zk.ui.sys.PageCtrl#init} is called.	 */	public void setId(String id);	/** Returns UUID (universal unique ID) which is unquie in the whole	 * session. The UUID is generated automatically and immutable.	 *	 * <p>It is mainly used for communication between client and server	 * and you rarely need to access it.	 */	public String getUuid();	/** Returns the title of the desktop this page belongs to	 * (and evaluate it if it contains an expression).	 * <p>Default: "".	 */	public String getTitle();	/** Sets the title of the desktop this page belongs to	 * (it might contain an expression).	 */	public void setTitle(String title);	/** Returns the CSS style of this page, or empty if not specified.	 */	public String getStyle();	/** Sets the CSS style of this page.	 *	 * <p>Note: Unlike {@link #setTitle}, you can change the style only in	 * the lifecycle of the loading page.	 */	public void setStyle(String style);	/** Returns the request path of this page, or "" if not available.	 * <p>It is the same as the servlet path	 * (javax.servlet.http.HttpServletRequest's getServletPath), if ZK is running	 * at a servlet container.	 *	 * <p>Note: {@link Desktop#getRequestPath} returns the request path	 * that causes the desktop to create. And, there might be multiple	 * pages in the same desktop.	 *	 * @see Execution#getContextPath	 * @see Desktop#getRequestPath	 */	public String getRequestPath();	/** Returns the desktop that this page belongs to.	 *	 * <p>Note: it returns null when	 * {@link org.zkoss.zk.ui.util.Initiator#doInit} is called.	 */	public Desktop getDesktop();	/** Returns a readonly list of the root components.	 */	public Collection getRoots();	/** Used with {@link #getAttribute} and relevants to denote	 * custom attributes shared by the same page.	 * <p>It is also known as the page attributes.	 * <p>It is the same as {@link Page#getAttributes}.	 */	public static final int PAGE_SCOPE = Component.PAGE_SCOPE;	/** Used with {@link #getAttribute} and relevants to denote	 * custom attributes shared by the same desktop.	 * <p>It is also known as the desktop attributes.	 * <p>It is the same as {@link Desktop#getAttributes}.	 */	public static final int DESKTOP_SCOPE = Component.DESKTOP_SCOPE;	/** Used with {@link #getAttribute} and relevants to denote	 * custom attributes shared by the same session.	 * <p>It is also known as the session attributes.	 * <p>It is the same as {@link Session#getAttributes}.	 */	public static final int SESSION_SCOPE = Component.SESSION_SCOPE;	/** Used with {@link #getAttribute} and relevants to denote	 * custom attributes shared by the whole application.	 * <p>It is also known as the application attributes.	 * <p>It is the same as {@link WebApp#getAttributes}.	 */	public static final int APPLICATION_SCOPE = Component.APPLICATION_SCOPE;	/** Used with {@link #getAttribute} and relevants to denote	 * custom attributes shared by the same request.	 * <p>It is also known as the request attributes.	 * <p>It is the same as {@link Execution#getAttributes}.	 */	public static final int REQUEST_SCOPE = Component.REQUEST_SCOPE;	/** Returns all custom attributes of the specified scope.	 * You could reference them thru componentScope, spaceScope, pageScope,	 * requestScope and desktopScope in zscript and EL.	 *	 * <p>If scope is {@link #PAGE_SCOPE}, it means custom attributes shared	 * by components from the same page as this one's.	 * <p>If scope is {@link #DESKTOP_SCOPE}, it means custom attributes shared	 * by components from the same desktopas this one's.	 * @param scope {@link #APPLICATION_SCOPE}, {@link #SESSION_SCOPE},	 * {@link #PAGE_SCOPE}, {@link #REQUEST_SCOPE} or {@link #DESKTOP_SCOPE}.	 */	public Map getAttributes(int scope);	/** Returns the value of the specified custom attribute in the specified scope.	 *	 * <p>If scope is {@link #PAGE_SCOPE}, it means custom attributes shared	 * by components from the same page as this one's.	 * <p>If scope is {@link #DESKTOP_SCOPE}, it means custom attributes shared	 * by components from the same desktopas this one's.	 * @param scope {@link #APPLICATION_SCOPE}, {@link #SESSION_SCOPE},	 * {@link #PAGE_SCOPE}, {@link #REQUEST_SCOPE} or {@link #DESKTOP_SCOPE}.	 */	public Object getAttribute(String name, int scope);	/** Sets the value of the specified custom attribute in the specified scope.	 *	 * <p>If scope is {@link #PAGE_SCOPE}, it means custom attributes shared	 * by components from the same page as this one's.	 * <p>If scope is {@link #DESKTOP_SCOPE}, it means custom attributes shared	 * by components from the same desktopas this one's.	 * @param scope {@link #APPLICATION_SCOPE}, {@link #SESSION_SCOPE},	 * {@link #PAGE_SCOPE}, {@link #REQUEST_SCOPE} or {@link #DESKTOP_SCOPE}.	 */	public Object setAttribute(String name, Object value, int scope);	/** Removes the specified custom attribute in the specified scope.	 *	 * <p>If scope is {@link #PAGE_SCOPE}, it means custom attributes shared	 * by components from the same page as this one's.	 * <p>If scope is {@link #DESKTOP_SCOPE}, it means custom attributes shared	 * by components from the same desktopas this one's.	 * @param scope {@link #APPLICATION_SCOPE}, {@link #SESSION_SCOPE},	 * {@link #PAGE_SCOPE}, {@link #REQUEST_SCOPE} or {@link #DESKTOP_SCOPE}.	 */	public Object removeAttribute(String name, int scope);	/** Returns all custom attributes associated with this page.	 */	public Map getAttributes();	/** Returns the value of the specified attribute associated with this page.	 */	public Object getAttribute(String name);	/** Sets the value of the specified custom attribute associated with this page.	 *	 * <p>Note: The attribute is removed (by {@link #removeAttribute}	 * if value is null, while {@link #setVariable} considers null as a legal value.	 *	 * @param value the value. If null, the attribute is removed.	 */	public Object setAttribute(String name, Object value);	/** Removes the specified attribute custom associated with the page.	 */	public Object removeAttribute(String name);	/** Sets a variable to the namespace ({@link #getNamespace}).	 *	 * <p>It is the same as getNamespace().setVariable(name, value, true).	 *	 * @see Component#setVariable	 * @see Component#getNamespace	 */	public void setVariable(String name, Object val);	/** Returns whether the specified variable is defined.	 *	 * <p>Note: null is a valid value for variable, so this method is used	 * to know whether a variable is defined.	 * On the other hand, {@link #setAttribute} actually remove	 * an attribute (by {@link #removeAttribute} if value is null.	 */	public boolean containsVariable(String name);	/** Returns the value of a variable defined in the namespace ({@link #getNamespace}).	 *	 * <p>It is the same as getNamespace().getVariable(name, true).	 *

⌨️ 快捷键说明

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