0

ZK6 - storing global data used by all MVVM models in a desktop?

asked 2012-04-11 06:43:37 +0800

davout gravatar image davout
1435 3 18

I'm building my first ZK6 app, and I have a question about where the best place is to store global data that all MVVM models can access, and hopefully allow for this global data to be passed as @init parameters to the model class.

In the equivalent ZK5 functionality I was using 'Desktop.setAttribute' to store attributes that all views might access. Then in the composer classes I would check for the presence of mandatory global data and throw an error if required global data values were not found.

Looking through the equivalent ZK6 docs I can only find the example of...


org.zkoss.zk.ui.Execution ex = org.zkoss.zk.ui.Executions.getCurrent();             
ex.setAttribute("param1","abc"); 


@Init    
public void init(@ExecutionParam("param1") String param1){         
this.param1 = param1;     
             


Unlike @ExecutionParam() the I've seen that @ContextParam(ContextType.DESKTOP) does not seem to support individual named parameters.

Basically I'm looking for a way to set data parameters that will exist at a desktop level for the entire sesssion, can be changed during the session and can be defined as init parameters for a MVVM init method. What's my best option?

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-04-11 07:04:07 +0800

davout gravatar image davout
1435 3 18

I've just discovered...

@ScopeParam(scopes=Scope.DESKTOP, value="keyString") String aTest

.... which probably serves my purpose.

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: 2012-04-11 06:43:37 +0800

Seen: 191 times

Last updated: Apr 11 '12

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