0

Program mvvm components from java

asked 2020-02-12 15:57:43 +0800

juancar gravatar image juancar
23 2

updated 2020-02-13 11:42:38 +0800

cor3000 gravatar image cor3000
5099 2 7
ZK Team

I want to write a zul dynamically from java. What I want to do is the following:

<datebox value="@bind(vm.myDate)" 
         onChange="@command('onChangeMyDate')" 
         width="100px" 
         format="dd/MM/yyyy" 
         disabled="@load(vm.dateProtected)" />

I Start with:

Date dateComponent = new Date();
dateComponent.setWidth("100px");
dateComponent.setFormat("dd/MM/yyyy");

... but as I write?

dateComponent.setValue(????????);
dateComponent.setDisabled(????????);
and dateComponent.addEventListener(????????);

I use ZK 6.5.3

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-02-13 11:52:57 +0800

cor3000 gravatar image cor3000
5099 2 7
ZK Team

updated 2020-02-13 11:53:30 +0800

Technically it is possible to add property and command-bindings from java code (e.g. if you want to separate a Richlet (no zul) from your ViewModel). This quite old article (MVVM In Java) describes the mechanism for an even older ZK version. Does this contain the information you need?

As you can see this is not very user friendly since MVVM was designed to separate the view (zul files) from your java code. Putting both into java code is often unnecessary and adds extra complexity to your code.

link publish delete flag offensive edit

Comments

Thanks, it is exactly what I am looking for. What happens is that I am thinking of creating forms dynamically from a database

juancar ( 2020-02-13 21:34:17 +0800 )edit

glad that this was helpful

cor3000 ( 2020-02-19 11:06:05 +0800 )edit
Your answer
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
1 follower

RSS

Stats

Asked: 2020-02-12 15:57:43 +0800

Seen: 2 times

Last updated: Feb 13

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