zkフレームwindow間の値転送操作

3500 ワード

.zulでアクションにパラメータを渡す:
 <listcell>
            <button label="  " onClick="@command('edit',id=each.accountId)" autodisable="self" />
            <button label="  " onClick="@command('delete',id=each.accountId)" />            
          </listcell>

 Actionでパラメータを受信して新しいwindowを開く
@Command
    //      .zul   @BindingParam("id") String accountId
    public void edit(@BindingParam("id") String accountId) {
        Map<String, String> arg = new HashMap<String, String>();
        arg.put("editFlag", "edit");
        arg.put("accountId", accountId);
        //    
        arg.put("flag", "1");
        //        ,     map
        Window win = (Window) Executions.getCurrent().createComponents("/person/personEdit.zul", null, arg);
        //       
        win.setClosable(true);
        // modal:modal hightlighted         。modal   ,Window            (   )。
        win.doModal();
    }

前のwindowからのパラメータを受信
    public AccountVo getEntity() {
        if (entity == null) {
            String flag = (String) Executions.getCurrent().getArg().get("editFlag");
            if (flag.equals("add")) {
                entity = new AccountVo();
            } else {
                /*
                 *        window   
                 */
                String personId = (String) Executions.getCurrent().getArg().get("accountId");
                entity = personService.findById(personId);
            }
        }
        return entity;
    }