access implicit object"
From Documentation
Maya001122 (talk | contribs) m (Created page with '{{ZKDevelopersGuidePageHeader}} In <tt>zscript</tt>, you can access implicit object like they are declared global variable. <source lang="xml" > <window> <zscript> self.tit…') |
m (correct highlight (via JWB)) |
||
Line 1: | Line 1: | ||
{{ZKDevelopersGuidePageHeader}} | {{ZKDevelopersGuidePageHeader}} | ||
− | In < | + | In <code>zscript</code>, you can access implicit object like they are declared global variable. |
<source lang="xml" > | <source lang="xml" > | ||
Line 11: | Line 11: | ||
</source> | </source> | ||
− | the result shows < | + | the result shows <code>window</code>'s title becomes <code>given by zscript</code> |
Not every implicit object has its own mapping java object. But there is always a workaround. If you want to access attribute in desktopScope, the following two statements are equivalent, assuming comp is a component. | Not every implicit object has its own mapping java object. But there is always a workaround. If you want to access attribute in desktopScope, the following two statements are equivalent, assuming comp is a component. | ||
Line 20: | Line 20: | ||
</source> | </source> | ||
− | < | + | <code>Desktop.java</code> has api such as <code>getExecution</code>, <code>getPage</code>, <code>getSession</code>, <code>getWebApp</code>. And <code>AbstractComponent.java</code> has <code>getSpaceOwner</code>, <code>getDesktop</code>. And <code>Execution</code> has <code>getArg</code>. And <code>ForEachImpl.java</code> has <code>getEach</code> |
− | For example, you can get the implicit object < | + | For example, you can get the implicit object <code>execution</code> from any component |
<source lang="java" > | <source lang="java" > | ||
comp.getDesktop().getExecution() | comp.getDesktop().getExecution() |
Latest revision as of 10:41, 19 January 2022
This documentation is for an older version of ZK. For the latest one, please click here.
In zscript
, you can access implicit object like they are declared global variable.
<window>
<zscript>
self.title="given by zscript";
</zscript>
</window>
the result shows window
's title becomes given by zscript
Not every implicit object has its own mapping java object. But there is always a workaround. If you want to access attribute in desktopScope, the following two statements are equivalent, assuming comp is a component.
comp.getAttribute("some", comp.DESKTOP_SCOPE);
comp.getDesktop().getAttribute("some");
Desktop.java
has api such as getExecution
, getPage
, getSession
, getWebApp
. And AbstractComponent.java
has getSpaceOwner
, getDesktop
. And Execution
has getArg
. And ForEachImpl.java
has getEach
For example, you can get the implicit object execution
from any component
comp.getDesktop().getExecution()