Package org.zkoss.zul

Examples of org.zkoss.zul.Combobox$Renderer


        RequestMaintainForm form = (RequestMaintainForm) obj;

        Textbox requestByTB = (Textbox) getFellow("requestBy");
        Datebox requestAtDate = (Datebox) getFellow("requestAtDate");
        Timebox requestAtTime = (Timebox) getFellow("requestAtTime");
        Combobox statusCB = (Combobox) getFellow("status");
        Textbox requestMobilePhoneTB = (Textbox) getFellow("requestMobilePhone");
        Combobox urgentLevelCB = (Combobox) getFellow("urgentLevel");

        requestByTB.setText(form.getRequestBy());
        requestAtDate.setValue(form.getRequestAt());
        requestAtTime.setValue(form.getRequestAt());
        Iterator statusCBItr = statusCB.getItems().iterator();
        while (statusCBItr.hasNext()) {
            Comboitem item = (Comboitem) statusCBItr.next();
            if (item.getValue().toString().equals(form.getStatus())) {
                statusCB.setSelectedItem(item);
            }
        }
        requestMobilePhoneTB.setText(form.getRequestMobilePhone());

        Textbox requestMaintainNoTB = (Textbox) getFellow("requestMaintainNo");
        Combobox buildingCB = (Combobox) getFellow("building");
        Textbox requestReasonTB = (Textbox) getFellow("requestReason");
        Datebox firstResponseAtDate = (Datebox) getFellow("firstResponseAtDate");
        Timebox firstResponseAtTime = (Timebox) getFellow("firstResponseAtTime");
        Textbox responseMessageTB = (Textbox) getFellow("responseMessage");

        requestMaintainNoTB.setText(form.getRequestMaintainNo());
        Iterator buildingCBItr = buildingCB.getItems().iterator();
        while (buildingCBItr.hasNext()) {
            Comboitem item = (Comboitem) buildingCBItr.next();
            Building building = (Building) item.getValue();
            if (building.getBuildingId().toString().equals(form.getBuildingId().toString())) {
                buildingCB.setSelectedItem(item);
            }
        }
        requestReasonTB.setText(form.getRequestReason());
        firstResponseAtDate.setValue(form.getFirstResponseAt());
        firstResponseAtTime.setValue(form.getFirstResponseAt());
View Full Code Here


        }

        Textbox requestByTB = (Textbox) getFellow("requestBy");
        Datebox requestAtDate = (Datebox) getFellow("requestAtDate");
        Timebox requestAtTime = (Timebox) getFellow("requestAtTime");
        Combobox statusCB = (Combobox) getFellow("status");
        Textbox requestMobilePhoneTB = (Textbox) getFellow("requestMobilePhone");
        Combobox urgentLevelCB = (Combobox) getFellow("urgentLevel");

        var.setRequestBy(requestByTB.getText());
        if (requestAtDate.getValue() != null
                && requestAtTime.getValue() != null) {
            Timestamp requestAt = new Timestamp(requestAtDate.getValue().getTime());
            requestAt.setHours(requestAtTime.getValue().getHours());
            requestAt.setMinutes(requestAtTime.getValue().getMinutes());
            var.setRequestAt(requestAt);
        }
        var.setStatus(statusCB.getSelectedItem().getValue().toString());
        var.setRequestMobilePhone(requestMobilePhoneTB.getText());
        var.setUrgentLevel(urgentLevelCB.getSelectedItem().getValue().toString());

        Textbox requestMaintainNoTB = (Textbox) getFellow("requestMaintainNo");
        Combobox buildingCB = (Combobox) getFellow("building");
        Textbox requestReasonTB = (Textbox) getFellow("requestReason");
        Datebox firstResponseAtDate = (Datebox) getFellow("firstResponseAtDate");
        Timebox firstResponseAtTime = (Timebox) getFellow("firstResponseAtTime");
        Textbox responseMessageTB = (Textbox) getFellow("responseMessage");

        var.setRequestMaintainNo(requestMaintainNoTB.getText());
        var.setBuilding((Building) buildingCB.getSelectedItem().getValue());
        var.setRequestReason(requestReasonTB.getText());
        if (firstResponseAtDate.getValue() != null
                && firstResponseAtTime.getValue() != null) {
            Timestamp firstResponseAt = new Timestamp(firstResponseAtDate.getValue().getTime());
            firstResponseAt.setHours(firstResponseAtTime.getValue().getHours());
View Full Code Here

  private static final long serialVersionUID = 200808191437L;
  /**
   * @since 3.0.2
   */
  public Object coerceToBean(Object val, Component comp) {
    final Combobox cbbox = (Combobox) comp;
    if (Executions.getCurrent().getAttribute("zkoss.zkplus.databind.ON_SELECT"+cbbox.getUuid()) != null) {
      //bug #2140491
      //triggered by coerceToUi(), ignore this
      Executions.getCurrent().removeAttribute("zkoss.zkplus.databind.ON_SELECT"+cbbox.getUuid());
      return TypeConverter.IGNORE;
    }
      if (val != null) {
        final ListModel model = cbbox.getModel();
        //Bug #2010389
        //1. loadAll
        //2. setModel (by 1.), post onInitRender.
        //3. setSelectedItem (by 1.), coerceToUi, post onSelect with OLD Comboitem.
        //4. onInitRender(by 2.), syncModel and reconstruct new Comboitem(s) list, fire onInitRenderLater 
        //** 5. save (by 3.), coreceToBean with OLD Comboitem, cannot locate the index with indexOf()
        //6. onInitRenderLater(by 4.), setSelectedItem, coerceToUi, post onSelect with new Comboitem
       
        //no model case, assume Comboitem.value to be used with selectedItem
       return model != null ? model.getElementAt(cbbox.getItems().indexOf(val)) : ((Comboitem) val).getValue();
     }
     return null;
  }
View Full Code Here

 
  /**
   * @since 3.0.2
   */
  public Object coerceToUi(Object val, Component comp) {
    final Combobox cbbox = (Combobox) comp;
      if (val != null) {
        final ListModel xmodel = cbbox.getModel();
     
        if (xmodel instanceof BindingListModel) {
          //Bug #2010389
          //if combobox is going to do onInitRender (syncModel), no need to setSelectedItem
          if (cbbox.getAttribute("zul.Combobox.ON_INITRENDER") != null) {
            return TypeConverter.IGNORE;
          }
          final BindingListModel model = (BindingListModel) xmodel;
          int index = model.indexOf(val);
          if (index >= 0 && cbbox.getItemCount() > index) {
            final Comboitem item = (Comboitem) cbbox.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 = cbbox.getSelectedIndex();
             
              //We need this to support load-when:onSelect
              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"+cbbox.getUuid(), Boolean.TRUE);
                Events.postEvent(new SelectEvent("onSelect", cbbox, items, item));
              }
            }
            return item;
          }
        } else if (xmodel == null) { //no model case, assume Comboitem.value to be used with selectedItem
          //iterate to find the selected item assume the value (select mold)
          for (final Iterator it = cbbox.getItems().iterator(); it.hasNext();) {
            final Comboitem li = (Comboitem) it.next();
            if (val.equals(li.getValue())) {
              return li;
            }
          }
View Full Code Here

        initOrgIdCB();
        refreshObjEntities();
    }

    private void initOrgIdCB() {
        Combobox orgIdCB = (Combobox) getFellow("orgId");
        SqlSession sess = IBatisFactory.getInstance().getSqlSession();
        List keyValueList = sess.selectList("Org.getName_Id");
        sess = null;
        logger.debug("org CB size:" + keyValueList.size());
View Full Code Here

    }

    public void objToView(Object obj) {
        UserForm var = (UserForm) obj;

        Combobox orgIdCB = (Combobox) getFellow("orgId");
        Textbox userNameTB = (Textbox) getFellow("userName");
        Textbox accountTB = (Textbox) getFellow("account");
        Textbox passwdTB = (Textbox) getFellow("passwd");

        Iterator supplierIt = orgIdCB.getItems().iterator();
        while (supplierIt.hasNext()) {
            Comboitem item = (Comboitem) supplierIt.next();
            Org s = (Org) item.getValue();

            logger.debug("" + var.getOrgId() + ", " + s.getOrgId());
            if (var.getOrgId() != null && var.getOrgId() == s.getOrgId()) {
                orgIdCB.setSelectedItem(item);
            }
        }
        userNameTB.setText(var.getUserName());
        accountTB.setText(var.getAccount());
        passwdTB.setText(var.getPasswd());
View Full Code Here

        accountTB.setText(var.getAccount());
        passwdTB.setText(var.getPasswd());
    }

    public void query() {
        Combobox orgIdCB = (Combobox) getFellow("orgId");
        Comboitem itemVar = orgIdCB.getSelectedItem();
        String queryString = null;
        Map para = new HashMap();

        logger.debug("--->itemVar: " + itemVar);
        if (itemVar != null) {
            queryString = orgIdCB.getSelectedItem().getLabel();
            para.put("orgName", queryString);
        } else {
            para.put("orgName", null);
        }

        refreshObjEntities(para);

        // empty all fields , except the query condition field
        UserForm emptyObj = new UserForm();
        objToView(emptyObj);

        Iterator supplierIt = orgIdCB.getItems().iterator();
        while (supplierIt.hasNext()) {
            Comboitem item = (Comboitem) supplierIt.next();
            Org s = (Org) item.getValue();

            if (queryString != null && queryString.equals(s.getOrgName())) {
                orgIdCB.setSelectedItem(item);
            }
        }

    }
View Full Code Here

                iae.printStackTrace();
            }
        }
        var.setOperateBy(operateBy);

        Combobox orgIdCB = (Combobox) getFellow("orgId");
        Textbox userNameTB = (Textbox) getFellow("userName");
        Textbox accountTB = (Textbox) getFellow("account");
        Textbox passwdTB = (Textbox) getFellow("passwd");

        var.setOrg((Org) orgIdCB.getSelectedItem().getValue());
        var.setUserName(userNameTB.getText());
        var.setAccount(accountTB.getText());
        var.setPasswd(passwdTB.getText());

View Full Code Here

        initOrgIdCB();
        refreshObjEntities();
    }

    private void initOrgIdCB() {
        Combobox orgIdCB = (Combobox) getFellow("OrgId");
        SqlSession sess = IBatisFactory.getInstance().getSqlSession();
        List keyValueList = sess.selectList("Org.getName_Id");
        sess = null;
        logger.debug("org CB size:" + keyValueList.size());
View Full Code Here

    }

    public void query() {
        // get list

        Combobox orgCB = (Combobox) this.getFellow("OrgId");
        Comboitem orgCbItem = orgCB.getSelectedItem();
        String queryOrgName = ((Org) orgCbItem.getValue()).getOrgName();
        Map para = new HashMap();
        para.put("HashMap", queryOrgName);

        System.out.println("CCCCCCCCCCCCCCCCCCCC" + queryOrgName);
        refreshObjEntities(para);

        // empty all fields , except the query condition field
        UserForm emptyObj = new UserForm();
        objToView(emptyObj);
        orgCB.setSelectedItem(orgCbItem);

    }
View Full Code Here

TOP

Related Classes of org.zkoss.zul.Combobox$Renderer

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.