📄 page.java
字号:
* <h3>Differences between {@link #getVariable} and {@link #getZScriptVariable}</h3> * * <p>{@link #getVariable} returns only variables defined by * {@link #setVariable} (i.e., a shortcut to {@link Namespace#setVariable}). * On the other hand, {@link #getZScriptVariable} returns these variables * and those defined when executing zscripts. * * @see Component#getVariable * @see Component#getNamespace */ public Object getVariable(String name); /** Unsets a variable from the namespace ({@link #getNamespace}). * * <p>It is the same as getNamespace().unsetVariable(name, true). * * @see Component#unsetVariable * @see Component#getNamespace */ public void unsetVariable(String name); /** Returns the class of the specified name by searching * the thread class loader and the classes defined in the * loaded interpreters. * * <p>Note: it also looks for the class by use of the current thread's * class loader. * * @return the class, or null if not found * @see #getLoadedInterpreters */ public Class getZScriptClass(String clsnm); /** Returns the variable of the specified name by searching * the loaded interpreters. * * @return the method, or null if not found * @see #getLoadedInterpreters * @since 3.0.0 */ public Function getZScriptFunction(String name, Class[] argTypes); /** Returns the variable of the specified name by searching * the logical scope of the specified namespace for all * the loaded interpreters. * * <p>It is similar to {@link #getZScriptVariable(String)}, except * it uses the specified namespace as a reference to identify the * correct scope for searching the variable. * If the interpreter does NOT support hierachical scopes, * this method is the same as {@link #getZScriptVariable(String)}. * * @param ns the namespace used as a reference to identify the * correct scope for searching the variable. * It is ignored if the interpreter doesn't support hierachical scopes. * Note: this method doesn't look for any variable stored in ns. * @return the method, or null if not found * @see #getLoadedInterpreters * @since 2.4.1 */ public Function getZScriptFunction(Namespace ns, String name, Class[] argTypes); /** Returns the variable of the specified name by searching * the logical scope of the namespace of the specified component * for all the loaded interpreters. * * <p>It is a shortcut: getZScriptFunction(comp.getNamespace(), name, argTypes); * @since 3.0.0 */ public Function getZScriptFunction(Component comp, String name, Class[] argTypes); /** @deprecated As of release 3.0.0, replaced by {@link #getZScriptFunction(String,Class[])}. */ public org.zkoss.zk.scripting.Method getZScriptMethod(String name, Class[] argTypes); /** @deprecated As of release 3.0.0, replaced by {@link #getZScriptFunction(String,Class[])}. */ public org.zkoss.zk.scripting.Method getZScriptMethod(Namespace ns, String name, Class[] argTypes); /** Returns the value of the variable of the specified name by searching * the loaded interpreters, if any. * * <h3>Differences between {@link #getVariable} and {@link #getZScriptVariable}</h3> * * <p>{@link #getVariable} returns variables defined by * {@link #setVariable} (i.e., a shortcut to {@link Namespace#setVariable}). * On the other hand, {@link #getZScriptVariable} returns the variables * that are defined when executing zscripts. * * @return the value of the variable, or null if not found * @see #getLoadedInterpreters */ public Object getZScriptVariable(String name); /** Returns the value of the variable of the specified name by searching * the logical scope of the specified namespace for all * the loaded interpreters, if any. * * <p>It is similar to {@link #getZScriptVariable(String)}, except * it uses the specified namespace as a reference to identify the * correct scope for searching the variable. * If the interpreter does NOT support hierachical scopes, * this method is the same as {@link #getZScriptVariable(String)}. * * @param ns the namespace used as a reference to identify the * correct scope for searching the variable. * It is ignored if the interpreter doesn't support hierachical scopes. * Note: this method doesn't look for any variable stored in ns. */ public Object getZScriptVariable(Namespace ns, String name); /** Returns the value of the variable of the specified name by searching * the logical scope of the namespace of the specified component * for all the loaded interpreters, if any. * * <p>It is a shortcut: getZScriptVariable(comp.getNamespace(), name); * @since 3.0.0 */ public Object getZScriptVariable(Component comp, String name); /** Returns a variable that is visible to XEL expressions. * * <p>This method is mainly used to access special variable, such as * request parameters (if this page is requested by HTTP). * * <p>Note: components that are specified with an ID are already accessible * by {@link #getVariable}. * @since 3.0.0 */ public Object getXelVariable(String name); /** Returns a variable that is visible to XEL expressions. * @deprecated As of release 3.0.0, replaced by {@link #getXelVariable}. */ public Object getELVariable(String name); /** Adds a name resolver that will be used to resolve a variable * by {@link #getVariable}. * * <p>Note: the variables resolved by the specified resolver are * accessible to both zscript and EL expressions. * * @return wether the resolver is added successfully. * Note: if the resolver was added before, it won't be added again * and this method returns false. */ public boolean addVariableResolver(VariableResolver resolver); /** Removes a name resolve that was added by {@link #addVariableResolver}. * * @return false if resolved is not added before. */ public boolean removeVariableResolver(VariableResolver resolver); //-- event listener --// /** Adds an event listener to specified event for all components in * this page. * * <p>Due to performance consideration, unlike {@link Component#addEventListener}, * all event listeners for the page are deferrable, no matter * {@link org.zkoss.zk.ui.event.Deferrable} is implemented or not. * * @param evtnm what event to listen (never null) * @return whether the listener is added; false if it was added before. * @see Component#addEventListener */ public boolean addEventListener(String evtnm, EventListener listener); /** Removes an event listener. * @return whether the listener is removed; false if it was never added. */ public boolean removeEventListener(String evtnm, EventListener listener); /** Returns whether the event listener is available. */ public boolean isListenerAvailable(String evtnm); /** Returns an iterator for iterating listener for the specified event. */ public Iterator getListenerIterator(String evtnm); //-- special control --// /** Removes all components in this page. * * @see Execution#createComponents(String,Component,Map) */ public void removeComponents(); /** Invalidates this page to cause all components to redraw. */ public void invalidate(); /** Returns the namespace used to store variables belonging to * the ID space of this page. * * @see #interpret */ public Namespace getNamespace(); /** Interpret a script of the specified scripting language against * the specified namespace. * * @param zslang the scripting language. If null, {@link #getZScriptLanguage} * is assumed. * @param ns the namspace. If null, the current namespace is assumed. * The current namespace is the event target's namespace * ({@link org.zkoss.zk.ui.event.Event#getTarget}), * if the thread is processing an event. * Otherwise, the current namespace is this page's namespace */ public void interpret(String zslang, String script, Namespace ns); /** Returns the interpreter of the specified scripting language. * * <p>The interpreter will be loaded and initialized, * if it is not loaded yet. * * @param zslang the scripting language. If null, {@link #getZScriptLanguage} * is assumed. * @exception InterpreterNotFoundException if not found. */ public Interpreter getInterpreter(String zslang); /** Returns all loaded interpreters. */ public Collection getLoadedInterpreters(); /** Returns the default scripting language which is assumed when * a zscript element doesn't specify any language. * * @return the default scripting language, say, Java. Never null. */ public String getZScriptLanguage(); /** Sets the defafult scripting language which will be assumed * if a zscript element doesn't specify any language. * * @exception InterpreterNotFoundException if no such language */ public void setZScriptLanguage(String zslang) throws InterpreterNotFoundException; //metainfo// /** Returns the function mapper for resolving XEL functions, or null if * not available. * * @since 3.0.0 */ public FunctionMapper getFunctionMapper(); /** Adds the function mapper in addition to the current one. * * <p>The new added function mapper has the higher priority. * {@link #getFunctionMapper} will return the new * * @param mapper the new function mapper (null to ignore). */ public void addFunctionMapper(FunctionMapper mapper); /** Returns the language definition that this page belongs to (never null). */ public LanguageDefinition getLanguageDefinition(); /** Returns the map of component definitions (never null). * * <p>Note: the map is shared among all instance of the same page definition. * Any component definition added (by {@link ComponentDefinitionMap#add}) * are visible to all other instances of the same page definition. * Thus, it is NOT a good idea to change its content. */ public ComponentDefinitionMap getComponentDefinitionMap(); /** Returns the component definition of the specified name, or null * if not found. * * <p>Note: unlike {@link LanguageDefinition#getComponentDefinition}, * this method doesn't throw ComponentNotFoundException if not found. * It just returns null. * * @param recur whether to look up the component from {@link #getLanguageDefinition} */ public ComponentDefinition getComponentDefinition(String name, boolean recur); /** Returns the component definition of the specified class, or null * if not found. * * <p>Note: unlike {@link LanguageDefinition#getComponentDefinition}, * this method doesn't throw ComponentNotFoundException if not found. * It just returns null. * * @param recur whether to look up the component from {@link #getLanguageDefinition} */ public ComponentDefinition getComponentDefinition(Class cls, boolean recur);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -