0

how to redraw a window?

asked 2006-04-02 07:56:20 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3664260

By: oberinspector

i want to redraw a window, afterr the login status has changed. I read i must not use redraw...

void logout() {
ctt_login.logout(session);
LoginWindow.invalidate(LoginWindow.INNER);
}

i tried this with inner and outer, but nothing happend...

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2006-04-03 02:57:15 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665108

By: tomyeh

First, using invalidate is correct to redraw a window. To redraw a page, use page.invalidate(). INNER means only the inner part needs to be updated.

Is logout() called by an event listener?

link publish delete flag offensive edit

answered 2006-04-03 06:18:39 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665237

By: oberinspector

yes... when a user is already logged in and stored in the session no login form should appear... i have a logout button, onClick calls logout:

<window id = "LoginWindow" title="Login" border="normal" width="300px"
onOk="submit()">
<zscript>
ctt_login = new de.infratour.constraints.Login();
noSessionUser = (Boolean)!ctt_login.hasSessionUser(session);

if(!noSessionUser){
LoginWindow.title=ctt_login.getSessionUserNickname(session);
}
void submit() {
ctt_login.validateLogin(login, login);
LoginWindow.invalidate(LoginWindow.INNER);
}
void logout() {
ctt_login.logout(session);
LoginWindow.invalidate(LoginWindow.INNER);
}
</zscript>

<caption unless="${noSessionUser}">
<toolbarbutton label="logout" onClick="logout()"/> </caption>

<grid if="${noSessionUser}">
<rows>
<row>
Login Name: <textbox id="login" />
</row>
<row>
Passwort: <textbox id="password" type="password" />
</row>
<row>
<button label="Login" onClick="submit()" onOk="submit()"/>
</row>
</rows>
</grid>
</window>

Probably i have to call
noSessionUser = (Boolean)!ctt_login.hasSessionUser(session);
again, before i invalidate the window... i tried to call it direct in the if and unless attributes, but i didnt found the right syntax... :-(

BTW... submit calls my login form constrain, which makes the overall checks of the form and throws the WrongValueException to the texboxes, which caused the error...

link publish delete flag offensive edit

answered 2006-04-03 06:25:47 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665248

By: oberinspector

and what also doesn't work... i want to submit the form when i press enter on my keyboard... i placed the onOk="submit" in the window and in the button...
nothing happens, when the focus is not on the button...

link publish delete flag offensive edit

answered 2006-04-03 06:40:17 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665255

By: tomyeh

onOK, not onOk

link publish delete flag offensive edit

answered 2006-04-03 06:44:05 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665258

By: tomyeh

First, zscript is evaluated only once when the page is loaded. So, you have to update noSessionuser when logout.

Second, EL expression (what is specified in the if and unless attribute) has some limitation that it cannot handle member function calls. I guessed you are hitting this. However, some builtin variables could help you to access attributes, such as

if="${sessionScope.login}"


link publish delete flag offensive edit

answered 2006-04-03 06:59:48 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665268

By: oberinspector

sessionScope looks fine... Thanks!


link publish delete flag offensive edit

answered 2006-04-03 07:31:17 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665299

By: oberinspector

<grid if="${sessionScope.SESSION_USER==null}"> is correct evaluated. invalidate forces a redraw, but the if attribute seems not to be evaluated again in this case... when i do a browser reload it works...

link publish delete flag offensive edit

answered 2006-04-03 08:08:28 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665356

By: tomyeh

Yes, it is evaluated only once.

The whole page is evaluated only once when it is loaded. Then, it reponses to events as you registered.

In your case (to evaluate the whole page again), you have to invoke
page.recreate(null) (see Page's javadoc). It removes all components and recreate them based on the page definition.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2006-04-02 07:56:20 +0800

Seen: 651 times

Last updated: Apr 03 '06

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More