Package org.zkoss.zul

Examples of org.zkoss.zul.Listitem


      getListbox().clearSelection();
    }

    if (dragged instanceof Treerow) {
      Treeitem treeitem = (Treeitem) ((Treerow) dragged).getParent();
      Listitem listitem = new Listitem("");
      listitem.setValue(treeitem.getValue());
      dragged.getParent().removeChild(dragged);
      target.getParent().insertBefore(listitem, target);
    }

    try {
View Full Code Here


        item.addEventListener(Events.ON_DROP, new EventListener() {
          public void onEvent(Event evt) {
            DropEvent dropEvent = (DropEvent) evt;
            Sortbox.this.addItemToSelection((Listitem) dropEvent.getDragged());
            for (Object obj : Sortbox.this.getSelectedItems()) {
              Listitem listitem = (Listitem) obj;
              Sortbox.this.insertBefore(listitem, dropEvent.getTarget());
            }
          }
        });
      }
View Full Code Here

  throws javax.servlet.ServletException, java.io.IOException {
    final Desktop desktop = getDesktop(request);
    Bridge bridge = Bridge.start(getServletContext(), request, response, desktop);
    try {
      final Listbox listbox = (Listbox) ((Page)desktop.getPages().iterator().next()).getRoots().iterator().next();
      listbox.appendChild(new Listitem("Ajax " + ++cnt));
      response.getWriter().write(bridge.getResult());
    } finally {
      bridge.close();
    }
  }
View Full Code Here

/* package */class ListitemCollectionItem implements CollectionItemExt, java.io.Serializable {
  private static final long serialVersionUID = 200808191434L;

  public Component getComponentCollectionOwner(Component comp) {
    if (comp instanceof Listitem) {
      final Listitem item = (Listitem) comp;
      return item.getListbox();
    } else {
      throw new UiException(
          "Unsupported type for ListitemCollectionItem: " + comp);
    }
  }
View Full Code Here

    }
  }

  public void setupBindingRenderer(Component comp, DataBinder binder) {
    if (comp instanceof Listitem) {
      final Listitem li = (Listitem) comp;
      final Listbox lbx = li.getListbox();
      if (lbx.getItemRenderer() == null) {
        lbx.setItemRenderer(new BindingListitemRenderer(li, binder));
      }
    }
  }
View Full Code Here

  }
 
  //-- ListitemRendererExt --//
  public Listitem newListitem(Listbox listbox) {
    //clone from template
    final Listitem clone = (Listitem)_template.clone();
    //TODO: see if databinder has this kind of Listitem, if not, add new CollectionListItem
    //avoid duplicate id error, will set to new id when render()
    //Bug #1962153: Data binding generates duplicate id in some case (add "_")
    if (clone.getId().length() > 0) {
      clone.setId(null);
    }
         
    //link cloned component with template
    //each Listitem and and it decendants share the same templatemap
    Map templatemap = new HashMap(7);
    linkTemplates(clone, _template, templatemap);
   
    //link this template map to parent templatemap (Listbox in Listbox)
    Map parenttemplatemap = (Map) listbox.getAttribute(DataBinder.TEMPLATEMAP);
    if (parenttemplatemap != null) {
        templatemap.put(DataBinder.TEMPLATEMAP, parenttemplatemap);
    }
    //kept clone kids somewhere to avoid create too many components in browser
    final List kids = new ArrayList(clone.getChildren());
    clone.setAttribute(KIDS, kids);
    clone.getChildren().clear();
    return clone;
  }
View Full Code Here

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

        Listitem item = objListbox.getSelectedItem();
        if (item == null) {
            this.showMsg("修改前要選取修改的建築物", "必要的輸入");
            item = null;
            return;
        }
View Full Code Here

        }

    }

    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 buildingDocList = sess.selectList("Building.findByBuildingId", obj.getBuildingId());
        sess = null;

        if (buildingDocList.size() != 0) {
            this.showMsg("刪除前要先刪除相關的文件及模型", "必要的操作");
            return;
        }
        buildingDocList = null;


        obj = (Building) item.getValue();
        BuildingDao dao = new BuildingDao();
        dao.delete(obj);
        dao = null;

        refreshObjEntities();
View Full Code Here

        buildingAddressTextbox.setValue(var.getBuildingAddress());

    }

    public void openForAdd() {
        Listitem item = objListbox.getSelectedItem();
        if (item == null) {
            this.showMsg("新增建築物文件前要選取建築物", "必要的輸入");
            item = null;
            return;
        }
        obj = (Building) item.getValue();

        Map args = new HashMap();
        args.put("building", obj);
        args.put("operation", "addBuildingDoc");
        args.put("buildingController", this);
View Full Code Here

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

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

        sub = (BuildingDocForm) item.getValue();
        Map args = new HashMap();
        args.put("buildingController", this);
        args.put("operation", "updateBuildingDoc");
        args.put("building", obj);
        args.put("buildingDocForm", sub);
View Full Code Here

TOP

Related Classes of org.zkoss.zul.Listitem

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.