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

📄 component.java

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	 * {@link #PAGE_SCOPE}, {@link #DESKTOP_SCOPE}, {@link #SESSION_SCOPE},	 * {@link #REQUEST_SCOPE} or {@link #APPLICATION_SCOPE}, 	 */	public Map getAttributes(int scope);	/** Returns the value of the specified custom attribute in the specified scope,	 * or null if not defined.	 *	 * <p>If scope is {@link #COMPONENT_SCOPE}, it means attributes private	 * to this component.	 * <p>If scope is {@link #SPACE_SCOPE}, it means custom attributes shared	 * by components from the same ID space as this one's.	 * <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 #COMPONENT_SCOPE}, {@link #SPACE_SCOPE},	 * {@link #PAGE_SCOPE}, {@link #DESKTOP_SCOPE}, {@link #SESSION_SCOPE},	 * {@link #REQUEST_SCOPE} or {@link #APPLICATION_SCOPE}, 	 */	public Object getAttribute(String name, int scope);	/** Sets the value of the specified custom attribute in the specified scope.	 *	 * <p>Note: The attribute is removed (by {@link #removeAttribute}	 * if value is null, while {@link #setVariable} considers null as a legal value.	 *	 * <p>If scope is {@link #COMPONENT_SCOPE}, it means custom attributes private	 * to this component.	 * <p>If scope is {@link #SPACE_SCOPE}, it means custom attributes shared	 * by components from the same ID space as this one's.	 * <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 #COMPONENT_SCOPE}, {@link #SPACE_SCOPE},	 * {@link #PAGE_SCOPE}, {@link #DESKTOP_SCOPE}, {@link #SESSION_SCOPE},	 * {@link #REQUEST_SCOPE} or {@link #APPLICATION_SCOPE}, 	 * @param value the value. If null, the attribute is removed.	 */	public Object setAttribute(String name, Object value, int scope);	/** Removes the specified custom attribute in the specified scope.	 * <p>If scope is {@link #COMPONENT_SCOPE}, it means attributes private	 * to this component.	 * <p>If scope is {@link #SPACE_SCOPE}, it means custom attributes shared	 * by components from the same ID space as this one's.	 * <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 #COMPONENT_SCOPE}, {@link #SPACE_SCOPE},	 * {@link #PAGE_SCOPE}, {@link #DESKTOP_SCOPE}, {@link #SESSION_SCOPE},	 * {@link #REQUEST_SCOPE} or {@link #APPLICATION_SCOPE}, 	 */	public Object removeAttribute(String name, int scope);	/** Returns all custom attributes associated with this component, i.e.,	 * {@link #COMPONENT_SCOPE}.	 */	public Map getAttributes();	/** Returns the custom attribute associated with this component, i.e.,	 * {@link #COMPONENT_SCOPE}.	 */	public Object getAttribute(String name);	/** Sets the custom attribute associated with this component, i.e.,	 * {@link #COMPONENT_SCOPE}.	 */	public Object setAttribute(String name, Object value);	/** Removes the custom attribute associated with this component, i.e.,	 * {@link #COMPONENT_SCOPE}.	 */	public Object removeAttribute(String name);	/** Sets a variable to the namespace.	 *	 * <p>This method is the same as	 * getNamespace().setVariable(name, value, local).	 *	 * <p>Once a variable is set thru this method, it is visible to	 * both the interpreter and EL.	 *	 * <p>Note: Exactly one namespace is allocated for each ID space.	 * For example, if the space owner of this component is the page, then	 * the returned namespace is the same as {@link Page#getNamespace}.	 * Otherwise, it is the same as the namspace returned by the component	 * owning this ID space.	 *	 * <h3>When to use setVariable and setAttribute?</h3>	 *	 * <p>First, only the ID space support {@link #setVariable} and so.	 * Second, the variables can be referenced directly in zscript and EL	 * expressions, while attributes are referenced thru the scope,	 * such as spaceScope.	 * On the other hand, using attributes causes less name popultion.	 * In general, if you could use attributes, don't use variable.	 *	 * @param local whether not to search any of the ancestor namespace defines	 * the variable. If local is false and an ancesotor has defined a variable	 * with the same name, the variable in the ancestor is changed directly.	 * Otherwise, a new variable is created in the namespace containing	 * this component.	 * @see #getSpaceOwner	 * @see #getNamespace	 */	public void setVariable(String name, Object val, boolean local);	/** 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.	 *	 * @param local whether not to search its ancestor.	 * If false and the current namespace doen't define the variable,	 * it searches up its ancestor (via {@link #getParent}) to see	 * any of them has defined the specified variable.	 */	public boolean containsVariable(String name, boolean local);	/** Returns the value of a variable defined in the namespace,	 * or null if not defined or the value is null.	 *	 * <p>This method is the same as getNamespace().getVariable(name, local).	 *	 * <h3>Differences between {@link #getVariable} and {@link Page#getZScriptVariable}</h3>	 *	 * <p>{@link #getVariable} returns only variables defined by	 * {@link #setVariable} (i.e., a shortcut of {@link Namespace#setVariable}).	 * On the other hand, {@link Page#getZScriptVariable} returns these variables	 * and those defined when executing zscripts.	 *	 * @param local whether not to search its ancestor.	 * If false and the current namespace doen't define the variable,	 * it searches up its ancestor (via {@link #getParent}) to see	 * any of them has defined the specified variable.	 * @see #getSpaceOwner	 * @see #getNamespace	 */	public Object getVariable(String name, boolean local);	/** Unsets a variable defined in the namespace.	 *	 * <p>This method is the same as  getNamespace().getVariable(name, local).	 *	 * @param local whether not to search its ancestor.	 * If false and the current namespace doen't define the variable,	 * it searches up its ancestor (via {@link #getParent}) to see	 * any of them has defined the specified variable.	 * @see #getSpaceOwner	 * @see #getNamespace	 */	public void unsetVariable(String name, boolean local);	/** Returns the parent component, or null if this is the root component.	 */	public Component getParent();	/** Sets the parent component.	 *	 * <p>Note: {@link #setParent} always calls back {@link #insertBefore}	 * and/or {@link #removeChild},	 * while {@link #insertBefore} and {@link #removeChild}	 * always calls back {@link #setParent},	 * if the parent is changed. Thus, you don't need to override 	 * both {@link #insertBefore} and {@link #setParent}, if you want	 * to customize the behavior.	 */	public void setParent(Component parent);	/** Returns a live list of children.	 * You could add or remove a child by manipulating the returned list directly.	 */	public List getChildren();	/** Returns the root of this component.	 */	public Component getRoot();	/** Returns whether this component is visible.	 * @see Components#isRealVisible	 */	public boolean isVisible();	/** Sets whether this component is visible.	 *	 * @return the previous visibility	 */	public boolean setVisible(boolean visible);	/** Inserts a child before the reference child.	 *	 * <p>You could use {@link #setParent} or {@link #appendChild}	 * instead of this method, unless	 * you want to control where to put the child.	 *	 *	 * <p>Note: {@link #setParent} always calls back {@link #insertBefore}	 * and/or {@link #removeChild},	 * while {@link #insertBefore} and {@link #removeChild}	 * always calls back {@link #setParent},	 * if the parent is changed. Thus, you don't need to override 	 * both {@link #insertBefore} and {@link #setParent}, if you want	 * to customize the behavior.	 *	 * @param newChild the new child to be inserted.	 * @param refChild the child before which you want the new child	 * being inserted. If null, the new child is append to the end.	 * @return true if newChild is added successfully or moved;	 * false if it already has the specified child and the order doesn't	 * change.	 */	public boolean insertBefore(Component newChild, Component refChild);	/** Appends a child.	 * A shortcut to insertBefore(child, null).	 *	 * @see #insertBefore	 */	public boolean appendChild(Component child);	/** Removes a child. The child is not actually removed.	 * Rather, it is detached (see {@link #detach}) and it will be removed	 * if it is no longer used.	 *	 * <p>You could use {@link #setParent} with null instead of this method.	 *	 * <p>Note: {@link #setParent} always calls back {@link #insertBefore}	 * and/or {@link #removeChild},	 * while {@link #insertBefore} and {@link #removeChild}	 * always calls back {@link #setParent},	 * if the parent is changed. Thus, you don't need to override 	 * both {@link #insertBefore} and {@link #setParent}, if you want	 * to customize the behavior.	 *	 * @return true if child is removed successfully; false if it doesn't	 * have the specified child	 */	public boolean removeChild(Component child);	/** Detaches this component such that it won't belong to any page.	 * If you don't call {@link #setParent} or {@link #setPage} to	 * attach it to any page, it will be removed automatically	 * (from the client) after the current event is processed.	 */	public void detach();	/** Called when a child is added.	 * If a component want to optimize the update, it might do something	 * different. Otherwise, it does nothing.	 *	 * <p>Note: {@link #onChildAdded} is called in the request-processing	 * phase, while {@link #onDrawNewChild} is called in the redrawing phase.	 * See {@link #onDrawNewChild} for more details.	 *	 * <p>It is not a good idea to throw an exception in this method, since	 * it is in the middle of modifying the component tree.	 */	 public void onChildAdded(Component child);	/** Called when a child is removed.	 * If a component want to optimize the update, it might do something	 * different. Otherwise, it simply does nothing.	 *	 * <p>It is not a good idea to throw an exception in this method, since	 * it is in the middle of modifying the component tree.	 */	 public void onChildRemoved(Component child);	/** Called when this component is attached to a page.	 *	 * <p>If a component is moved from one page to another,	 * {@link #onPageAttached} is called with both pages.	 * Note: {@link #onPageDetached} is not called in this case.	 *	 * <p>Note: this method is called even if the component is attached	 * to a page implicitly thru, say, {@link #setParent}.	 *	 * <p>It is not a good idea to throw an exception in this method, since	 * it is in the middle of modifying the component tree.	 *	 * @param newpage the new page (never null).	 * @param oldpage the previous page, if any, or null if it didn't	 * belong to any page.	 * @since 3.0.0	 */	public void onPageAttached(Page newpage, Page oldpage);	/** Called when this component is detached from a page.	 *	 * <p>If a component is moved from one page to another,	 * {@link #onPageAttached} is called with both pages.	 * Note: {@link #onPageDetached} is not called in this case.	 * In other words, {@link #onPageDetached} is called only if a component	 * is detached from a page (not belong to any other page).	 *	 * <p>Note: this method is called even if the component is detached	 * to a page implicitly thru, say, {@link #setParent}.	 *

⌨️ 快捷键说明

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