Package org.zkoss.zul

Examples of org.zkoss.zul.Listitem$ExtraCtrl


    public void deleteSub() {
        if (subListbox == null) {
            subListbox = (Listbox) this.getFellow("docListbox");
        }
        Listitem item = subListbox.getSelectedItem();

        if (item == null) {
            this.showMsg("刪除前要選取文件或模型", "必要的輸入");
            item = null;
            return;
        }
        sub = (BuildingDocForm) item.getValue();

        BuildingDoc doc = convert(sub);

        boolean success = (new File(doc.getModelFileName())).delete();
View Full Code Here


    public void selectSub() {
        if (subListbox == null) {
            subListbox = (Listbox) this.getFellow("docListbox");
        }
        Listitem item = subListbox.getSelectedItem();

        sub = (BuildingDocForm) item.getValue();
    }
View Full Code Here

        final ListModel xmodel = lbx.getModel();
        if (xmodel instanceof BindingListModel) {
          final BindingListModel model = (BindingListModel) xmodel;
          int index = model.indexOf(val);
          if (index >= 0) {
            final Listitem item = (Listitem) lbx.getItemAtIndex(index);
            //Bug #2728704: Listbox with databinding generates onSelect w/o user action
            //Shall not fire event by spec. For backward compatibility(still want to
            //fire onSelect event as usual), user can specifies in zk.xml
            //<library-property>
            //  <name>org.zkoss.zkplus.databind.onSelectWhenLoad</name>
            //  <value>true</value>
            //</library-property>
            //then data binder will still fire the onSelect event as usual.
            if (SelectedItemConverter.isOnSelectWhenLoad()) {
              final int selIndex = lbx.getSelectedIndex();
             
            //We need this to support load-when:onSelect when first load
            //the page in (so it is called only once).
              if (item != null && selIndex != index) { // bug 1647817, avoid endless-loop
                Set items = new HashSet();
                items.add(item);
                //bug #2140491
                Executions.getCurrent().setAttribute("zkoss.zkplus.databind.ON_SELECT"+lbx.getUuid(), Boolean.TRUE);
                Events.postEvent(new SelectEvent("onSelect", lbx, items, item));
              }
            }
            return item;
          }
        } else if (xmodel == null) { //no model case, assume Listitem.value to be used with selectedItem
          //iterate to find the selected item assume the value (select mold)
          for (final Iterator it = lbx.getItems().iterator(); it.hasNext();) {
            final Listitem li = (Listitem) it.next();
            if (val.equals(li.getValue())) {
              return li;
            }
          }
        } else {
          throw new UiException("model of the databind listbox "+lbx+" must be an instanceof of org.zkoss.zkplus.databind.BindingListModel." + xmodel);
View Full Code Here

  }
 
  /** Creates an new and unloaded listitem. */
  protected final Listitem newUnloadedItem(ListitemRenderer renderer, int index) {
    final ListModel model = _listbox.getModel();
    Listitem item = null;
    if (model instanceof GroupsListModel) {
      final GroupsListModel gmodel = (GroupsListModel) model;
      final GroupDataInfo info = gmodel.getDataInfo(index);
      switch(info.type){
      case GroupDataInfo.GROUP:
        item = newListgroup(renderer);
        ((Listgroup)item).setOpen(!info.close);
        break;
      case GroupDataInfo.GROUPFOOT:
        item = newListgroupfoot(renderer);
        break;
      default:
        item = newListitem(renderer);
      }   
    }else{
      item = newListitem(renderer);
    }
    ((LoadStatus)item.getExtraCtrl()).setLoaded(false);
    ((LoadStatus)item.getExtraCtrl()).setIndex(index);

    newUnloadedCell(renderer, item);
    return item;
  }
View Full Code Here

    newUnloadedCell(renderer, item);
    return item;
  }
  private Listitem newListitem(ListitemRenderer renderer) {
    Listitem item = null;
    if (renderer instanceof ListitemRendererExt)
      item = ((ListitemRendererExt)renderer).newListitem(_listbox);
    if (item == null) {
      item = new Listitem();
      item.applyProperties();
    }
    return item;
  }
View Full Code Here

    public void update() {
        if (!validate()) {
            return;
        }

        Listitem item = objListbox.getSelectedItem();
        if (item == null) {
            this.showMsg("修改前要選取修改的使用者", "必要的輸入");
            item = null;
            return;
        }

        obj = (User) viewToObj(item.getValue());

        // encode password to md5
        if (obj.getPasswd() != null) {
            obj.setPasswd(Utility.getInstance().md5(obj.getPasswd()));
        }
View Full Code Here

        refreshObjEntities();

    }

    public void delete() {
        Listitem item = objListbox.getSelectedItem();
        if (item == null) {
            this.showMsg("刪除前要選取使用者", "必要的輸入");
            item = null;
            return;
        }

        // check slave table data !!
        SqlSession sess = IBatisFactory.getInstance().getSqlSession();
        List dutyList = sess.selectList("Duty.getAll", obj.getUserId());
        sess = null;

        if (!dutyList.isEmpty()) {
            this.showMsg("刪除前要先刪除相關的職位", "必要的操作");
            return;
        }
        dutyList = null;


        obj = (User) viewToObj(item.getValue());
        UserDao dao = new UserDao();
        dao.delete(obj);
        dao = null;

        onCreate();
View Full Code Here

        if (!checkObjListboxSelected()) {
            return;
        }

        objListbox = (Listbox) getFellow("objListbox");
        Listitem item = objListbox.getSelectedItem();
        obj = (User) item.getValue();

        Map args = new HashMap();

        args.put("operation", "addDuty");
        args.put("user", obj);
View Full Code Here

        subListbox = (Listbox) this.getFellow("subObjListbox");
        if (subListbox.getSelectedItem() == null) {
            this.showMsg("修改任職設定前要選取", "必要的輸入");
        }
        Listitem item = subListbox.getSelectedItem();
        sub = (DutyForm) item.getValue();
        Map args = new HashMap();

        args.put("operation", "updateDuty");
        args.put("masterController", this);
        args.put("user", obj);
View Full Code Here

    public void deleteSub() {
        if (subListbox == null) {
            subListbox = (Listbox) this.getFellow("subObjListbox");
        }
        Listitem item = subListbox.getSelectedItem();

        if (item == null) {
            this.showMsg("刪除前要選取權限", "必要的輸入");
            item = null;
            return;
        }
        sub = (DutyForm) item.getValue();

        Duty duty = convert(sub);

//        boolean success = (new File(duty.getModelFileName())).delete();
View Full Code Here

TOP

Related Classes of org.zkoss.zul.Listitem$ExtraCtrl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.