Revision history [back]

click to hide/show revision 1
initial version

answered 2009-04-20 15:31:47 +0800

TLHP gravatar image TLHP

thanks robertpic71 for your reply.

In waiting the specs, I tried to imitate the code of Zeta Form Building, but It didn't work ( but it worked with <window apply=""> instead of @Controller *and @AppliedTo*)

My example, it will change the value of label when we click on the button

index.zul

<zk>
<window id="personWin" title="Home Page" border="normal" width="50%">
    <label id="lbTest" value="Test"/>
    <separator></separator>
    <button id="btnTest" label="Click here ..."/>
</window>
</zk>

IndexController.java

import ...

@Scope("idspace")
@Controller
@AppliedTo("personWin")

public abstract class PersonController
{
  @Resource
  protected Window personWin;

  @Resource
  protected Label lbTest;

  @Resource
  protected Button btnTest;

  // ZK DataBinder
  protected DataBinder binder;

  public PersonController(){}

  @AfterCompose
  public void afterCompose() { 

    binder = new AnnotateDataBinder(personWin);
    personWin.setVariable("personWinBinder", binder, true);
    binder.loadAll();

  }

  @EventHandler("btnTest.onClick")
  public void doCancel(Event event) {
    lbTest.setValue("This line was changed ...");
  }

Someone can tell me where is the error??

Thanks

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